[llvm-commits] [compiler-rt] r172518 - in /compiler-rt/trunk/lib/sanitizer_common/tests: sanitizer_allocator64_testlib.cc sanitizer_allocator_testlib.cc

Dmitry Vyukov dvyukov at google.com
Tue Jan 15 00:04:28 PST 2013


Author: dvyukov
Date: Tue Jan 15 02:04:27 2013
New Revision: 172518

URL: http://llvm.org/viewvc/llvm-project?rev=172518&view=rev
Log:
asan: rename the file (it's not 64-bit specific anymore)

Added:
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc
      - copied, changed from r172517, compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc
Removed:
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc

Removed: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc?rev=172517&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc (removed)
@@ -1,110 +0,0 @@
-//===-- sanitizer_allocator64_testlib.cc ----------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Malloc replacement library based on CombinedAllocator.
-// The primary purpose of this file is an end-to-end integration test
-// for CombinedAllocator.
-//===----------------------------------------------------------------------===//
-/* Usage:
-clang++ -fno-exceptions  -g -fPIC -I. -I../include -Isanitizer \
- sanitizer_common/tests/sanitizer_allocator64_testlib.cc \
- sanitizer_common/sanitizer_*.cc -shared -o testmalloc.so
-LD_PRELOAD=`pwd`/testmalloc.so /your/app
-*/
-#include "sanitizer_common/sanitizer_allocator.h"
-#include "sanitizer_common/sanitizer_common.h"
-#include <stddef.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-
-namespace {
-static const uptr kAllocatorSpace = 0x600000000000ULL;
-static const uptr kAllocatorSize = 0x10000000000;  // 1T.
-
-typedef SizeClassAllocator64<kAllocatorSpace, kAllocatorSize, 0,
-  CompactSizeClassMap> PrimaryAllocator;
-typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache;
-typedef LargeMmapAllocator<> SecondaryAllocator;
-typedef CombinedAllocator<PrimaryAllocator, AllocatorCache,
-          SecondaryAllocator> Allocator;
-
-static AllocatorCache cache;
-static Allocator allocator;
-
-static int inited = 0;
-
-__attribute__((constructor))
-static void Init() {
-  if (inited) return;
-  inited = true;  // this must happen before any threads are created.
-  allocator.Init();
-}
-
-}  // namespace
-
-#if 1
-extern "C" {
-void *malloc(size_t size) {
-  Init();
-  assert(inited);
-  return allocator.Allocate(&cache, size, 8);
-}
-
-void free(void *p) {
-  if (!inited) return;
-  // assert(inited);
-  allocator.Deallocate(&cache, p);
-}
-
-void *calloc(size_t nmemb, size_t size) {
-  Init();
-  assert(inited);
-  return allocator.Allocate(&cache, nmemb * size, 8, /*cleared=*/true);
-}
-
-void *realloc(void *p, size_t new_size) {
-  Init();
-  assert(inited);
-  return allocator.Reallocate(&cache, p, new_size, 8);
-}
-
-void *memalign(size_t boundary, size_t size) {
-  Init();
-  return allocator.Allocate(&cache, size, boundary);
-}
-void *__libc_memalign(size_t boundary, size_t size) {
-  Init();
-  return allocator.Allocate(&cache, size, boundary);
-}
-
-int posix_memalign(void **memptr, size_t alignment, size_t size) {
-  Init();
-  *memptr = allocator.Allocate(&cache, size, alignment);
-  CHECK_EQ(((uptr)*memptr & (alignment - 1)), 0);
-  return 0;
-}
-
-void *valloc(size_t size) {
-  Init();
-  assert(inited);
-  return allocator.Allocate(&cache, size, GetPageSizeCached());
-}
-
-void *pvalloc(size_t size) {
-  Init();
-  assert(inited);
-  if (size == 0) size = GetPageSizeCached();
-  return allocator.Allocate(&cache, size, GetPageSizeCached());
-}
-
-void malloc_usable_size() { }
-void mallinfo() { }
-void mallopt() { }
-}
-#endif

Copied: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc (from r172517, compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc?p2=compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc&p1=compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc&r1=172517&r2=172518&rev=172518&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator64_testlib.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc Tue Jan 15 02:04:27 2013
@@ -1,4 +1,4 @@
-//===-- sanitizer_allocator64_testlib.cc ----------------------------------===//
+//===-- sanitizer_allocator_testlib.cc ------------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 /* Usage:
 clang++ -fno-exceptions  -g -fPIC -I. -I../include -Isanitizer \
- sanitizer_common/tests/sanitizer_allocator64_testlib.cc \
+ sanitizer_common/tests/sanitizer_allocator_testlib.cc \
  sanitizer_common/sanitizer_*.cc -shared -o testmalloc.so
 LD_PRELOAD=`pwd`/testmalloc.so /your/app
 */





More information about the llvm-commits mailing list