diff gen/classes.cpp @ 209:c4c9b4ac021b trunk

[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
author lindquist
date Wed, 14 May 2008 01:22:40 +0200
parents 9d44ec83acd1
children 1d6cfdbc97f0
line wrap: on
line diff
--- a/gen/classes.cpp	Tue May 13 21:41:25 2008 +0200
+++ b/gen/classes.cpp	Wed May 14 01:22:40 2008 +0200
@@ -932,6 +932,19 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
+void DtoFinalizeClass(llvm::Value* inst)
+{
+    // get runtime function
+    llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_callfinalizer");
+    // build args
+    llvm::SmallVector<llvm::Value*,1> arg;
+    arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
+    // call
+    llvm::CallInst::Create(fn, arg.begin(), arg.end(), "", gIR->scopebb());
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
 DValue* DtoCastClass(DValue* val, Type* _to)
 {
     Logger::println("DtoCastClass(%s, %s)", val->getType()->toChars(), _to->toChars());