Removed stray DMD GC files to fix build.

They are currently unused by DMD, and are in the dmd2/root/gc directory there.
This commit is contained in:
David Nadlinger
2011-11-12 20:12:13 +01:00
parent b560e752f3
commit 9384df17ae
8 changed files with 0 additions and 2608 deletions

View File

@@ -1,43 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
#include <assert.h>
#include <stdlib.h>
#include "bits.h"
GCBits::GCBits()
{
data = NULL;
nwords = 0;
nbits = 0;
}
GCBits::~GCBits()
{
if (data)
::free(data);
data = NULL;
}
void GCBits::invariant()
{
if (data)
{
assert(nwords * sizeof(*data) * 8 >= nbits);
}
}
void GCBits::alloc(unsigned nbits)
{
this->nbits = nbits;
nwords = (nbits + (BITS_PER_WORD - 1)) >> BITS_SHIFT;
data = (unsigned *)::calloc(nwords + 2, sizeof(unsigned));
assert(data);
}

View File

@@ -1,83 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
#include <string.h>
#if __DMC__
// Inline bit operations
#include <bitops.h>
#endif
#ifdef linux
#include "gccbitops.h"
#endif
#if _MSC_VER
// Disable useless warnings about unreferenced functions
#pragma warning (disable : 4514)
#endif // _MSC_VER
#define BITS_PER_WORD 32
#define BITS_SHIFT 5
#define BITS_MASK 31
struct Mem;
struct GCBits
{
unsigned *data;
unsigned nwords; // allocated words in data[] excluding sentinals
unsigned nbits; // number of bits in data[] excluding sentinals
GCBits();
~GCBits();
void invariant();
void alloc(unsigned nbits);
#if __DMC__
unsigned test(unsigned i) { return _inline_bt(data + 1, i); }
void set(unsigned i) { _inline_bts(data + 1, i); }
void clear(unsigned i) { _inline_btr(data + 1, i); }
unsigned testClear(unsigned i) { return _inline_btr(data + 1, i); }
unsigned testSet(unsigned i) { return _inline_bts(data + 1, i); }
#elif 0 //defined linux
// for unknown reasons, GCC does badly with this
unsigned test(unsigned i) { return _inline_bt(data + 1, i); }
void set(unsigned i) { _inline_bts(data + 1, i); }
void clear(unsigned i) { _inline_btr(data + 1, i); }
unsigned testClear(unsigned i) { return _inline_btr(data + 1, i); }
unsigned testSet(unsigned i) { return _inline_bts(data + 1, i); }
#else
unsigned test(unsigned i) { return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); }
void set(unsigned i) { data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); }
void clear(unsigned i) { data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); }
unsigned testClear(unsigned i)
{
unsigned *p = &data[1 + (i >> BITS_SHIFT)];
unsigned mask = (1 << (i & BITS_MASK));
unsigned result = *p & mask;
*p &= ~mask;
return result;
}
unsigned testSet(unsigned i)
{
unsigned *p = &data[1 + (i >> BITS_SHIFT)];
unsigned mask = (1 << (i & BITS_MASK));
unsigned result = *p & mask;
*p |= mask;
return result;
}
#endif
void zero() { memset(data + 1, 0, nwords * sizeof(unsigned)); }
void copy(GCBits *f) { memcpy(data + 1, f->data + 1, nwords * sizeof(unsigned)); }
unsigned *base() { return data + 1; }
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,68 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
#ifndef GC_H
#define GC_H
struct Gcx; // private data
typedef void (*GC_FINALIZER)(void *p, void *dummy);
struct GCStats
{
unsigned poolsize; // total size of pool
unsigned usedsize; // bytes allocated
unsigned freeblocks; // number of blocks marked FREE
unsigned freelistsize; // total of memory on free lists
unsigned pageblocks; // number of blocks marked PAGE
};
struct GC
{
// For passing to debug code
static unsigned line;
static char *file;
// #define GC_LOG() ((GC::line = __LINE__), (GC::file = __FILE__))
#define GC_LOG() ((void)0)
Gcx *gcx; // implementation
~GC();
void init();
char *strdup(const char *s);
void *malloc(size_t size);
void *malloc_atomic(size_t size);
void *calloc(size_t size, size_t n);
void *realloc(void *p, size_t size);
void free(void *p);
void *mallocdup(void *o, size_t size);
void check(void *p);
void error();
void setStackBottom(void *p);
void addRoot(void *p); // add p to list of roots
void removeRoot(void *p); // remove p from list of roots
void addRange(void *pbot, void *ptop); // add range to scan for roots
void removeRange(void *pbot); // remove range
void fullcollect(); // do full garbage collection
void fullcollectNoStack(); // do full garbage collection; no scan stack
void gencollect(); // do generational garbage collection
void minimize(); // minimize physical memory usage
void setFinalizer(void *p, GC_FINALIZER pFn);
void getStats(GCStats *stats);
};
#endif

