[llvm-commits] [poolalloc] r131150 - /poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
Arushi Aggarwal
aggarwa4 at illinois.edu
Tue May 10 14:04:25 PDT 2011
Author: aggarwa4
Date: Tue May 10 16:04:25 2011
New Revision: 131150
URL: http://llvm.org/viewvc/llvm-project?rev=131150&view=rev
Log:
Updated the mapping from address to metadata address.
Fixed mmap does not seem to be working for this size,
so use a table approach.
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=131150&r1=131149&r2=131150&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c Tue May 10 16:04:25 2011
@@ -16,19 +16,22 @@
#endif /* defined(MAP_ANON) && !defined(MAP_ANONYMOUS) */
uint8_t *shadow_begin;
+uint8_t *shadow_end;
uintptr_t maskAddress(void *ptr) {
uintptr_t p = (uintptr_t)ptr;
+ uintptr_t res = (uintptr_t)ptr;
- if ((p & 0x600000000000) == 0x600000000000) {
- return (p & 0x3FFFFFFFFFFF);
- } else if ((p | 0x1FFFFFFFFFFF) == 0x1FFFFFFFFFFF) {
- return p;
+ if (p < (uintptr_t)shadow_begin) {
+ res = p;
+ } else if (p >= (uintptr_t)shadow_end) {
+ res = (p - (uintptr_t)SIZE);
} else {
fprintf(stderr, "Address out of range!\n");
fflush(stderr);
assert(0 && "MAP_FAILED");
}
+ return res;
}
/**
@@ -42,6 +45,7 @@
fflush(stderr);
assert(0 && "MAP_FAILED");
}
+ shadow_end = (uint8_t*)((uintptr_t)shadow_begin + (uintptr_t)SIZE);
}
/**
More information about the llvm-commits
mailing list