[llvm-commits] [poolalloc] r131889 - /poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
Arushi Aggarwal
aggarwa4 at illinois.edu
Sun May 22 17:39:02 PDT 2011
Author: aggarwa4
Date: Sun May 22 19:39:02 2011
New Revision: 131889
URL: http://llvm.org/viewvc/llvm-project?rev=131889&view=rev
Log:
Add some comments.
Modified:
poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c?rev=131889&r1=131888&r2=131889&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c Sun May 22 19:39:02 2011
@@ -92,7 +92,7 @@
shadow_begin[p] = typeNumber;
memset(&shadow_begin[p + 1], 0, size - 1);
#if DEBUG
- printf("Global: %p, %p = %u | %" PRIu64 " bytes\n", ptr, (void *)p, typeNumber, size);
+ printf("Global: %p, %p = %u | %lu bytes\n", ptr, (void *)p, typeNumber, size);
#endif
}
@@ -118,7 +118,7 @@
shadow_begin[p] = typeNumber;
memset(&shadow_begin[p + 1], 0, size - 1);
#if DEBUG
- printf("Store: %p, %p = %u | %" PRIu64 " bytes | %d\n", ptr, (void *)p, typeNumber, size, tag);
+ printf("Store: %p, %p = %u | %lu bytes | %d\n", ptr, (void *)p, typeNumber, size, tag);
#endif
}
@@ -140,6 +140,12 @@
}
}
+/**
+ * Combined check for Va_arg.
+ * Check that no. of arguments is less than passed
+ * Check that the type being accessed is correct
+ * MD : pointer to array of metadata for each argument passed
+ */
void compareTypeAndNumber(uint64_t NumArgsPassed, uint64_t ArgAccessed, uint8_t TypeAccessed, void *MD, uint32_t tag) {
compareNumber(NumArgsPassed, ArgAccessed, tag);
compareTypes(TypeAccessed, ((uint8_t*)MD)[ArgAccessed], tag);
@@ -178,7 +184,7 @@
}
#if DEBUG
- printf("Load: %p, %p = actual: %u, expect: %u | %" PRIu64 " bytes\n", ptr, (void *)p, typeNumber, shadow_begin[p], size);
+ printf("Load: %p, %p = actual: %u, expect: %u | %lu bytes\n", ptr, (void *)p, typeNumber, shadow_begin[p], size);
#endif
}
@@ -189,10 +195,20 @@
void trackInitInst(void *ptr, uint64_t size, uint32_t tag) {
uintptr_t p = maskAddress(ptr);
memset(&shadow_begin[p], 0xFF, size);
+#if DEBUG
+ printf("Initialize: %p, %p | %lu bytes | %u\n", ptr, (void *)p, size, tag);
+#endif
}
+
+/**
+ * Clear the metadata for given pointer
+ */
void trackUnInitInst(void *ptr, uint64_t size, uint32_t tag) {
uintptr_t p = maskAddress(ptr);
memset(&shadow_begin[p], 0x00, size);
+#if DEBUG
+ printf("Unitialize: %p, %p | %lu bytes | %u\n", ptr, (void *)p, size, tag);
+#endif
}
/**
@@ -203,7 +219,7 @@
uintptr_t s = maskAddress(srcptr);
memcpy(&shadow_begin[d], &shadow_begin[s], size);
#if DEBUG
- printf("Copy: %p, %p = %u | %" PRIu64 " bytes | %u\n", dstptr, (void *)d, shadow_begin[s], size, tag);
+ printf("Copy: %p, %p = %u | %lu bytes | %u\n", dstptr, (void *)d, shadow_begin[s], size, tag);
#endif
}
More information about the llvm-commits
mailing list