View File

@@ -1,69 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
// Bit operations for GCC and I386
#ifndef GCCBITOPS_H
#define GCCBITOPS_H 1
inline int _inline_bsf(int w)
{ int index;
__asm__ __volatile__
(
"bsfl %1, %0 \n\t"
: "=r" (index)
: "r" (w)
);
return index;
}
inline int _inline_bt(unsigned *p, int i)
{
char result;
__asm__ __volatile__
(
"btl %2,%1 \n\t"
"setc %0 \n\t"
:"=r" (result)
:"m" (*p), "r" (i)
);
return result;
}
inline int _inline_bts(unsigned *p, int i)
{
char result;
__asm__ __volatile__
(
"btsl %2,%1 \n\t"
"setc %0 \n\t"
:"=r" (result)
:"m" (*p), "r" (i)
);
return result;
}
inline int _inline_btr(unsigned *p, int i)
{
char result;
__asm__ __volatile__
(
"btrl %2,%1 \n\t"
"setc %0 \n\t"
:"=r" (result)
:"m" (*p), "r" (i)
);
return result;
}
#endif

View File

@@ -1,25 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
// Bit operations for MSC and I386
#ifndef MSCBITOPS_H
#define MSCBITOPS_H 1
inline int _inline_bsf(int w)
{ int index;
index = 0;
while (!(w & 1))
{ index++;
w >>= 1;
}
return index;
}
#endif

View File

@@ -1,25 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
// OS specific routines
void *os_mem_map(unsigned nbytes);
int os_mem_commit(void *base, unsigned offset, unsigned nbytes);
int os_mem_decommit(void *base, unsigned offset, unsigned nbytes);
int os_mem_unmap(void *base, unsigned nbytes);
// Threading
#if defined linux
#include <pthread.h>
#else
typedef long pthread_t;
pthread_t pthread_self();
#endif

View File

@@ -1,72 +0,0 @@
// Copyright (c) 2000-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
// License for redistribution is by either the Artistic License
// in artistic.txt, or the GNU General Public License in gnu.txt.
// See the included readme.txt for details.
#include <windows.h>
#include "os.h"
/***********************************
* Map memory.
*/
void *os_mem_map(unsigned nbytes)
{
return VirtualAlloc(NULL, nbytes, MEM_RESERVE, PAGE_READWRITE);
}
/***********************************
* Commit memory.
* Returns:
* 0 success
* !=0 failure
*/
int os_mem_commit(void *base, unsigned offset, unsigned nbytes)
{
void *p;
p = VirtualAlloc((char *)base + offset, nbytes, MEM_COMMIT, PAGE_READWRITE);
return (p == NULL);
}
/***********************************
* Decommit memory.
* Returns:
* 0 success
* !=0 failure
*/
int os_mem_decommit(void *base, unsigned offset, unsigned nbytes)
{
return VirtualFree((char *)base + offset, nbytes, MEM_DECOMMIT) == 0;
}
/***********************************
* Unmap memory allocated with os_mem_map().
* Memory must have already been decommitted.
* Returns:
* 0 success
* !=0 failure
*/
int os_mem_unmap(void *base, unsigned nbytes)
{
(void)nbytes;
return VirtualFree(base, 0, MEM_RELEASE) == 0;
}
/********************************************
*/
pthread_t pthread_self()
{
return (pthread_t) GetCurrentThreadId();
}