comparison 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
comparison
equal deleted inserted replaced
202:56e0c5b1d428 203:e881c9b1c738
235 235
236 ///////////////////////////////////////////////////////////////////////////////////// 236 /////////////////////////////////////////////////////////////////////////////////////
237 ///////////////////////////////////////////////////////////////////////////////////// 237 /////////////////////////////////////////////////////////////////////////////////////
238 ///////////////////////////////////////////////////////////////////////////////////// 238 /////////////////////////////////////////////////////////////////////////////////////
239 239
240 // realloc 240 // void* _d_allocmemoryT(TypeInfo ti)
241 // void* _d_realloc(void* ptr, size_t n) 241 {
242 { 242 std::string fname("_d_allocmemoryT");
243 std::string fname("_d_realloc"); 243 std::vector<const llvm::Type*> types;
244 std::vector<const llvm::Type*> types; 244 types.push_back(typeInfoTy);
245 types.push_back(voidPtrTy);
246 types.push_back(sizeTy);
247 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 245 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
248 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 246 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
249 } 247 }
250 248
251 // free 249 // void* _d_newarrayT(TypeInfo ti, size_t length)
252 // void _d_free(void* ptr) 250 // void* _d_newarrayiT(TypeInfo ti, size_t length)
253 { 251 {
254 std::string fname("_d_free"); 252 std::string fname("_d_newarrayT");
255 std::vector<const llvm::Type*> types; 253 std::string fname2("_d_newarrayiT");
256 types.push_back(voidPtrTy); 254 std::vector<const llvm::Type*> types;
257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 255 types.push_back(typeInfoTy);
258 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 256 types.push_back(sizeTy);
257 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
258 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
259 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
260 }
261
262 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
263 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata)
264 {
265 std::string fname("_d_arraysetlengthT");
266 std::string fname2("_d_arraysetlengthiT");
267 std::vector<const llvm::Type*> types;
268 types.push_back(typeInfoTy);
269 types.push_back(sizeTy);
270 types.push_back(sizeTy);
271 types.push_back(voidPtrTy);
272 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
273 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
274 new llvm::Function(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
259 } 275 }
260 276
261 // Object _d_newclass(ClassInfo ci) 277 // Object _d_newclass(ClassInfo ci)
262 { 278 {
263 std::string fname("_d_newclass"); 279 std::string fname("_d_newclass");