Date: Sat, 27 Dec 1997 21:14:36 -0600 (CST) From: Damon Anton Permezel <dap@damon.com> To: hsu@FreeBSD.ORG (Jeffrey Hsu) Cc: hackers@hub.freebsd.org Subject: Re: patches for JDK 1.1.5? Message-ID: <199712280314.VAA25423@damon.com> In-Reply-To: <199712280023.QAA00226@hub.freebsd.org> from Jeffrey Hsu at "Dec 27, 97 04:23:32 pm"
index | next in thread | previous in thread | raw e-mail
"Jeffrey Hsu sez: "
> > I have a 1.1.4 port
> > It works fairly well, but suffers occasionally from recursive malloc
> > calls.
>
> Copy /usr/src/lib/libc/stdlib/malloc.c and to
> src/solaris/java/runtime/malloc_md.c and modify THREAD_LOCK() and
> THREAD_UNLOCK() to call sysMonitorEnter(&_malloc_lock) and
> sysMonitorExit(&_malloc_lock).
>
My approach was to redefine malloc to enter/exit a monitor, pick up "_malloc"
out of libc, and call the original, in a manner so that I had a general
solution which could be used for other libc funcs requiring serialization:
void*
malloc(size_t size) {
void *res;
if (!libcInitialized)
initLibc();
if (monitorsInitialized) {
LIBC_LOCK(LIBC_MALLOC);
res = (*libctable[LIBC_MALLOC].addr)(size);
LIBC_UNLOCK(LIBC_MALLOC);
} else
res = (*libctable[LIBC_MALLOC].addr)(size);
return res;
}
I was unable to get this to work, due to some problems with ld.so.
I will eventually go back an spend some more time of trying to figure out
what was happening there, but with the fallback of just copying
libc/.../malloc.c into the source, as you have.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712280314.VAA25423>
