Saving all register of Boehm's Stop-World of hypermodern i686, is it reliable?

Andrew Haley aph@redhat.com
Sat Feb 10 22:00:00 GMT 2007


J.C. writes:
 > | J.C. writes:
 > | > | J.C. writes:
 > | > | > In boehm-gc/pthread_stop_world.c from GCJ-4.3,
 > | > | > i don't see any specific information of a modern CPU like AMD Athlon64 
 > | > | > AM2 or Intel Pentium-M CoreDuo.
 > | > | > 
 | > M : i'm calling to e.g. app_quick_memcpy that it uses instructions of cache's
 > | > prefetching and XMM registers to accelerate the copy, thanks to the e.g.
 > | > AMD Athlon Optimization manual. Inside of app_quick_memcpy, it does callings
 > | > to several functions.
 > |
 > | Well, that wouldn't be enough to cause any pointers to be lost,
 > | because they'd still be set in the source location.  To actually lose
 > | live pointers you'd have to copy to XMM registers and erase the source
 > | memory block before writing the data to the destination block, thus
 > | hiding the data from the gc.
 > 
 > Just, in this instant, when there are data (e.g. pointers) in XMM
 > registers, it can't be interrupted, nothing can call to Stop-World,
 > .. but it's possible to be violated.
 
Why?  As I said, the pointers are still in the source memory block.
There is no leak.

 > There is an easy paradox's rule,
 > 
 > "if a GP register (32 bit) can contain a pointer
 > then a XMM register (128 bit) can contain upto 4 pointers"
 >
 > but   "i save to the stack the GP register and not the XMM register"   why?

Because that's where the compiler puts pointers.  If the compiler were
to start saving temporary pointers in the XMM registers, then we'd
have to change the gc.

 > Proved, the XMM register must to be saved to the stack as any GP register.

 > | There are other possible ways to hide data from the gc, such as
 > | rotating an address or XORing it by a constant.
 > 
 > Of course.

So why concentrate on this one?  It's quite possible, for example, to
convert a pointer to a floating-point number and later to convert it
back to another pointer.  It's not in any way legal C, but it's quite
possible.  Or add a constant to a pointer so that it points outside an
object and later subtract that constant.  Or -- and this is legal C --
write a pointer to a file and then later read it back.

If I had five minutes I could probably come up with a hundred ways to
hide data from the gc.  I don't see why you are so interested in this
one.

Andrew.



More information about the Java mailing list