This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Precise GC (was Re: cannot build libjava/gnu/gcj/xlib/natClip.cc)


Jeff Sturm <jeff.sturm@appnet.com> writes:

> It seems to me this is unsafe for precise marking if a collection
> can be invoked asynchronously after _Jv_RegisterPointers() and
> before p is initialized.

Note that I did say that _Jv_RegisterPointers zeros the argument.
So there is no "initialization" of p - initialization is treated
as regular assignment.

There is a possible danger if a collection happens in the middle of an
read or write operation: Even if the compiler treats the fields of p
as volatile and never caches them in a register, there is still an
instruction or two after the value has been read from the structure
but before it has been dereferenced/passed/used (and similar for
writes).

So you somehow have to prevent GC in those cases.  If you only have
one CPU, the classic solution is to inhibit thread switches except at
certain "safe points".  (Using "safe points" also makes it easier for
a compiler to generate tables for prceise collection.)

> Method arguments are not explicitly registered by this scheme
> either.  (And they could live in registers, for that matter.)

Note that the method argument x is copied to the p structure.  After
that only p.x is used, never x itself.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]