[llvm-commits] [poolalloc] r129658 - in /poolalloc/trunk: lib/AssistDS/TypeChecks.cpp runtime/DynamicTypeChecks/TypeRuntime.c
Arushi Aggarwal
aggarwa4 at illinois.edu
Sun Apr 17 07:28:46 PDT 2011
Author: aggarwa4
Date: Sun Apr 17 09:28:45 2011
New Revision: 129658
URL: http://llvm.org/viewvc/llvm-project?rev=129658&view=rev
Log:
For copying loads/stores we must have a different metadata functions.
Modified:
poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=129658&r1=129657&r2=129658&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Sun Apr 17 09:28:45 2011
@@ -220,13 +220,15 @@
bool TypeChecks::visitCopyingStoreInst(Module &M, StoreInst &SI, Value *SS) {
// Cast the pointer operand to i8* for the runtime function.
CastInst *BCI = BitCastInst::CreatePointerCast(SI.getPointerOperand(), VoidPtrTy, "", &SI);
+ CastInst *BCI_Src = BitCastInst::CreatePointerCast(SS, VoidPtrTy, "", &SI);
std::vector<Value *> Args;
Args.push_back(BCI);
- Args.push_back(ConstantInt::get(Int8Ty, UsedTypes[SS->getType()]));
+ Args.push_back(BCI_Src);
+ Args.push_back(ConstantInt::get(Int8Ty, TD->getTypeStoreSize(SS->getType())));
// Create the call to the runtime check and place it before the store instruction.
- Constant *F = M.getOrInsertFunction("trackStoreInst", VoidTy, VoidPtrTy, Int8Ty, NULL);
+ Constant *F = M.getOrInsertFunction("copyTypeInfo", VoidTy, VoidPtrTy, VoidPtrTy, Int8Ty, NULL);
CallInst::Create(F, Args.begin(), Args.end(), "", &SI);
return true;
Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c?rev=129658&r1=129657&r2=129658&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c Sun Apr 17 09:28:45 2011
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
@@ -60,8 +61,18 @@
uintptr_t p = (uintptr_t)ptr;
p &= 0xFFFFFFFF;
shadow_begin[p] = typeNumber;
-
#if DEBUG
printf("Store: %p, %p = %u\n", ptr, (void *)p, typeNumber);
#endif
}
+
+/**
+ * Copy size bits of metadata from src ptr to dest ptr.
+ */
+void copyTypeInfo(void *dstptr, void *srcptr, uint8_t size) {
+ uintptr_t d = (uintptr_t)dstptr;
+ uintptr_t s = (uintptr_t)srcptr;
+ d &= 0xFFFFFFFF;
+ s &= 0xFFFFFFFF;
+ memcpy(&shadow_begin[d], &shadow_begin[s], size);
+}
More information about the llvm-commits
mailing list