Fixed the HPPA floating point problem

git-svn-id: http://picoc.googlecode.com/svn/trunk@386 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-11-07 17:47:25 +00:00
parent e077cc9d49
commit b777be13be
3 changed files with 12 additions and 8 deletions

11
heap.c
View file

@ -16,7 +16,6 @@ static unsigned char HeapMemory[HEAP_SIZE]; /* all memory - stack and he
static void *HeapBottom = &HeapMemory[HEAP_SIZE]; /* the bottom of the (downward-growing) heap */
static void *StackFrame = &HeapMemory[0]; /* the current stack frame */
void *HeapStackTop = &HeapMemory[0]; /* the top of the stack */
void *HeapMemStart = &HeapMemory[0];
#endif
static struct AllocNode *FreeListBucket[FREELIST_BUCKETS]; /* we keep a pool of freelist buckets to reduce fragmentation */
@ -39,11 +38,15 @@ void ShowBigList()
void HeapInit()
{
int Count;
int AlignOffset = 0;
StackFrame = &HeapMemory[0];
HeapStackTop = &HeapMemory[0];
while (((unsigned int)&HeapMemory[AlignOffset] & (sizeof(ALIGN_TYPE)-1)) != 0)
AlignOffset++;
StackFrame = &HeapMemory[AlignOffset];
HeapStackTop = &HeapMemory[AlignOffset];
*(void **)StackFrame = NULL;
HeapBottom = &HeapMemory[HEAP_SIZE];
HeapBottom = &HeapMemory[HEAP_SIZE-sizeof(ALIGN_TYPE)+AlignOffset];
FreeListBig = NULL;
for (Count = 0; Count < FREELIST_BUCKETS; Count++)
FreeListBucket[Count] = NULL;

View file

@ -17,7 +17,7 @@
#define min(x,y) (((x)<(y))?(x):(y))
#endif
#define MEM_ALIGN(x) (((x) + ARCH_ALIGN_WORDSIZE - 1) & ~(ARCH_ALIGN_WORDSIZE-1))
#define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE) - 1) & ~(sizeof(ALIGN_TYPE)-1))
#define GETS_BUF_MAX 256
@ -260,7 +260,6 @@ enum ParseResult { ParseResultEOF, ParseResultError, ParseResultOk };
/* globals */
extern void *HeapStackTop;
extern void *HeapMemStart;
extern struct Table GlobalTable;
extern struct StackFrame *TopStackFrame;
extern struct ValueType UberType;

View file

@ -11,8 +11,11 @@
*/
#define LARGE_INT_POWER_OF_TEN 1000000000 /* the largest power of ten which fits in an int on this architecture */
#ifdef __hppa__
#define ALIGN_TYPE double /* the data type to use for alignment */
#else
#define ALIGN_TYPE void * /* the data type to use for alignment */
#define ARCH_ALIGN_WORDSIZE sizeof(ALIGN_TYPE) /* memory alignment boundary on this architecture */
#endif
#define GLOBAL_TABLE_SIZE 97 /* global variable table */
#define STRING_TABLE_SIZE 97 /* shared string table size */
@ -50,7 +53,6 @@
# include <math.h>
# define PICOC_MATH_LIBRARY
# define NEED_MATH_LIBRARY
# undef BIG_ENDIAN
#endif
extern jmp_buf ExitBuf;