Added GCNEW
authorstefan <none@none>
Mon, 3 Feb 2003 13:43:20 +0000 (13:43 +0000)
committerstefan <none@none>
Mon, 3 Feb 2003 13:43:20 +0000 (13:43 +0000)
src/mm/memory.c
src/mm/memory.h
toolbox/memory.c
toolbox/memory.h

index a9f486eed6a6aa0dd68a4627a3261773d0ca9bee..d2617465b4194fa8490cbf326f6241308c2985bb 100644 (file)
@@ -49,14 +49,20 @@ long int maxdumpsize = 0;
 /* #define TRACECALLARGS */
 
 #ifdef TRACECALLARGS
-static char  nomallocmem[16777216];
-static char *nomalloctop = nomallocmem + 16777216;
-static char *nomallocptr = nomallocmem;
+static char *nomallocmem;
+static char *nomalloctop;
+static char *nomallocptr;
 
 static void *lit_checked_alloc (int length)
 {
        void *m;
 
+       if (!nomallocmem) {
+               nomallocmem = malloc(16777216);
+               nomalloctop = nomallocmem + 16777216;
+               nomallocptr = nomallocmem;
+       }
+
        nomallocptr = (void*) ALIGN ((long) nomallocptr, ALIGNSIZE);
        
        m = nomallocptr;
index 10637f8edfc89907f509cc6fbcbbc54394519631..5713b817a228caa0b3be5cc5a598952b0250415d 100644 (file)
 
 #define CODEMMAP
 
+#ifdef USE_BOEHM
+/* Uncollectable memory which can contain references */
+#define GCNEW(type,num) heap_alloc_uncollectable(sizeof(type) * (num))
+#endif
+
 #define ALIGN(pos,size)       ( ( ((pos)+(size)-1) / (size))*(size) )
 #define PADDING(pos,size)     ( ALIGN((pos),(size)) - (pos) )
 #define OFFSET(s,el)          ( (int) ( (size_t) &( ((s*)0) -> el ) ) )
index a9f486eed6a6aa0dd68a4627a3261773d0ca9bee..d2617465b4194fa8490cbf326f6241308c2985bb 100644 (file)
@@ -49,14 +49,20 @@ long int maxdumpsize = 0;
 /* #define TRACECALLARGS */
 
 #ifdef TRACECALLARGS
-static char  nomallocmem[16777216];
-static char *nomalloctop = nomallocmem + 16777216;
-static char *nomallocptr = nomallocmem;
+static char *nomallocmem;
+static char *nomalloctop;
+static char *nomallocptr;
 
 static void *lit_checked_alloc (int length)
 {
        void *m;
 
+       if (!nomallocmem) {
+               nomallocmem = malloc(16777216);
+               nomalloctop = nomallocmem + 16777216;
+               nomallocptr = nomallocmem;
+       }
+
        nomallocptr = (void*) ALIGN ((long) nomallocptr, ALIGNSIZE);
        
        m = nomallocptr;
index 10637f8edfc89907f509cc6fbcbbc54394519631..5713b817a228caa0b3be5cc5a598952b0250415d 100644 (file)
 
 #define CODEMMAP
 
+#ifdef USE_BOEHM
+/* Uncollectable memory which can contain references */
+#define GCNEW(type,num) heap_alloc_uncollectable(sizeof(type) * (num))
+#endif
+
 #define ALIGN(pos,size)       ( ( ((pos)+(size)-1) / (size))*(size) )
 #define PADDING(pos,size)     ( ALIGN((pos),(size)) - (pos) )
 #define OFFSET(s,el)          ( (int) ( (size_t) &( ((s*)0) -> el ) ) )