Skip to content

Commit

Permalink
Renamed PDUMP_PINT to POINTER_INT
Browse files Browse the repository at this point in the history
  • Loading branch information
himi committed Jan 1, 2019
1 parent 5d409e2 commit 4838213
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 35 deletions.
5 changes: 3 additions & 2 deletions nt/config.nt
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ Boston, MA 02111-1307, USA. */
#endif

#ifdef _M_X64
#include <stddef.h>
#define EMACS_INT intptr_t
#define EMACS_UINT uintptr_t
/* #define BITS_PER_EMACS_INT (sizeof(uintptr_t) * 8) */
#define BITS_PER_EMACS_INT 64
#define PDUMP_PINT intptr_t
#endif

#include <stddef.h>
#define PDUMP_POINTER intptr_t

extern char* sys_strerror();

extern int sigblock();
Expand Down
36 changes: 18 additions & 18 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5415,8 +5415,8 @@ die (msg, file, line)

#ifdef PDUMP

#ifndef PDUMP_PINT
#define PDUMP_PINT long long
#ifndef POINTER_INT
#define POINTER_INT long long
#endif

#include <stdio.h>
Expand Down Expand Up @@ -5468,7 +5468,7 @@ typedef struct pdump_header_type
typedef struct pdump_forward
{
Lisp_Object obj; /* object itself */
PDUMP_PINT offset; /* Offset from the start of hash table */
POINTER_INT offset; /* Offset from the start of hash table */
long size; /* size of object */
} pdump_forward;

Expand Down Expand Up @@ -5572,7 +5572,7 @@ static char *pdump_objects_start;
static enum pdump_object_type pdump_object_to_enum (Lisp_Object obj);
static void pdump_add_object (Lisp_Object obj);
static int pdump_open_dump_file (char *argv0, char *path);
static void pdump_relocate_objects (PDUMP_PINT offset);
static void pdump_relocate_objects (POINTER_INT offset);
#ifdef PDUMP_DEBUG
/* object validity checker */
static void pdump_check_root_objects (void);
Expand Down Expand Up @@ -5684,12 +5684,12 @@ pdump_message (char *fmt, ...)
static int
pdump_hash_value (Lisp_Object obj)
{
return ((PDUMP_PINT) obj >> 3) % PDUMP_HASH_SIZE;
return ((POINTER_INT) obj >> 3) % PDUMP_HASH_SIZE;
}

