Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental cuckoo hash table of white segments #134

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e7b4cf8
Branching to experiment with a cuckoo hash table of white segments.
rptb1 Feb 28, 2014
324aea3
Replace fix segment lookup with existing hash table.
rptb1 Mar 1, 2014
34cc9d8
Hacky (probably incorrect) cuckoo hashing. But xc/Release/gcbench -x…
rptb1 Mar 1, 2014
43fe513
Less broken hash functions.
rptb1 Mar 1, 2014
719d4b4
Minor tidying and xref to universal hashing.
rptb1 Mar 1, 2014
6284488
Catch-up merge from master sources to branch/2014-02-28/white-cuckoo.
rptb1 Feb 27, 2016
dafb7b5
Catch-up merge from master sources to branch/2014-02-28/white-cuckoo.
rptb1 Feb 27, 2016
e5fd493
Elimintating tract->white and its maintenance.
rptb1 Feb 27, 2016
d37d75e
Implementing SegOfAddr with a splay tree of segments as a step to eli…
rptb1 Feb 27, 2016
a116447
Eliminating segment pointer from tract, and loops over tracts when cr…
rptb1 Feb 28, 2016
7eb8835
Replacing SegFirst/SegNext loops with tree traversals in condemn and …
rptb1 Feb 28, 2016
2d5a459
Replacing SegFirst/SegNext with tree traversal in ArenaExposeRemember.
rptb1 Feb 28, 2016
0ad0e2f
Catching infinite loop case in hacky cuckoo-hash insertion with an as…
rptb1 Feb 28, 2016
20ba597
Replacing SegFirst/SegNext with tree traversal in TraceStart.
rptb1 Feb 28, 2016
6a0e70b
Replacing SegFirst/SegNext with tree traversal in formatted objects w…
rptb1 Feb 28, 2016
8deecc7
Replacing SegFirst/SegNext with tree traversal in root walking. NOTE:…
rptb1 Feb 28, 2016
529de7a
Removing loop over tracts in condemn, and replacing with actual inten…
rptb1 Feb 29, 2016
a1c787b
Correcting return type of NReclaim to match changes in other pools.
rptb1 Mar 1, 2016
0e172fb
Chaining MFS extents through themselves rather than tract pointer, so…
rptb1 Mar 1, 2016
43fae98
Fixing segment split and merge to maintain segment tree, fixing asser…
rptb1 Mar 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .p4ignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ TAGS
*.dSYM
code/*/*/*.d
*.pyc
test/obj
test/test/log
test/test/obj
....gcda
....gcno
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
# $Id$
# See <http://about.travis-ci.org/docs/user/languages/c/>.
language: c
os:
- linux
- osx
compiler:
- clang
- gcc
matrix:
exclude:
- os: osx
compiler: gcc
notifications:
email:
- [email protected]
irc: "irc.freenode.net#memorypoolsystem"
script:
- ./configure --prefix=$PWD/prefix && make install && make test
26 changes: 15 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile.in -- source for autoconf Makefile
#
# $Id$
# Copyright (C) 2012-2013 Ravenbrook Limited. See end of file for license.
# Copyright (C) 2012-2014 Ravenbrook Limited. See end of file for license.
#
# YOU DON'T NEED AUTOCONF TO BUILD THE MPS
# This is just here for people who want or expect a configure script.
Expand All @@ -13,11 +13,14 @@ INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
MAKE=@MAKE@
MPS_TARGET_NAME=@MPS_TARGET_NAME@
MPS_OS_NAME=@MPS_OS_NAME@
MPS_ARCH_NAME=@MPS_ARCH_NAME@
MPS_BUILD_NAME=@MPS_BUILD_NAME@
MPS_TARGET_NAME=$(MPS_OS_NAME)$(MPS_ARCH_NAME)$(MPS_BUILD_NAME)
EXTRA_TARGETS=@EXTRA_TARGETS@
prefix=$(DESTDIR)@prefix@
TARGET_OPTS=-C code -f $(MPS_TARGET_NAME).gmk EXTRA_TARGETS="$(EXTRA_TARGETS)"
XCODEBUILD=xcodebuild -project code/mps.xcodeproj
XCODEBUILD=xcrun xcodebuild -project code/mps.xcodeproj

all: @BUILD_TARGET@

