|
|
| Author |
Message |
|
| seb at erix.ericsson.se |
Posted: Tue Dec 15, 1998 9:21 am |
|
|
|
Guest
|
Hello out there!
Erlang uses tagged pointers in it's memory management. This usually
works fine, but for some architectures the top bits (which we use) in
the pointers are sometimes set (as in Irix, which some of you
noted). We are trying to write a test to dynamically figure this
out.
It would be great if you who have any other machines than we have
tried it on (see below) could compile and run the program included
below and send the output of the program, along with the output of
"uname -a", directly back to me.
We have tried it on Intel (Solaris, FreeBSD 2.2.X, Linux (red hat))
Sparc (Solaris, SunOS 4).
Thank you in advance!
-- Sebastian
----------------------------------------------------------------------
/*
** C program to find out sizes and sign of basic C data types
** also tries to find out the "magic" EXTRA_POINTER_BITS
**
*/
#include <stdio.h>
#include <stdlib.h>
#define UNSAFE_MASK 0xf0000000 /* Mask for bits that must be constant */
void extra_pointer_bits()
{
int i;
int n;
void* ptr;
unsigned long ptr_val;
ptr_val = ((unsigned long) malloc(1)) & UNSAFE_MASK;
n = 2;
/* allocate some Meg */
for (i = 1; i < 20; i++) {
ptr = (void*) malloc(n);
if ((((unsigned long) ptr) & UNSAFE_MASK) != ptr_val) {
fprintf(stderr, "POINTER HAS VARIABLE BITS IN BITS 31-28!
");
exit(1);
}
n *= 2;
}
if (ptr_val == 0)
fprintf(stdout, "#define EXTRA_POINTER_BITS 0
");
else
fprintf(stdout, "#define EXTRA_POINTER_BITS 0x%8x
", ptr_val);
}
main()
{
extra_pointer_bits();
exit(0);
}
Post generated using Mail2Forum (http://m2f.sourceforge.net) |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|