Skip to content

Instantly share code, notes, and snippets.

@ralphbean
Created April 24, 2012 23:51
Show Gist options
  • Select an option

  • Save ralphbean/2484713 to your computer and use it in GitHub Desktop.

Select an option

Save ralphbean/2484713 to your computer and use it in GitHub Desktop.
hoard review
From 22c79c413f40bbe63ef4eab9a458c4a4a17e525e Mon Sep 17 00:00:00 2001
From: Ralph Bean <[email protected]>
Date: Tue, 24 Apr 2012 20:11:35 -0400
Subject: [PATCH] NOBUILD
---
src/gnuwrapper.cpp | 2 +-
src/heaplayers/spinlock.h | 4 ++--
src/heaplayers/threadheap.h | 4 ++--
src/heaplayers/zoneheap.h | 2 +-
src/heapmanager.h | 4 ++--
src/threadpoolheap.h | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/gnuwrapper.cpp b/src/gnuwrapper.cpp
index cc8314f..f2fa398 100644
--- a/src/gnuwrapper.cpp
+++ b/src/gnuwrapper.cpp
@@ -39,7 +39,7 @@ extern "C" {
static void *(*old_realloc_hook)(void *ptr, size_t size, const void *caller);
static void *(*old_memalign_hook)(size_t alignment, size_t size, const void *caller);
- void (*__malloc_initialize_hook) (void) = my_init_hook;
+ void (* volatile __malloc_initialize_hook) (void) = my_init_hook;
static void my_init_hook (void) {
// Store the old hooks.
diff --git a/src/heaplayers/spinlock.h b/src/heaplayers/spinlock.h
index 0057c50..ed447ad 100644
--- a/src/heaplayers/spinlock.h
+++ b/src/heaplayers/spinlock.h
@@ -130,7 +130,7 @@ public:
#if !defined(__SUNPRO_CC)
- inline static volatile unsigned long MyInterlockedExchange (unsigned long *,unsigned long);
+ inline static unsigned long MyInterlockedExchange (unsigned long *,unsigned long);
#endif
private:
@@ -187,7 +187,7 @@ private:
// return retval;
#if !defined(__SUNPRO_CC) // && !defined(__APPLE__)
-inline volatile unsigned long
+inline unsigned long
HL::SpinLockType::MyInterlockedExchange (unsigned long * oldval,
unsigned long newval)
{
diff --git a/src/heaplayers/threadheap.h b/src/heaplayers/threadheap.h
index b51f05b..75caadc 100644
--- a/src/heaplayers/threadheap.h
+++ b/src/heaplayers/threadheap.h
@@ -67,7 +67,7 @@ private:
}
// Get a suitable thread id number.
- inline static volatile int getThreadId (void);
+ inline static int getThreadId (void);
PerThreadHeap ptHeaps[NumHeaps];
@@ -88,7 +88,7 @@ private:
#endif
template <int NumHeaps, class PerThreadHeap>
-inline volatile int
+inline int
HL::ThreadHeap<NumHeaps, PerThreadHeap>::getThreadId (void) {
#if defined(WIN32)
// It looks like thread id's are always multiples of 4, so...
diff --git a/src/heaplayers/zoneheap.h b/src/heaplayers/zoneheap.h
index 5612ba3..3fb6b4c 100644
--- a/src/heaplayers/zoneheap.h
+++ b/src/heaplayers/zoneheap.h
@@ -58,7 +58,7 @@ namespace HL {
private:
- inline static size_t align (int sz) {
+ inline static size_t align (size_t sz) {
return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
}
diff --git a/src/heapmanager.h b/src/heapmanager.h
index efb8940..a9a9e77 100644
--- a/src/heapmanager.h
+++ b/src/heapmanager.h
@@ -39,8 +39,8 @@ namespace Hoard {
HL::Guard<LockType> g (heapLock);
- unsigned int tid_original = HL::CPUInfo::getThreadId();
- unsigned int tid = tid_original % HeapType::MaxThreads;
+ unsigned long tid_original = HL::CPUInfo::getThreadId();
+ unsigned int tid = (unsigned int) (tid_original % HeapType::MaxThreads);
int i = 0;
while ((i < HeapType::MaxHeaps) && (HeapType::getInusemap(i)))
diff --git a/src/threadpoolheap.h b/src/threadpoolheap.h
index 0cfd7a6..1516ce1 100755
--- a/src/threadpoolheap.h
+++ b/src/threadpoolheap.h
@@ -40,7 +40,7 @@ namespace Hoard {
}
inline PerThreadHeap& getHeap (void) {
- int tid;
+ unsigned long tid;
if (anyThreadCreated) {
tid = HL::CPUInfo::getThreadId();
} else {
--
1.7.10
Name: hoard
Version: 3.8
%define tar_version 38
Release: 1%{?dist}
Summary: MALLOC
Group: System Environment/Libraries
License: GPLv2
URL: http://www.cs.umass.edu/~emery/hoard
Source0: http://www.cs.umass.edu/~emery/hoard/hoard-%{version}/source/%{name}-%{tar_version}.tar.gz
Patch1: hoard-38-NOBUILD.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{tar_version}-%{release}-XXXXXX)
BuildRequires: dos2unix
%description
Hoard is a fast, scalable, and memory-efficient allocator.
Hoard is a drop-in replacement for malloc that can dramatically improve
application performance.
%package docs
Summary: Hoard documentation
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description docs
HTML Documentation for the Hoard Malloc Library
%prep
%setup -q -n %{name}-%{tar_version}
find . -exec dos2unix {} \;
%patch1 -p1
%build
rm -fr doc/src/
dos2unix doc/*
dos2unix doc/skin/*
unix2dos doc/skin/{basic,screen,print}.css
dos2unix doc/skin/{basic,screen,print}.css
dos2unix doc/skin/images/*
dos2unix doc/heaplayers-article-cuj_files/*
find doc -type d -print0 | xargs -0 chmod 755
find doc -type f -print0 | xargs -0 chmod 644
cd src
%ifarch x86_64
make %{?_smp_mflags} CFLAGS="%{optflags}" BINDIR=%{_bindir} linux-gcc-x86-64
%else
make %{?_smp_mflags} CFLAGS="%{optflags}" BINDIR=%{_bindir} linux-gcc-x86
%endif
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}%{_libdir}/
cp -p src/libhoard.so $RPM_BUILD_ROOT/%{_libdir}/
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files docs
%doc doc/*
%files
%doc AUTHORS COPYING NEWS README THANKS
%{_libdir}/libhoard.so
%changelog
* Tue Apr 24 2012 Ralph Bean <[email protected]> - 3.8-1
- Wrapped up new version
- Fixed the upstream URL
- Updated the hoard-38-NOBUILD.patch to actually work.
Unsure why it didn't already.
- dos2unix on the whole source before applying our patch.
* Sat Dec 24 2011 Ryan H. Lewis <[email protected]> - 371-3
- added documentation. squashing rpmlint problems.
* Sun Nov 13 2011 Ryan Lewis <[email protected]> - 371-2
- squashed some warnings in rpmlint
* Sat Nov 12 2011 Ryan Lewis <[email protected]> - 3.7.1-1
- Initial spec file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment