>>>>> "Jeff" == Jeff Law <jeffreya...@gmail.com> writes:

Jeff> On 4/27/2021 7:01 PM, Tom Tromey wrote:
>> This changes libcc1 to use std::vector in the code that builds
>> function types.  This avoids some explicit memory management.
>> 
>> libcc1/ChangeLog
>> 2021-04-27  Tom Tromey  <t...@tromey.com>
>> 
>> * libcp1plugin.cc (plugin_build_function_type): Use std::vector.
>> * libcc1plugin.cc (plugin_build_function_type): Use std::vector.

Jeff> Does this really work?   In general we can't stuff GC'd objects into
Jeff> something like std::vector.  Though I guess in this instance the 
Jeff> lifetime is limited and we don't have to worry about the GC system?

It's the latter.

The patch doesn't really change whether or not the elements of the array
are visible to the GC.  It just changes how the vector is managed --
from manual use of new/delete to automatic via vector.

The plugins do need to interface with the GC, but this is done by
registering GC'able objects in a global hash table that is manually
marked; see the 'preserve' and 'mark' methods on the plugin context
objects.

thanks,
Tom

Reply via email to