Ian Rogers wrote:
I'm having a problem with java.lang.ref.ReferenceQueue.enqueue in that it queues references onto an array during GC, and that this array may need to be grown during the GC. Generating new objects during GC is something of a gray area, in the VM I'm working with it is not allowed. An alternative is to have a field in Reference that allows references to be linked together. Should this approach be adopted for all of Harmony or just within our VM?
This is the approach taken by Harmony's DRLVM too. DRLVM doesn't use the implementation of ReferenceQueue in the classlib code [1], it has it's own implementation in the kernel classes [2].
This is (another) case where the contract between VM implementor and the class library code would need to be changed if we were to adopt the 'linked list' implementation of the queue.
[1] http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/ref/ReferenceQueue.java?view=markup [2] http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ref/ReferenceQueue.java?view=markup
Regards, Tim
