more malloc mitigation

Dimitrios Apostolou jimis@gmx.net
Sat Aug 18 19:10:00 GMT 2012


Hi,

2012-08-18  Dimitrios Apostolou  <jimis@gmx.net>

 	* gcc/tree-ssa-sccvn.c (struct vn_tables_s): Add obstack_start to
 	mark the first allocated object on the obstack.
 	(process_scc, allocate_vn_table): Use it.
 	(init_scc_vn): Don't truncate shared_lookup_references vector.
 	(prealloc_ref_ops_vec): New static vector.
 	(create_reference_ops_from_ref, create_reference_ops_from_call):
 	Use it instead of locally allocated one.
 	(free_scc_vn): Truncate vectors to 0, but keep them most 16 slots
 	long.


I'd have used a stack vector for create_reference_ops_from_{ref,call} 
instead of a static one on the heap, but the functions return heap 
vectors. Can I just cast a stack vector to a heap one?

Also is it acceptable to leak 4K  because of never freeing the whole 
obstack?

Tested on x86 with old snapshot, will post update soon after testing with 
more recent one.


Thanks,
Dimitris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sccvn.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120818/08f75065/attachment.ksh>


More information about the Gcc-patches mailing list