Expand All @@ -31,15 +34,15 @@ install-make-build: make-install-dirs build-via-make
$(INSTALL_DATA) code/mps*.h $(prefix)/include/
$(INSTALL_DATA) code/$(MPS_TARGET_NAME)/cool/mps.a $(prefix)/lib/libmps-debug.a
$(INSTALL_DATA) code/$(MPS_TARGET_NAME)/hot/mps.a $(prefix)/lib/libmps.a
$(INSTALL_PROGRAM) $(addprefix code/$(MPS_TARGET_NAME)/hot/Release/,$(EXTRA_TARGETS)) $(prefix)/bin
$(INSTALL_PROGRAM) $(addprefix code/$(MPS_TARGET_NAME)/hot/,$(EXTRA_TARGETS)) $(prefix)/bin

build-via-xcode:
$(XCODEBUILD) -config Release
$(XCODEBUILD) -config Debug
$(XCODEBUILD) -config Release

clean-xcode-build:
$(XCODEBUILD) -config Release clean
$(XCODEBUILD) -config Debug clean
$(XCODEBUILD) -config Release clean

install-xcode-build: make-install-dirs build-via-xcode
$(INSTALL_DATA) code/mps*.h $(prefix)/include/
Expand Down Expand Up @@ -67,12 +70,13 @@ make-install-dirs:

install: @INSTALL_TARGET@

test-make-build: @BUILD_TARGET@
$(MAKE) $(TARGET_OPTS) VARIETY=cool testrun
$(MAKE) $(TARGET_OPTS) VARIETY=hot testrun
test-make-build:
$(MAKE) $(TARGET_OPTS) testci
$(MAKE) -C code -f anan$(MPS_BUILD_NAME).gmk VARIETY=cool clean testansi
$(MAKE) -C code -f anan$(MPS_BUILD_NAME).gmk VARIETY=cool CFLAGS="-DCONFIG_POLL_NONE" clean testpollnone

test-xcode-build:
$(XCODEBUILD) -config Release -target testrun
$(XCODEBUILD) -config Debug -target testrun
$(XCODEBUILD) -config Debug -target testci
$(XCODEBUILD) -config Release -target testci

test: @TEST_TARGET@
1 change: 1 addition & 0 deletions NEWS
1 change: 0 additions & 1 deletion code/.gdbinit

This file was deleted.

4 changes: 4 additions & 0 deletions code/.p4ignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# code/.p4ignore -- Perforce files to ignore list
# $Id$
# Make output
anangc
ananll
ananmv
fri3gc
fri6gc
lii3gc
Expand All @@ -9,6 +12,7 @@ lii6ll
w3i3mv
w3i6mv
xci3gc
xci6ll
# Visual Studio junk
Debug
Release
Expand Down
71 changes: 31 additions & 40 deletions code/abq.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* abq.c: QUEUE IMPLEMENTATION
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* .purpose: A fixed-length FIFO queue.
*
Expand Down Expand Up @@ -107,7 +107,7 @@ Bool ABQPush(ABQ abq, void *element)
if (ABQIsFull(abq))
return FALSE;

mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
abq->in = ABQNextIndex(abq, abq->in);

AVERT(ABQ, abq);
Expand All @@ -126,7 +126,7 @@ Bool ABQPop(ABQ abq, void *elementReturn)
if (ABQIsEmpty(abq))
return FALSE;

mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);

abq->out = ABQNextIndex(abq, abq->out);

Expand All @@ -146,7 +146,7 @@ Bool ABQPeek(ABQ abq, void *elementReturn)
if (ABQIsEmpty(abq))
return FALSE;

mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);

/* Identical to pop, but don't increment out */

Expand All @@ -156,49 +156,40 @@ Bool ABQPeek(ABQ abq, void *elementReturn)