/* put given Lisp_Object to pdump_hash */
static void
pdump_put_hash (Lisp_Object obj, PDUMP_PINT offset, long size)
pdump_put_hash (Lisp_Object obj, POINTER_INT offset, long size)
{
pdump_forward *f;
int idx = pdump_hash_value (obj);
Expand Down Expand Up @@ -6106,7 +6106,7 @@ pdump_forward_object (Lisp_Object obj)
{
pdump_forward *f;
Lisp_Object new_obj;
PDUMP_PINT addr;
POINTER_INT addr;
int i;
enum pdump_object_type type;

Expand Down Expand Up @@ -6312,7 +6312,7 @@ static void
pdump_add_special_buffers ()
{
int i;
PDUMP_PINT offset;
POINTER_INT offset;
struct buffer *buffers[] = {&buffer_defaults,
&buffer_local_symbols,
NULL};
Expand Down Expand Up @@ -6734,9 +6734,9 @@ pdump_map_file (int fd, char *path)
pdump_current_load_scheme = PDUMP_MMAP;
#endif /* WINDOWSNT */

if (ret == NULL || (long) ret == -1 || ((PDUMP_PINT) ret) & ~VALMASK)
if (ret == NULL || (long) ret == -1 || ((POINTER_INT) ret) & ~VALMASK)
{
if (((PDUMP_PINT) ret) & ~VALMASK)
if (((POINTER_INT) ret) & ~VALMASK)
{
#ifdef WINDOWSNT
UnmapViewOfFile (ret);
Expand All @@ -6754,7 +6754,7 @@ pdump_map_file (int fd, char *path)
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
#endif
pdump_current_load_scheme = PDUMP_MALLOC;
if ((PDUMP_PINT)ret & ~VALMASK)
if ((POINTER_INT)ret & ~VALMASK)
{
fprintf (stderr, "emacs: malloc returned high address\n");
xfree (ret);
Expand Down Expand Up @@ -6784,8 +6784,8 @@ pdump_load (char *argv0)
int i;
int fd;
char *ret, path[PATH_MAX + 1];
PDUMP_PINT offset;
PDUMP_PINT static_offset;
POINTER_INT offset;
POINTER_INT static_offset;

/* open dump file and load header */
if ((fd = pdump_open_dump_file (argv0, path)) < 0)
Expand All @@ -6811,7 +6811,7 @@ pdump_load (char *argv0)
PDUMP_MESSAGE ((" objectspace: from %08x to %08x\n",
pdump_objects_start,
pdump_objects_start + pdump_header.objects_size));
offset = ((PDUMP_PINT) ret) - pdump_header.offset;
offset = ((POINTER_INT) ret) - pdump_header.offset;
pdump_load_offset = offset;
if (offset != 0)
PDUMP_MESSAGE ((" offset: %08x\n", pdump_load_offset));
Expand All @@ -6820,13 +6820,13 @@ pdump_load (char *argv0)
PDUMP_MESSAGE (("Loading root objects... \n"));
lseek (fd, pdump_header.objects_size + sizeof (pdump_header_type), SEEK_SET);

static_offset = ((PDUMP_PINT) &pdump_base) - ((PDUMP_PINT) pdump_header.ppdump_base);
static_offset = ((POINTER_INT) &pdump_base) - ((POINTER_INT) pdump_header.ppdump_base);
for (staticidx = 0; staticidx < pdump_header.root_objects_length; staticidx++)
{
pdump_root root;
read (fd, &root, sizeof (root));
if (offset != 0) PDUMP_RELOCATE (root.val, offset);
staticvec[staticidx] = (Lisp_Object *) (((PDUMP_PINT) root.address) + static_offset);
staticvec[staticidx] = (Lisp_Object *) (((POINTER_INT) root.address) + static_offset);
*staticvec[staticidx] = root.val;
// PDUMP_MESSAGE (("Loaded Root val (%d): %llX\n", staticidx, XPNTR(root.val)));
}
Expand Down Expand Up @@ -6896,7 +6896,7 @@ pdump_load (char *argv0)
if (offset != 0)
{
int i;
PDUMP_PINT buff_offset;
POINTER_INT buff_offset;
struct buffer *buffers[] = {&buffer_defaults,
&buffer_local_symbols,
&buffer_local_types,
Expand Down Expand Up @@ -6988,7 +6988,7 @@ pdump_free ()
}

static void
pdump_relocate_objects (PDUMP_PINT offset)
pdump_relocate_objects (POINTER_INT offset)
{
char *obj_ptr = pdump_objects_start; /* cursor */
int i;
Expand Down
8 changes: 6 additions & 2 deletions src/gmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Cambridge, MA 02139, USA.

#define _MALLOC_H 1

#ifndef POINTER_INT
#define POINTER_INT long long
#endif

#ifdef _MALLOC_INTERNAL

#ifdef HAVE_CONFIG_H
Expand Down Expand Up @@ -444,7 +448,7 @@ align (size)
__malloc_size_t size;
{
__ptr_t result;
PDUMP_PINT adj;
POINTER_INT adj;

/* align accepts an unsigned argument, but __morecore accepts a
signed one. This could lead to trouble if SIZE overflows a
Expand All @@ -454,7 +458,7 @@ align (size)
result = 0;
else
result = (*__morecore) (size);
adj = (PDUMP_PINT) ((PDUMP_PINT) ((char *) result -
adj = (POINTER_INT) ((POINTER_INT) ((char *) result -
(char *) NULL)) % BLOCKSIZE;
if (adj != 0)
{
Expand Down
8 changes: 6 additions & 2 deletions src/mem-limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ extern char etext;
/* start of data space; can be changed by calling malloc_init */
static POINTER data_space_start;

#ifndef POINTER_INT
#define POINTER_INT long long
#endif

/* Number of bytes of writable memory we can expect to be able to get */
static PDUMP_PINT lim_data;
static POINTER_INT lim_data;

#ifdef NO_LIM_DATA
static void
Expand Down Expand Up @@ -138,7 +142,7 @@ static void
get_lim_data ()
{
#ifdef MEADOW
extern PDUMP_PINT get_reserved_heap_size();
extern POINTER_INT get_reserved_heap_size();
lim_data = get_reserved_heap_size ();
#else
extern unsigned long reserved_heap_size;
Expand Down
14 changes: 9 additions & 5 deletions src/mw32mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "lisp.h"
#include "w32.h"

#ifndef POINTER_INT
#define POINTER_INT long long
#endif

int os_subtype;

HINSTANCE hinst = NULL;
Expand Down Expand Up @@ -212,7 +216,7 @@ mw32_initialize_lisp_heap ()
lisp_heap_end = end;
}

PDUMP_PINT
POINTER_INT
get_reserved_heap_size ()
{
return lisp_heap_end - lisp_heap_start;
Expand Down Expand Up @@ -242,7 +246,7 @@ void*
sbrk (long increment)
{
void *result;
PDUMP_PINT size = (PDUMP_PINT) increment;
POINTER_INT size = (POINTER_INT) increment;

result = lisp_heap_current;

Expand All @@ -253,7 +257,7 @@ sbrk (long increment)
/* If size is negative, shrink the heap by decommitting pages. */
if (size < 0)
{
PDUMP_PINT dealloc_size;
POINTER_INT dealloc_size;
unsigned char *new_current;

size = -size;
Expand All @@ -280,8 +284,8 @@ sbrk (long increment)
/* If size is positive, grow the heap by committing reserved pages. */
else if (size > 0)
{
PDUMP_PINT req_size;
PDUMP_PINT alloced_size;
POINTER_INT req_size;
POINTER_INT alloced_size;
/* Sanity checks. */
if ((lisp_heap_current + size) >= lisp_heap_end)
return NULL;
Expand Down
16 changes: 10 additions & 6 deletions src/ralloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h>
#endif

#ifndef POINTER_INT
#define POINTER_INT long long
#endif

typedef POINTER_TYPE *POINTER;
typedef size_t SIZE;

Expand Down Expand Up @@ -105,13 +109,13 @@ static int extra_bytes;
/* Macros for rounding. Note that rounding to any value is possible
by changing the definition of PAGE. */
#define PAGE (getpagesize ())
#define ALIGNED(addr) (((PDUMP_PINT) (addr) & (page_size - 1)) == 0)
#define ROUNDUP(size) (((PDUMP_PINT) (size) + page_size - 1) \
#define ALIGNED(addr) (((POINTER_INT) (addr) & (page_size - 1)) == 0)
#define ROUNDUP(size) (((POINTER_INT) (size) + page_size - 1) \
& ~(page_size - 1))
#define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))

#define MEM_ALIGN sizeof(double)
#define MEM_ROUNDUP(addr) (((PDUMP_PINT)(addr) + MEM_ALIGN - 1) \
#define MEM_ROUNDUP(addr) (((POINTER_INT)(addr) + MEM_ALIGN - 1) \
& ~(MEM_ALIGN - 1))

/* The hook `malloc' uses for the function which gets more space
Expand Down Expand Up @@ -383,7 +387,7 @@ relinquish ()
/* Return the total size in use by relocating allocator,
above where malloc gets space. */

PDUMP_PINT
POINTER_INT
r_alloc_size_in_use ()
{
return (char *) break_value - (char *) virtual_break_value;
Expand Down Expand Up @@ -796,7 +800,7 @@ free_bloc (bloc)

POINTER
r_alloc_sbrk (size)
PDUMP_PINT size;
POINTER_INT size;
{
register bloc_ptr b;
POINTER address;
Expand Down Expand Up @@ -1071,7 +1075,7 @@ r_re_alloc (ptr, size)

void
r_alloc_freeze (size)
PDUMP_PINT size;
POINTER_INT size;
{
if (! r_alloc_initialized)
r_alloc_init ();
Expand Down

0 comments on commit 4838213

Please sign in to comment.