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

64-bit support for pelles c:

* New nmake file w3i6pc.nmk.
* New stack scanner ssw3i6pc.c supplies missing jump buffer definition.
* Some platform tests change from defined(MPS_PF_W3I6MV) to defined(MPS_OS_w3) && defined(MPS_ARCH_I6).
* Make reasonable changes to the source code to avoid warnings from Pelles C:
** Ensure that printf formats are consistent with arguments by using PRIuLONGEST and casting to ulongest_t.
** Use size_t for loop variables that index into arrays.
** Suppress "Consider changing type to 'size_t' for loop variable" warnings for the MPS core.

Copied from Perforce
 Change: 184996
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-03-25 10:59:09 +00:00
parent 3e6333a489
commit c1df7b56ce
29 changed files with 445 additions and 82 deletions

View file

@ -196,7 +196,8 @@ static void test(mps_arena_t arena)
collections = c;
report(arena);
printf("%lu objects (mps_collections says: %lu)\n", objs, c);
printf("%lu objects (mps_collections says: %"PRIuLONGEST")\n", objs,
(ulongest_t)c);
/* test mps_arena_has_addr */
{

View file

@ -173,7 +173,8 @@ static void *test(void *arg, size_t s)
if (collections != c) {
collections = c;
printf("\nCollection %lu, %lu objects.\n", c, objs);
printf("\nCollection %"PRIuLONGEST", %lu objects.\n",
(ulongest_t)c, objs);
report(arena);
for (r = 0; r < exactRootsCOUNT; ++r) {
if (exactRoots[r] != objNULL)

View file

@ -43,14 +43,14 @@ static mps_res_t make(mps_addr_t *p, mps_ap_t ap, size_t size)
/* stress -- create a pool of the requested type and allocate in it */
static mps_res_t stress(mps_class_t class, size_t (*size)(unsigned long i),
static mps_res_t stress(mps_class_t class, size_t (*size)(size_t i),
mps_arena_t arena, ...)
{
mps_res_t res = MPS_RES_OK;
mps_pool_t pool;
mps_ap_t ap;
va_list arg;
unsigned long i, k;
size_t i, k;
int *ps[testSetSIZE];
size_t ss[testSetSIZE];
@ -78,7 +78,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(unsigned long i),
for (k=0; k<testLOOPS; ++k) {
/* shuffle all the objects */
for (i=0; i<testSetSIZE; ++i) {
unsigned long j = rnd()%(testSetSIZE-i);
size_t j = rnd()%(testSetSIZE-i);
void *tp;
size_t ts;
@ -114,7 +114,7 @@ allocFail:
/* randomSizeAligned -- produce sizes both large and small,
* aligned by platform alignment */
static size_t randomSizeAligned(unsigned long i)
static size_t randomSizeAligned(size_t i)
{
size_t maxSize = 2 * 160 * 0x2000;
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */

View file

@ -118,7 +118,7 @@ static mps_word_t *alloc_string(const char *s, mps_ap_t ap)
* .assume.dylan-obj
*/
static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
static mps_word_t *alloc_table(size_t n, mps_ap_t ap)
{
size_t objsize;
void *p;
@ -127,7 +127,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
objsize = (3 + n) * sizeof(mps_word_t);
objsize = size_tAlignUp(objsize, MPS_PF_ALIGN);
do {
unsigned long i;
size_t i;
die(mps_reserve(&p, ap, objsize), "Reserve Table\n");
object = p;
@ -145,7 +145,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
/* gets the nth slot from a table
* .assume.dylan-obj
*/
static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
static mps_word_t *table_slot(mps_word_t *table, size_t n)
{
return (mps_word_t *)table[3+n];
}
@ -154,8 +154,7 @@ static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
/* sets the nth slot in a table
* .assume.dylan-obj
*/
static void set_table_slot(mps_word_t *table,
unsigned long n, mps_word_t *p)
static void set_table_slot(mps_word_t *table, size_t n, mps_word_t *p)
{
cdie(table[0] == (mps_word_t)table_wrapper, "set_table_slot");
table[3+n] = (mps_word_t)p;
@ -182,7 +181,7 @@ static void test(mps_arena_t arena,
mps_word_t *exacttable;
mps_word_t *preserve[TABLE_SLOTS]; /* preserves objects in the weak */
/* table by referring to them */
unsigned long i, j;
size_t i, j;
void *p;
exacttable = alloc_table(TABLE_SLOTS, exactap);

View file

@ -130,7 +130,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
objsize = (3 + n) * sizeof(mps_word_t);
objsize = size_tAlignUp(objsize, MPS_PF_ALIGN);
do {
unsigned long i;
size_t i;
die(mps_reserve(&p, ap, objsize + headerSIZE), "Reserve Table\n");
object = (mps_word_t *)((char *)p + headerSIZE);
@ -150,7 +150,7 @@ static mps_word_t *alloc_table(unsigned long n, mps_ap_t ap)
/* gets the nth slot from a table
* .assume.dylan-obj
*/
static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
static mps_word_t *table_slot(mps_word_t *table, size_t n)
{
return (mps_word_t *)table[3+n];
}
@ -159,8 +159,7 @@ static mps_word_t *table_slot(mps_word_t *table, unsigned long n)
/* sets the nth slot in a table
* .assume.dylan-obj
*/
static void set_table_slot(mps_word_t *table,
unsigned long n, mps_word_t *p)
static void set_table_slot(mps_word_t *table, size_t n, mps_word_t *p)
{
cdie(table[0] == (mps_word_t)table_wrapper, "set_table_slot");
table[3+n] = (mps_word_t)p;
@ -187,7 +186,7 @@ static void test(mps_arena_t arena,
mps_word_t *exacttable;
mps_word_t *preserve[TABLE_SLOTS]; /* preserves objects in the weak */
/* table by referring to them */
unsigned long i, j;
size_t i, j;
void *p;
exacttable = alloc_table(TABLE_SLOTS, exactap);

View file

@ -212,13 +212,16 @@
/* Suppress Pelles C warnings at warning level 2 */
/* Essentially the same settings are done in testlib.h. */
/* Some of the same settings are done in testlib.h. */
#ifdef MPS_BUILD_PC
/* "Unreachable code" (AVER, if condition is constantly true). */
#pragma warn(disable: 2154)
/* "Consider changing type to 'size_t' for loop variable" */
#pragma warn(disable: 2804)
#endif /* MPS_BUILD_PC */

View file

@ -31,7 +31,7 @@
#include "mpstd.h"
#ifdef MPS_PF_W3I6MV
#if defined(MPS_OS_w3) && defined(MPS_ARCH_I6)
#define PRIuLONGEST "llu"
#define PRIXPTR "016llX"
typedef unsigned long long ulongest_t;

View file

@ -185,7 +185,8 @@ static void *test(void *arg, size_t s)
if (collections != c) {
collections = c;
printf("\nCollection %lu started, %lu objects.\n", c, objs);
printf("\nCollection %"PRIuLONGEST" started, %lu objects.\n",
(ulongest_t)c, objs);
report(arena);
for (i = 0; i < exactRootsCOUNT; ++i) {

View file

@ -202,8 +202,10 @@ static void *test(void *arg, size_t s)
testlib_unused(obj);
}
finals += final_this_time;
printf("%lu objects finalized: total %lu of %lu\n",
final_this_time, finals, object_count);
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
" of %"PRIuLONGEST"\n",
(ulongest_t)final_this_time, (ulongest_t)finals,
(ulongest_t)object_count);
}
object_count = 0;
@ -243,8 +245,10 @@ static void *test(void *arg, size_t s)
testlib_unused(obj);
}
finals += final_this_time;
printf("%lu objects finalized: total %lu of %lu\n",
final_this_time, finals, object_count);
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
" of %"PRIuLONGEST"\n",
(ulongest_t)final_this_time, (ulongest_t)finals,
(ulongest_t)object_count);
}
mps_ap_destroy(ap);

View file

@ -605,10 +605,14 @@ extern int main(int argc, char *argv[])
mps_arena_destroy(arena);
printf("\nNumber of allocations attempted: %ld\n", NAllocateTried);
printf("Number of allocations succeeded: %ld\n", NAllocateSucceeded);
printf("Number of deallocations attempted: %ld\n", NDeallocateTried);
printf("Number of deallocations succeeded: %ld\n", NDeallocateSucceeded);
printf("\nNumber of allocations attempted: %"PRIuLONGEST"\n",
(ulongest_t)NAllocateTried);
printf("Number of allocations succeeded: %"PRIuLONGEST"\n",
(ulongest_t)NAllocateSucceeded);
printf("Number of deallocations attempted: %"PRIuLONGEST"\n",
(ulongest_t)NDeallocateTried);
printf("Number of deallocations succeeded: %"PRIuLONGEST"\n",
(ulongest_t)NDeallocateSucceeded);
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
return 0;
}

View file

@ -186,7 +186,8 @@ static void *test(void *arg, size_t s)
mps_message_finalization_ref(&objaddr, arena, message);
obj = objaddr;
objind = dylan_int_int(obj[vectorSLOT]);
printf("Finalizing: object %lu at %p\n", objind, objaddr);
printf("Finalizing: object %"PRIuLONGEST" at %p\n",
(ulongest_t)objind, objaddr);
/* <design/poolmrg/#test.promise.ut.final.check> */
cdie(root[objind] == NULL, "finalized live");
cdie(state[objind] == finalizableSTATE, "finalized dead");

View file

@ -188,7 +188,8 @@ static void *test(void *arg, size_t s)
++ final_this_time;
}
finals += final_this_time;
printf("%lu objects finalized: total %lu of %lu\n",
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
" of %"PRIuLONGEST"\n",
final_this_time, finals, object_count);
}
@ -226,7 +227,8 @@ static void *test(void *arg, size_t s)
++ final_this_time;
}
finals += final_this_time;
printf("%lu objects finalized: total %lu of %lu\n",
printf("%"PRIuLONGEST" objects finalized: total %"PRIuLONGEST
" of %"PRIuLONGEST"\n",
final_this_time, finals, object_count);
}

View file

@ -493,15 +493,15 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
break;
case 4: /* non-word */
es = (vh & 0xff) >> 3;
vb = (vh >> 16) & 0xff;
es = (unsigned)(vh & 0xff) >> 3;
vb = (unsigned)((vh >> 16) & 0xff);
vt += vb;
p += NONWORD_LENGTH(vt, es);
break;
case 5: /* stretchy non-word */
es = (vh & 0xff) >> 3;
vb = (vh >> 16) & 0xff;
es = (unsigned)(vh & 0xff) >> 3;
vb = (unsigned)((vh >> 16) & 0xff);
vt += vb;
p += NONWORD_LENGTH(vt, es) + 1;
notreached(); /* DW doesn't create them yet */
@ -678,8 +678,8 @@ static mps_addr_t dylan_skip(mps_addr_t object)
if((vf & 6) == 4) /* non-word */
{
es = (vh & 0xff) >> 3;
vb = (vh >> 16) & 0xff;
es = (unsigned)(vh & 0xff) >> 3;
vb = (unsigned)((vh >> 16) & 0xff);
vt += vb;
p += NONWORD_LENGTH(vt, es);
}

View file

@ -110,7 +110,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
static void allocMultiple(PoolStat stat)
{
mps_addr_t objects[allocsPerIteration];
int i;
size_t i;
/* allocate a few objects, and record stats for them */
for (i = 0; i < allocsPerIteration; i++) {

View file

@ -110,7 +110,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
static mps_res_t allocMultiple(PoolStat stat)
{
mps_addr_t objects[contigAllocs];
int i;
size_t i;
/* allocate a few objects, and record stats for them */
for (i = 0; i < contigAllocs; i++) {

View file

@ -30,13 +30,13 @@ extern mps_class_t PoolClassMFS(void);
/* stress -- create a pool of the requested type and allocate in it */
static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
static mps_res_t stress(mps_class_t class, size_t (*size)(size_t i),
mps_arena_t arena, ...)
{
mps_res_t res;
mps_pool_t pool;
va_list arg;
int i, k;
size_t i, k;
int *ps[testSetSIZE];
size_t ss[testSetSIZE];
@ -94,7 +94,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
/* randomSize -- produce sizes both latge and small */
static size_t randomSize(int i)
static size_t randomSize(size_t i)
{
/* Make the range large enough to span three pages in the segment table: */
/* 160 segments/page, page size max 0x2000. */
@ -106,7 +106,7 @@ static size_t randomSize(int i)
/* randomSize8 -- produce sizes both latge and small, 8-byte aligned */
static size_t randomSize8(int i)
static size_t randomSize8(size_t i)
{
size_t maxSize = 2 * 160 * 0x2000;
/* Reduce by a factor of 2 every 10 cycles. Total allocation about 40 MB. */

View file

@ -229,6 +229,21 @@
#include "spw3i3.c" /* 32-bit Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
/* Windows on 64-bit Intel with Pelles C */
#elif defined(MPS_PF_W3I6PC)
#include "lockw3.c" /* Windows locks */
#include "thw3.c" /* Windows threading */
#include "thw3i6.c" /* Windows on 64-bit Intel thread stack scan */
#include "vmw3.c" /* Windows virtual memory */
#include "protw3.c" /* Windows protection */
#include "proti6.c" /* 64-bit Intel mutator context decoding */
#include "prmci6w3.c" /* Windows on 64-bit Intel mutator context */
#include "ssw3i6pc.c" /* Windows on 64-bit stack scan for Pelles C */
#include "spw3i6.c" /* 64-bit Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
#else
#error "Unknown platform -- can't determine platform specific parts."

View file

@ -97,6 +97,27 @@
#define MPS_PF_ALIGN 8
/* PellesC version 7.00.25 with /Ze option (Microsoft compatibility mode)
* and /Tarm64-coff (Create a COFF object file for a X64 processor).
* Help node "Predefined preprocessor symbols (POCC)"
*/
#elif defined(__POCC__) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I6PC)
#error "specified CONFIG_PF_... inconsistent with detected w3i6pc"
#endif
#define MPS_PF_W3I6PC
#define MPS_PF_STRING "w3i6pc"
#define MPS_OS_W3
#define MPS_ARCH_I6
#define MPS_BUILD_PC
#define MPS_T_WORD unsigned __int64
#define MPS_T_ULONGEST unsigned __int64
#define MPS_WORD_WIDTH 64
#define MPS_WORD_SHIFT 6
#define MPS_PF_ALIGN 16
/* GCC 4.0.1 (As supplied by Apple on Mac OS X 10.4.8 on an Intel Mac),
* gcc -E -dM
* And above for xcppgc.

View file

@ -186,7 +186,7 @@ static void swap(void)
static void makerndlist(unsigned l)
{
unsigned i;
size_t i;
mps_word_t r;
mps_addr_t addr;

View file

@ -21,7 +21,7 @@
#include "mpstd.h"
#ifdef MPS_PF_W3I6MV
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
#define PRIuLONGEST "llu"
#define PRIXPTR "016llX"
typedef unsigned long long ulongest_t;

View file

@ -47,13 +47,13 @@ static mps_res_t make(mps_addr_t *p, mps_sac_t sac, size_t size)
static mps_res_t stress(mps_class_t class,
size_t classes_count, mps_sac_classes_s *classes,
size_t (*size)(int i), mps_arena_t arena, ...)
size_t (*size)(size_t i), mps_arena_t arena, ...)
{
mps_res_t res;
mps_pool_t pool;
mps_sac_t sac;
va_list arg;
int i, k;
size_t i, k;
int *ps[testSetSIZE];
size_t ss[testSetSIZE];
@ -127,7 +127,7 @@ static mps_res_t stress(mps_class_t class,
/* randomSize8 -- produce sizes both latge and small */
static size_t randomSize8(int i)
static size_t randomSize8(size_t i)
{
size_t maxSize = 2 * 160 * 0x2000;
size_t size;

View file

@ -22,7 +22,7 @@
void StackProbe(Size depth)
{
_alloca(depth*sizeof(Word));
(void)_alloca(depth*sizeof(Word));
}

143
mps/code/ssw3i6pc.c Normal file
View file

@ -0,0 +1,143 @@
/* ssw3i6pc.c: STACK SCANNING FOR WIN32 WITH PELLES C
*
* $Id$
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* This scans the stack and fixes the registers which may contain roots.
* See <design/thread-manager/>.
*
* .assume.ms-compat: We rely on the fact that Pelles C's setjmp stores
* the callee-save registers in the jmp_buf and is compatible with Microsoft
* C. The Pelles C 7.00 setjmp.h header has a comment "MS compatible". See
* also "Is Pelles C's jmp_buf compatible with Microsoft C's?"
* <http://forum.pellesc.de/index.php?topic=5464>
*
* REFERENCES
*
* "Overview of x64 Calling Conventions"; MSDN; Microsoft Corporation;
* <http://msdn.microsoft.com/en-us/library/ms235286%28v=vs.100%29.aspx>.
*
* "Caller/Callee Saved Registers"; MSDN; Microsoft Corporation;
* <http://msdn.microsoft.com/en-us/library/6t169e9c%28v=vs.100%29.aspx>.
*
* "Register Usage"; MSDN; Microsoft Corporation;
* <http://msdn.microsoft.com/en-us/library/9z1stfyw%28v=vs.100%29.aspx>.
*
* "Calling conventions for different C++ compilers and operating systems";
* Agner Fog; Copenhagen University College of Engineering; 2012-02-29;
* <http://agner.org./optimize/calling_conventions.pdf>.
*/
#include "mpm.h"
#include <setjmp.h>
SRCID(ssw3i6pc, "$Id$");
/* This definition isn't in the Pelles C headers, so we reproduce it here.
* See .assume.ms-compat. */
typedef /* _CRT_ALIGN(16) */ struct _SETJMP_FLOAT128 {
unsigned __int64 Part[2];
} SETJMP_FLOAT128;
typedef struct _JUMP_BUFFER {
unsigned __int64 Frame;
unsigned __int64 Rbx;
unsigned __int64 Rsp;
unsigned __int64 Rbp;
unsigned __int64 Rsi;
unsigned __int64 Rdi;
unsigned __int64 R12;
unsigned __int64 R13;
unsigned __int64 R14;
unsigned __int64 R15;
unsigned __int64 Rip;
unsigned __int64 Spare;
SETJMP_FLOAT128 Xmm6;
SETJMP_FLOAT128 Xmm7;
SETJMP_FLOAT128 Xmm8;
SETJMP_FLOAT128 Xmm9;
SETJMP_FLOAT128 Xmm10;
SETJMP_FLOAT128 Xmm11;
SETJMP_FLOAT128 Xmm12;
SETJMP_FLOAT128 Xmm13;
SETJMP_FLOAT128 Xmm14;
SETJMP_FLOAT128 Xmm15;
} _JUMP_BUFFER;
Res StackScan(ScanState ss, Addr *stackBot)
{
jmp_buf jb;
/* We rely on the fact that Pelles C's setjmp stores the callee-save
registers in the jmp_buf. */
(void)setjmp(jb);
/* These checks will just serve to warn us at compile-time if the
setjmp.h header changes to indicate that the registers we want aren't
saved any more. */
AVER(sizeof(((_JUMP_BUFFER *)jb)->Rdi) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->Rsi) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->Rbp) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->R12) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->R13) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->R14) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->R15) == sizeof(Addr));
/* The layout of the jmp_buf forces us to harmlessly scan Rsp as well. */
AVER(offsetof(_JUMP_BUFFER, Rsp) == offsetof(_JUMP_BUFFER, Rbx) + 8);
AVER(offsetof(_JUMP_BUFFER, Rbp) == offsetof(_JUMP_BUFFER, Rbx) + 16);
AVER(offsetof(_JUMP_BUFFER, Rsi) == offsetof(_JUMP_BUFFER, Rbx) + 24);
AVER(offsetof(_JUMP_BUFFER, Rdi) == offsetof(_JUMP_BUFFER, Rbx) + 32);
AVER(offsetof(_JUMP_BUFFER, R12) == offsetof(_JUMP_BUFFER, Rbx) + 40);
AVER(offsetof(_JUMP_BUFFER, R13) == offsetof(_JUMP_BUFFER, Rbx) + 48);
AVER(offsetof(_JUMP_BUFFER, R14) == offsetof(_JUMP_BUFFER, Rbx) + 56);
AVER(offsetof(_JUMP_BUFFER, R15) == offsetof(_JUMP_BUFFER, Rbx) + 64);
return StackScanInner(ss, stackBot, (Addr *)&((_JUMP_BUFFER *)jb)->Rbx, 9);
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* 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.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* 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, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND 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.
*/

View file

@ -420,8 +420,8 @@ static void *test(void *arg, size_t s)
printf("Collection statistics:\n");
printf(" %"PRIuLONGEST" collections\n", (ulongest_t)collections);
printf(" %"PRIuLONGEST" bytes condemned.\n", (ulongest_t)condemned);
printf(" %lu bytes not condemned.\n",
(unsigned long)not_condemned);
printf(" %"PRIuLONGEST" bytes not condemned.\n",
(ulongest_t)not_condemned);
printf(" %"PRIuLONGEST" bytes survived.\n", (ulongest_t)live);
if (condemned) {
printf(" Mortality %5.2f%%.\n",
@ -430,10 +430,10 @@ static void *test(void *arg, size_t s)
((double)condemned/(condemned + not_condemned)) * 100.0);
}
if (collections) {
printf(" Condemned per collection %lu bytes.\n",
(unsigned long)condemned/collections);
printf(" Reclaimed per collection %lu bytes.\n",
(unsigned long)(condemned - live)/collections);
printf(" Condemned per collection %"PRIuLONGEST" bytes.\n",
(ulongest_t)condemned/collections);
printf(" Reclaimed per collection %"PRIuLONGEST" bytes.\n",
(ulongest_t)(condemned - live)/collections);
}
printf("Allocation statistics:\n");

View file

@ -19,19 +19,10 @@ SRCID(teletest, "$Id$");
static mps_arena_t arena;
#define WORD_FORMAT "%" PRIwWORD PRIuLONGEST
#define MAX_ARGS 3
#define INPUT_BUFFER_SIZE 512
#if (MPS_WORD_WIDTH == 32)
#define WORD_FORMAT "0x%08lx"
#elif (MPS_WORD_WIDTH == 64)
#define WORD_FORMAT "0x%016lx"
#else
#error "Unrecognized word width"
#endif
static mps_word_t args[MAX_ARGS];
static char *stringArg;
static Count argCount;
@ -43,7 +34,8 @@ static void callControl(mps_word_t reset, mps_word_t flip)
old = mps_telemetry_control(reset, flip);
new = mps_telemetry_control((mps_word_t)0, (mps_word_t)0);
(void)printf(WORD_FORMAT " -> " WORD_FORMAT "\n", old, new);
(void)printf(WORD_FORMAT " -> " WORD_FORMAT "\n",
(ulongest_t)old, (ulongest_t)new);
}
@ -58,7 +50,7 @@ static void doRead(void)
mps_word_t old;
old = mps_telemetry_control((mps_word_t)0, (mps_word_t)0);
(void)printf(WORD_FORMAT "\n", old);
(void)printf(WORD_FORMAT "\n", (ulongest_t)old);
}
@ -85,7 +77,7 @@ static void doIntern(void)
mps_word_t id;
id = mps_telemetry_intern(stringArg);
(void)printf(WORD_FORMAT "\n", id);
(void)printf(WORD_FORMAT "\n", (ulongest_t)id);
}
static void doLabel(void)

View file

@ -101,7 +101,7 @@
#error "How many beans make five?"
#endif
#ifdef MPS_PF_W3I6MV
#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
#define PRIuLONGEST "llu"
#define SCNuLONGEST "llu"
#define SCNXLONGEST "llX"

175
mps/code/w3i6pc.nmk Normal file
View file

@ -0,0 +1,175 @@
# -*- makefile -*-
#
# w3i6pc.nmk: NMAKE FILE FOR WINDOWS/x64/PELLES C
#
# $Id: //info.ravenbrook.com/project/mps/branch/2014-03-21/pellesc/code/w3i6pc.nmk#1 $
# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
PFM = w3i6pc
# /Gs appears to be necessary to suppress stack checks. Stack checks
# (if not suppressed) generate a dependency on the C library, __chkesp,
# which causes the linker step to fail when building the DLL, mpsdy.dll.
PFMDEFS = /DCONFIG_PF_STRING="w3i6pc" /DCONFIG_PF_W3I6PC /DWIN32 /D_WINDOWS
!INCLUDE commpre.nmk
!INCLUDE pc.nmk
CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /Tamd64-coff
# MPM sources: core plus platform-specific.
MPM = $(MPMCOMMON) <proti6> <prmci6w3> <spw3i6> <ssw3i6pc> <thw3i6>
# Source to object file mappings and CFLAGS amalgamation
#
# %%VARIETY %%PART: When adding a new variety or part, add new macros which
# expand to the files included in the part for each variety
#
# %%VARIETY: When adding a new variety, add a CFLAGS macro which expands to
# the flags that that variety should use when compiling C. And a LINKFLAGS
# macro which expands to the flags that the variety should use when building
# executables. And a LIBFLAGS macro which expands to the flags that the
# variety should use when building libraries
!IF "$(VARIETY)" == "hot"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFHOT) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFHOT) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFHOT)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSHOT)
MPMOBJ0 = $(MPM:<=w3i6pc\hot\)
PLINTHOBJ0 = $(PLINTH:<=w3i6pc\hot\)
AMSOBJ0 = $(AMS:<=w3i6pc\hot\)
AMCOBJ0 = $(AMC:<=w3i6pc\hot\)
AWLOBJ0 = $(AWL:<=w3i6pc\hot\)
LOOBJ0 = $(LO:<=w3i6pc\hot\)
SNCOBJ0 = $(SNC:<=w3i6pc\hot\)
MVFFOBJ0 = $(MVFF:<=w3i6pc\hot\)
DWOBJ0 = $(DW:<=w3i6pc\hot\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\hot\)
POOLNOBJ0 = $(POOLN:<=w3i6pc\hot\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\hot\)
!ELSEIF "$(VARIETY)" == "cool"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFCOOL) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCOOL)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCOOL)
MPMOBJ0 = $(MPM:<=w3i6pc\cool\)
PLINTHOBJ0 = $(PLINTH:<=w3i6pc\cool\)
AMSOBJ0 = $(AMS:<=w3i6pc\cool\)
AMCOBJ0 = $(AMC:<=w3i6pc\cool\)
AWLOBJ0 = $(AWL:<=w3i6pc\cool\)
LOOBJ0 = $(LO:<=w3i6pc\cool\)
SNCOBJ0 = $(SNC:<=w3i6pc\cool\)
MVFFOBJ0 = $(MVFF:<=w3i6pc\cool\)
DWOBJ0 = $(DW:<=w3i6pc\cool\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\cool\)
POOLNOBJ0 = $(POOLN:<=w3i6pc\cool\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\cool\)
!ELSEIF "$(VARIETY)" == "rash"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFRASH) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFRASH)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSRASH)
MPMOBJ0 = $(MPM:<=w3i6pc\rash\)
PLINTHOBJ0 = $(PLINTH:<=w3i6pc\rash\)
AMSOBJ0 = $(AMS:<=w3i6pc\rash\)
AMCOBJ0 = $(AMC:<=w3i6pc\rash\)
AWLOBJ0 = $(AWL:<=w3i6pc\rash\)
LOOBJ0 = $(LO:<=w3i6pc\rash\)
SNCOBJ0 = $(SNC:<=w3i6pc\rash\)
MVFFOBJ0 = $(MVFF:<=w3i6pc\rash\)
DWOBJ0 = $(DW:<=w3i6pc\rash\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i6pc\rash\)
POOLNOBJ0 = $(POOLN:<=w3i6pc\rash\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\rash\)
#!ELSEIF "$(VARIETY)" == "cv"
#CFLAGS=$(CFLAGSCOMMON) $(CFCV)
#LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCV)
#LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCV)
#MPMOBJ0 = $(MPM:<=w3i6pc\cv\)
#MPMOBJ = $(MPMOBJ0:>=.obj)
#PLINTHOBJ0 = $(PLINTH:<=w3i6pc\cv\)
#PLINTHOBJ = $(PLINTHOBJ0:>=.obj)
#AMSOBJ0 = $(AMS:<=w3i6pc\cv\)
#AMSOBJ = $(AMSOBJ0:>=.obj)
#AMCOBJ0 = $(AMC:<=w3i6pc\cv\)
#AMCOBJ = $(AMCOBJ0:>=.obj)
#AWLOBJ0 = $(AWL:<=w3i6pc\cv\)
#AWLOBJ = $(AWLOBJ0:>=.obj)
#LOOBJ0 = $(LO:<=w3i6pc\cv\)
#LOOBJ = $(LOOBJ0:>=.obj)
#SNCOBJ0 = $(SNC:<=w3i6pc\cv\)
#SNCOBJ = $(SNCOBJ0:>=.obj)
#DWOBJ0 = $(DW:<=w3i6pc\cv\)
#DWOBJ = $(DWOBJ0:>=.obj)
#POOLNOBJ0 = $(POOLN:<=w3i6pc\cv\)
#POOLNOBJ = $(POOLNOBJ0:>=.obj)
#TESTLIBOBJ0 = $(TESTLIB:<=w3i6pc\cv\)
#TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj)
!ENDIF
# %%PART: When adding a new part, add new macros which expand to the object
# files included in the part
MPMOBJ = $(MPMOBJ0:>=.obj)
PLINTHOBJ = $(PLINTHOBJ0:>=.obj)
AMSOBJ = $(AMSOBJ0:>=.obj)
AMCOBJ = $(AMCOBJ0:>=.obj)
AWLOBJ = $(AWLOBJ0:>=.obj)
LOOBJ = $(LOOBJ0:>=.obj)
SNCOBJ = $(SNCOBJ0:>=.obj)
MVFFOBJ = $(MVFFOBJ0:>=.obj)
DWOBJ = $(DWOBJ0:>=.obj)
FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj)
POOLNOBJ = $(POOLNOBJ0:>=.obj)
TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj)
!INCLUDE commpost.nmk
# C. COPYRIGHT AND LICENSE
#
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
# All rights reserved. This is an open source license. Contact
# Ravenbrook for commercial licensing options.
#
# 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.
#
# 3. Redistributions in any form must be accompanied by information on how
# to obtain complete source code for this software and any accompanying
# software that uses this software. The source code must either be
# included in the distribution or be available for no more than the cost
# of distribution plus a nominal fee, and must be freely redistributable
# under reasonable conditions. For an executable file, complete source
# code means the source code for all modules it contains. It does not
# include source code for modules or files that typically accompany the
# major components of the operating system on which the executable file
# runs.
#
# 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, FITNESS FOR A PARTICULAR
# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS AND 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.

