status of gcj's boehm collector?
Adam Megacz
gcj@lists.megacz.com
Wed Dec 5 11:10:00 GMT 2001
Okay, please double check my reasoning here; if this works, I may have
time to implement it (as a compile-time option) in late February.
1. For GCJ-compiled applications, enable generational/incremental GC with
a page-protecting write barrier.
2. Since all system calls will be made via natXXX.cc in libgcj, add
code to switch page protection for the target page off just before
system calls, and then switch it back on afterwards (if it was
enabled beforehand, of course).
3. On every occurrence of incremental GC,
if (numIncrementalCollections++ > THRESHHOLD) {
fullHeapScan();
numIncrementalCollections = 0;
} else {
incrementalScan();
}
4. When System.gc() is manually invoked by the application, always
perform a full heap scan (and reset numIncrementalCollections).
> It depends. Usually neither ioctl nor read will write heap pointers, and
> having them do so is likely to be dubious. If they do, the client code has
> to be careful anyway, to make sure that there were other pointers to the
> referenced objects before the data was read in, so it didn't get collected
> in the meantime.
In my specific case, this should not be a concern, since GCJ java code
does not have access to pointer values, and all data passed to read()
or write() by libgcj was provided by java code. If somebody wants to
be stupid and write CNI code that breaks this assumption, that's their
problem, not mine.
> Depending on your application, hash synchronization may also have a
> substantial effect, since it allows pointerfree objects. Currently that's
> supported only on some Linux platforms in 3.1. But it shouldn't be a major
> porting effort. It also currently doesn't apply to pointerfree classes
> implemented in Java, such as java.math.Integer, but it could.
Interesting. I'm going to start working on libgcj-mingw32 tomorrow, so
I'll add win32 support for hash synchronization to my "things to do if
I have spare time at the end" list. Probably won't happen, though.
I'm mainly interested in getting "great" performance on linux/win32
and "acceptable" performance on other platforms, which is why I'm sort
of focused on these two platforms.
- a
More information about the Java
mailing list