/* ABQDescribe -- Describe an ABQ */
Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream)
Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream, Count depth)
{
Res res;
Index index;

if (!TESTT(ABQ, abq)) return ResFAIL;
if (stream == NULL) return ResFAIL;

res = WriteF(stream,
"ABQ $P\n{\n", (WriteFP)abq,
" elements: $U \n", (WriteFU)abq->elements,
" in: $U \n", (WriteFU)abq->in,
" out: $U \n", (WriteFU)abq->out,
" queue: \n",
if (!TESTT(ABQ, abq))
return ResFAIL;
if (stream == NULL)
return ResFAIL;

res = WriteF(stream, depth,
"ABQ $P {\n", (WriteFP)abq,
" elements $U\n", (WriteFU)abq->elements,
" elementSize $W\n", (WriteFW)abq->elementSize,
" in $U\n", (WriteFU)abq->in,
" out $U\n", (WriteFU)abq->out,
" queue:\n",
NULL);
if(res != ResOK)
return res;

for (index = abq->out; index != abq->in; ) {
res = (*describeElement)(ABQElement(abq, index), stream);
res = (*describeElement)(ABQElement(abq, index), stream, depth + 2);
if(res != ResOK)
return res;
index = ABQNextIndex(abq, index);
}

res = WriteF(stream, "\n", NULL);
if(res != ResOK)
return res;
METER_WRITE(abq->push, stream, depth + 2);
METER_WRITE(abq->pop, stream, depth + 2);
METER_WRITE(abq->peek, stream, depth + 2);
METER_WRITE(abq->delete, stream, depth + 2);

res = METER_WRITE(abq->push, stream);
if(res != ResOK)
return res;
res = METER_WRITE(abq->pop, stream);
if(res != ResOK)
return res;
res = METER_WRITE(abq->peek, stream);
if(res != ResOK)
return res;
res = METER_WRITE(abq->delete, stream);
if(res != ResOK)
return res;

res = WriteF(stream, "}\n", NULL);
res = WriteF(stream, depth, "} ABQ $P\n", (WriteFP)abq, NULL);
if(res != ResOK)
return res;

Expand Down Expand Up @@ -240,13 +231,13 @@ Count ABQDepth(ABQ abq)
}


/* ABQIterate -- call 'iterate' for each element in an ABQ */
void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS)
/* ABQIterate -- call 'visitor' for each element in an ABQ */
void ABQIterate(ABQ abq, ABQVisitor visitor, void *closureP, Size closureS)
{
Index copy, index, in;

AVERT(ABQ, abq);
AVER(FUNCHECK(iterate));
AVER(FUNCHECK(visitor));

copy = abq->out;
index = abq->out;
Expand All @@ -256,12 +247,12 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
void *element = ABQElement(abq, index);
Bool delete = FALSE;
Bool cont;
cont = (*iterate)(&delete, element, closureP, closureS);
cont = (*visitor)(&delete, element, closureP, closureS);
AVERT(Bool, cont);
AVERT(Bool, delete);
if (!delete) {
if (copy != index)
mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
copy = ABQNextIndex(abq, copy);
}
index = ABQNextIndex(abq, index);
Expand All @@ -272,8 +263,8 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
/* If any elements were deleted, need to copy remainder of queue. */
if (copy != index) {
while (index != in) {
mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
abq->elementSize);
copy = ABQNextIndex(abq, copy);
index = ABQNextIndex(abq, index);
}
Expand Down Expand Up @@ -311,7 +302,7 @@ static void *ABQElement(ABQ abq, Index index) {

/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
Expand Down
12 changes: 6 additions & 6 deletions code/abq.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* abq.h: QUEUE INTERFACE
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* .purpose: A fixed-length FIFO queue.
*
Expand All @@ -23,20 +23,20 @@
/* Prototypes */

typedef struct ABQStruct *ABQ;
typedef Res (*ABQDescribeElement)(void *element, mps_lib_FILE *stream);
typedef Bool (*ABQIterateMethod)(Bool *deleteReturn, void *element, void *closureP, Size closureS);
typedef Res (*ABQDescribeElement)(void *element, mps_lib_FILE *stream, Count depth);
typedef Bool (*ABQVisitor)(Bool *deleteReturn, void *element, void *closureP, Size closureS);

extern Res ABQInit(Arena arena, ABQ abq, void *owner, Count elements, Size elementSize);
extern Bool ABQCheck(ABQ abq);
extern void ABQFinish(Arena arena, ABQ abq);
extern Bool ABQPush(ABQ abq, void *element);
extern Bool ABQPop(ABQ abq, void *elementReturn);
extern Bool ABQPeek(ABQ abq, void *elementReturn);
extern Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream);
extern Res ABQDescribe(ABQ abq, ABQDescribeElement describeElement, mps_lib_FILE *stream, Count depth);
extern Bool ABQIsEmpty(ABQ abq);
extern Bool ABQIsFull(ABQ abq);
extern Count ABQDepth(ABQ abq);
extern void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS);
extern void ABQIterate(ABQ abq, ABQVisitor visitor, void *closureP, Size closureS);


/* Types */
Expand All @@ -63,7 +63,7 @@ typedef struct ABQStruct

/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
Expand Down
Loading