Skip to content

Commit

Permalink
2004-06-24 Frank Ch. Eigler <fche@redhat.com>
Browse files Browse the repository at this point in the history
	Adopt splay trees for object database.
	* Makefile.am: Copy splay-tree.* from libiberty.
	* Makefile.in, testsuite/Makefile.in: Regenerated.
	* mf-runtime.h.in (__mf_unregister): Add third parameter (type).
	* mf-hooks[123].c (*): Add new third parameter to mf_unregister.
	* mf-impl.h (BEGIN_PROTECT): Remove some trace text.
	* mf-runtime.c: Rewrite code dealing with object database to use
	libiberty splay trees.  Remove tree liveness aging option.
	* testsuite/libmudflap.c/fail18-frag.c: Add volatile flag.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83611 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
fche committed Jun 24, 2004
1 parent a95bd78 commit 9a1a84c
Show file tree
Hide file tree
Showing 11 changed files with 892 additions and 1,135 deletions.
12 changes: 12 additions & 0 deletions libmudflap/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2004-06-24 Frank Ch. Eigler <fche@redhat.com>

Adopt splay trees for object database.
* Makefile.am: Copy splay-tree.* from libiberty.
* Makefile.in, testsuite/Makefile.in: Regenerated.
* mf-runtime.h.in (__mf_unregister): Add third parameter (type).
* mf-hooks[123].c (*): Add new third parameter to mf_unregister.
* mf-impl.h (BEGIN_PROTECT): Remove some trace text.
* mf-runtime.c: Rewrite code dealing with object database to use
libiberty splay trees. Remove tree liveness aging option.
* testsuite/libmudflap.c/fail18-frag.c: Add volatile flag.

2004-06-15 Paolo Bonzini <bonzini@gnu.org>

* configure.ac: New name of configure.in. Update
Expand Down
13 changes: 12 additions & 1 deletion libmudflap/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,29 @@ endif
toolexeclib_LTLIBRARIES = libmudflap.la $(libmudflapth)
include_HEADERS = mf-runtime.h

# Copy this out of libiberty's source tree, so it can be built here via libtool
splay-tree.c:
rm -f $@
$(LN_S) $(srcdir)/../libiberty/splay-tree.c $@
# Copy this so that top-level include/ does not have to be put into -I path
splay-tree.h:
rm -f $@
$(LN_S) $(srcdir)/../include/splay-tree.h $@

libmudflap_la_SOURCES = \
mf-runtime.c \
mf-heuristics.c \
mf-hooks1.c \
mf-hooks2.c
mf-runtime.lo: mf-runtime.c splay-tree.c splay-tree.h
libmudflap_la_LIBADD =
libmudflap_la_DEPENDENCIES = $(libmudflap_la_LIBADD)

clean-local:
rm -f pth/*.o pth/*.lo
rm -f splay-tree.c splay-tree.h

pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h
pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h splay-tree.c splay-tree.h
$(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-runtime.c -o $@
pth/mf-heuristics.lo: mf-heuristics.c mf-runtime.h mf-impl.h
$(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-heuristics.c -o $@
Expand Down
15 changes: 13 additions & 2 deletions libmudflap/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DIST_COMMON = $(am__configure_deps) $(include_HEADERS) \
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
Expand Down Expand Up @@ -818,10 +818,21 @@ uninstall-info: uninstall-info-recursive
uninstall-info-am uninstall-toolexeclibLTLIBRARIES


# Copy this out of libiberty's source tree, so it can be built here via libtool
splay-tree.c:
rm -f $@
$(LN_S) $(srcdir)/../libiberty/splay-tree.c $@
# Copy this so that top-level include/ does not have to be put into -I path
splay-tree.h:
rm -f $@
$(LN_S) $(srcdir)/../include/splay-tree.h $@
mf-runtime.lo: mf-runtime.c splay-tree.c splay-tree.h

clean-local:
rm -f pth/*.o pth/*.lo
rm -f splay-tree.c splay-tree.h

pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h
pth/mf-runtime.lo: mf-runtime.c mf-runtime.h mf-impl.h splay-tree.c splay-tree.h
$(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-runtime.c -o $@
pth/mf-heuristics.lo: mf-heuristics.c mf-runtime.h mf-impl.h
$(LTCOMPILE) -DLIBMUDFLAPTH -c $(srcdir)/mf-heuristics.c -o $@
Expand Down
10 changes: 6 additions & 4 deletions libmudflap/mf-hooks1.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ WRAPPER(void *, realloc, void *buf, size_t c)
__mf_opts.wipe_heap = 0;

if (LIKELY(buf))
__mfu_unregister (buf, 0);
__mfu_unregister (buf, 0, __MF_TYPE_HEAP_I);
/* NB: underlying region may have been __MF_TYPE_HEAP. */

if (LIKELY(result))
{
Expand Down Expand Up @@ -250,7 +251,8 @@ WRAPPER(void, free, void *buf)
}
UNLOCKTH ();

__mf_unregister (buf, 0);
__mf_unregister (buf, 0, __MF_TYPE_HEAP_I);
/* NB: underlying region may have been __MF_TYPE_HEAP. */

