diff gen/runtime.cpp @ 309:d59c363fccad trunk

[svn r330] Implemented synchronized statements. Changed the tryfinally handlers to a more generalized EnclosingHandler. Changed ClassInfoS to be mutable so they can be used as locks. Added new BB after throw ala return/break etc.
author lindquist
date Sat, 28 Jun 2008 11:37:53 +0200
parents a3b7c19c866c
children 8d98e42ece93
line wrap: on
line diff
--- a/gen/runtime.cpp	Sat Jun 28 05:57:16 2008 +0200
+++ b/gen/runtime.cpp	Sat Jun 28 11:37:53 2008 +0200
@@ -852,10 +852,32 @@
         palist = palist.addAttr(2, llvm::ParamAttr::ByVal);
         llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setParamAttrs(palist);
     }
-}
 
-
+    /////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////////////////////
 
-
+    // void _d_criticalenter(D_CRITICAL_SECTION *dcs)
+    // void _d_criticalexit(D_CRITICAL_SECTION *dcs)
+    {
+        std::string fname("_d_criticalenter");
+        std::string fname2("_d_criticalexit");
+        std::vector<const LLType*> types;
+        types.push_back(rt_ptr(DtoMutexType()));
+        const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
+        llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
+        llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
+    }
 
-
+    // void _d_monitorenter(Object h)
+    // void _d_monitorexit(Object h)
+    {
+        std::string fname("_d_monitorenter");
+        std::string fname2("_d_monitorexit");
+        std::vector<const LLType*> types;
+        types.push_back(objectTy);
+        const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
+        llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
+        llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
+    }
+}