[svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .

Changed: removed the crappy realloc based dynamic memory runtime and started moving over to DMD style runtime support, part of moving to real GC.
Fixed: dynamic arrays now use GC runtime for allocating memory.
Fixed: new expression now use GC for allocating memory.
Changed: revamped the dynamic array support routines related to dynamic memory.
Fixed: assertions no longer create exsessive allocas.
Changed: misc. minor cleanups.
This commit is contained in:
Tomas Lindquist Olsen
2008-05-13 14:42:09 +02:00
parent 2912480136
commit c380f43929
15 changed files with 473 additions and 210 deletions

View File

@@ -237,25 +237,41 @@ static void LLVM_D_BuildRuntimeModule()
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
// realloc
// void* _d_realloc(void* ptr, size_t n)
// void* _d_allocmemoryT(TypeInfo ti)
{
std::string fname("_d_realloc");
std::string fname("_d_allocmemoryT");
std::vector<const llvm::Type*> types;
types.push_back(voidPtrTy);
types.push_back(sizeTy);
types.push_back(typeInfoTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// free
// void _d_free(void* ptr)
// void* _d_newarrayT(TypeInfo ti, size_t length)
// void* _d_newarrayiT(TypeInfo ti, size_t length)
{
std::string fname("_d_free");
std::string fname("_d_newarrayT");
std::string fname2("_d_newarrayiT");
std::vector<const llvm::Type*> types;
types.push_back(voidPtrTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
types.push_back(typeInfoTy);
types.push_back(sizeTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
}
// void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
// void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
{
std::string fname("_d_arraysetlengthT");
std::string fname2("_d_arraysetlengthiT");
std::vector<const llvm::Type*> types;
types.push_back(typeInfoTy);
types.push_back(sizeTy);
types.push_back(sizeTy);
types.push_back(voidPtrTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
}
// Object _d_newclass(ClassInfo ci)