if (UNLIKELY(__mf_opts.free_queue_length > 0))
{
Expand Down Expand Up @@ -378,7 +380,7 @@ WRAPPER(int , munmap, void *start, size_t length)
uintptr_t offset;

for (offset=0; offset<length; offset+=ps)
__mf_unregister ((void *) CLAMPADD (base, offset), ps);
__mf_unregister ((void *) CLAMPADD (base, offset), ps, __MF_TYPE_HEAP_I);
}
return result;
}
Expand Down Expand Up @@ -419,7 +421,7 @@ __mf_wrap_alloca_indirect (size_t c)
((uintptr_t) alloca_history->stack DEEPER_THAN (uintptr_t) stack))
{
struct alloca_tracking *next = alloca_history->next;
__mf_unregister (alloca_history->ptr, 0);
__mf_unregister (alloca_history->ptr, 0, __MF_TYPE_HEAP);
CALL_REAL (free, alloca_history->ptr);
CALL_REAL (free, alloca_history);
alloca_history = next;
Expand Down
10 changes: 5 additions & 5 deletions libmudflap/mf-hooks2.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ WRAPPER2(int, fclose, FILE *stream)
"fclose stream");
resp = fclose (stream);
#ifdef MF_REGISTER_fopen
__mf_unregister (stream, sizeof (*stream));
__mf_unregister (stream, sizeof (*stream), MF_REGISTER_fopen);
#endif

return resp;
Expand Down Expand Up @@ -1101,7 +1101,7 @@ WRAPPER2(int, closedir, DIR *dir)
TRACE ("%s\n", __PRETTY_FUNCTION__);
MF_VALIDATE_EXTENT (dir, 0, __MF_CHECK_WRITE, "closedir dir");
#ifdef MF_REGISTER_opendir
__mf_unregister (dir, MF_RESULT_SIZE_opendir);
__mf_unregister (dir, MF_RESULT_SIZE_opendir, MF_REGISTER_opendir);
#endif
return closedir (dir);
}
Expand Down Expand Up @@ -1381,7 +1381,7 @@ WRAPPER2(int, pclose, FILE *stream)
"pclose stream");
resp = pclose (stream);
#ifdef MF_REGISTER_fopen
__mf_unregister (stream, sizeof (*stream));
__mf_unregister (stream, sizeof (*stream), MF_REGISTER_fopen);
#endif
return resp;
}
Expand Down Expand Up @@ -1499,7 +1499,7 @@ WRAPPER2(int, dlclose, void *handle)
MF_VALIDATE_EXTENT (handle, 0, __MF_CHECK_READ, "dlclose handle");
resp = dlclose (handle);
#ifdef MF_REGISTER_dlopen
__mf_unregister (handle, 0);
__mf_unregister (handle, 0, MF_REGISTER_dlopen);
#endif
return resp;
}
Expand Down Expand Up @@ -1637,7 +1637,7 @@ WRAPPER2(int, shmdt, const void *shmaddr)
TRACE ("%s\n", __PRETTY_FUNCTION__);
resp = shmdt (shmaddr);
#ifdef MF_REGISTER_shmat
__mf_unregister ((void *)shmaddr, 0);
__mf_unregister ((void *)shmaddr, 0, MF_REGISTER_shmat);
#endif
return resp;
}
Expand Down
2 changes: 1 addition & 1 deletion libmudflap/mf-hooks3.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ __mf_pthread_cleanup (void *arg)
/* XXX: This unregistration is not safe on platforms where distinct
threads share errno (or at least its virtual address). */
if (pi->thread_errno != NULL)
__mf_unregister (pi->thread_errno, sizeof (int));
__mf_unregister (pi->thread_errno, sizeof (int), __MF_TYPE_GUESS);

/* XXX: Only detached threads should designate themselves as dead
here. Non-detached threads are marked dead after their
Expand Down
6 changes: 1 addition & 5 deletions libmudflap/mf-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,6 @@ ret __mfwrap_ ## fname (__VA_ARGS__)
else if (UNLIKELY (__mf_state == reentrant)) \
{ \
extern unsigned long __mf_reentrancy; \
if (UNLIKELY (__mf_opts.verbose_trace)) { \
write (2, "mf: reentrancy detected in `", 28); \
write (2, __PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__)); \
write (2, "'\n", 2); } \
__mf_reentrancy ++; \
return CALL_REAL(fname, __VA_ARGS__); \
} \
Expand All @@ -381,7 +377,7 @@ ret __mfwrap_ ## fname (__VA_ARGS__)
/* Unlocked variants of main entry points from mf-runtime.h. */
extern void __mfu_check (void *ptr, size_t sz, int type, const char *location);
extern void __mfu_register (void *ptr, size_t sz, int type, const char *name);
extern void __mfu_unregister (void *ptr, size_t sz);
extern void __mfu_unregister (void *ptr, size_t sz, int type);
extern void __mfu_report ();
extern int __mfu_set_options (const char *opts);

Expand Down
Loading

0 comments on commit 9a1a84c

Please sign in to comment.