Mercurial > projects > ldc
diff gen/runtime.cpp @ 203:e881c9b1c738 trunk
[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.
author | lindquist |
---|---|
date | Tue, 13 May 2008 14:42:09 +0200 |
parents | bfcb657756f6 |
children | 9d44ec83acd1 |
line wrap: on
line diff
--- a/gen/runtime.cpp Mon May 12 23:49:07 2008 +0200 +++ b/gen/runtime.cpp Tue May 13 14:42:09 2008 +0200 @@ -237,25 +237,41 @@ ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - // 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(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(voidTy, types, false); + 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)