View file

@ -196,8 +196,8 @@ static void get(mps_arena_t arena)
switch(type) {
case mps_message_type_gc_start(): {
mclockBegin = mps_message_clock(arena, message);
printf(" %5lu: (%5lu)",
mclockBegin, mclockBegin - mclockEnd);
printf(" %5"PRIuLONGEST": (%5"PRIuLONGEST")",
(ulongest_t)mclockBegin, (ulongest_t)(mclockBegin - mclockEnd));
printf(" Coll Begin (%s)\n",
mps_message_gc_start_why(arena, message));
break;
@ -211,8 +211,8 @@ static void get(mps_arena_t arena)
mclockEnd = mps_message_clock(arena, message);
printf(" %5lu: (%5lu)",
mclockEnd, mclockEnd - mclockBegin);
printf(" %5"PRIuLONGEST": (%5"PRIuLONGEST")",
(ulongest_t)mclockEnd, (ulongest_t)(mclockEnd - mclockBegin));
printf(" Coll End ");
showStatsText(notcon, con, live);
if(rnd()==0) showStatsAscii(notcon, con, live, alimit);
@ -222,7 +222,8 @@ static void get(mps_arena_t arena)
mps_message_finalization_ref(&objaddr, arena, message);
obj = objaddr;
objind = DYLAN_INT_INT(DYLAN_VECTOR_SLOT(obj, 0));
printf(" Finalization for object %lu at %p\n", objind, objaddr);
printf(" Finalization for object %"PRIuLONGEST" at %p\n",
(ulongest_t)objind, objaddr);
break;
}
default: {
@ -301,7 +302,7 @@ static void CatalogCheck(void)
mps_word_t w;
void *Catalog, *Page, *Art, *Poly;
unsigned long Catalogs = 0, Pages = 0, Arts = 0, Polys = 0;
int i, j, k;
size_t i, j, k;
/* retrieve Catalog from root */
Catalog = myrootExact[CatalogRootIndex];
@ -359,7 +360,7 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
{
mps_word_t v;
void *Catalog, *Page, *Art, *Poly;
int i, j, k;
size_t i, j, k;
die(make_dylan_vector(&v, ap, CatalogFix + CatalogVar), "Catalog");
DYLAN_VECTOR_SLOT(v, 0) = DYLAN_INT(CatalogSig);
@ -381,7 +382,7 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
DYLAN_VECTOR_SLOT(Catalog, CatalogFix + i) = (mps_word_t)Page;
get(arena);
printf("Page %d: make articles\n", i);
printf("Page %"PRIuLONGEST": make articles\n", (ulongest_t)i);
(void)fflush(stdout);
for(j = 0; j < PageVar; j += 1) {
@ -531,7 +532,7 @@ static void Make(mps_arena_t arena, mps_ap_t ap, unsigned randm, unsigned keep1i
static void Rootdrop(char rank_char)
{
unsigned i;
size_t i;
if(rank_char == 'A') {
for(i = 0; i < myrootAmbigCOUNT; ++i) {
@ -550,7 +551,7 @@ static void Rootdrop(char rank_char)
#define stackwipedepth 50000
static void stackwipe(void)
{
unsigned iw;
size_t iw;
unsigned long aw[stackwipedepth];
/* Do some pointless work that the compiler won't optimise away, so that
@ -734,7 +735,7 @@ static void *testscriptB(void *arg, size_t s)
mps_fmt_t fmt;
mps_chain_t chain;
mps_pool_t amc;
int i;
size_t i;
mps_root_t root_table_Ambig;
mps_root_t root_table_Exact;
mps_ap_t ap;

View file

@ -179,7 +179,8 @@ static void report(mps_arena_t arena, const char *pm, Bool discard)
mps_message_finalization_ref(&objaddr, arena, message);
obj = objaddr;
objind = DYLAN_INT_INT(DYLAN_VECTOR_SLOT(obj, 0));
printf(" Finalization for object %lu at %p\n", objind, objaddr);
printf(" Finalization for object %"PRIuLONGEST" at %p\n",
(ulongest_t)objind, objaddr);
cdie(myroot[objind] == NULL, "finalized live");
cdie(state[objind] == finalizableSTATE, "not finalizable");
state[objind] = finalizedSTATE;
@ -308,7 +309,7 @@ static void *testscriptB(void *arg, size_t s)
mps_root_t root_table;
mps_ap_t ap;
mps_root_t root_stackreg;
int i;
size_t i;
int N = myrootCOUNT - 1;
void *stack_starts_here; /* stack scanning starts here */