Locating a commit from its ChangeLog entry (was Re: How to migrate ggc_alloc_XXX for GCC v8.x (git-20170816)?)

David Malcolm dmalcolm@redhat.com
Thu Aug 17 15:22:00 GMT 2017


On Thu, 2017-08-17 at 09:52 +0800, Leslie Zhai wrote:
> Hi Trevor,
> 
> Thanks for your kind response!
> 
> 
> 在 2017年08月16日 20:02, Trevor Saunders 写道:
> > On Wed, Aug 16, 2017 at 05:32:10PM +0800, Leslie Zhai wrote:
> > > Hi GCC developers,
> > > 
> > > GCC v4.6's gengtype will auto-generate Allocators for known
> > > structs and
> > > unions, for example: ggc_alloc_tree2WeakVH for tree2WeakVH https:
> > > //github.com/xiangzhai/dragonegg/blob/master/include/dragonegg/gt
> > > -cache-4.6.inc#L24
> > > 
> > > but gengtype will not auto-generate ggc_alloc_XXX for GCC v6.x or
> > > v8.x
> > > (git-20170816), for example: struct GTY((for_user)) tree2WeakVH h
> > > ttps://github.com/xiangzhai/dragonegg/blob/master/include/dragone
> > > gg/gt-cache-8.0.inc#L1284
> > > 
> > > As ChangeLog-2014 mentioned:
> > > 
> > > 2014-05-17  Trevor Saunders <tsaunders@mozilla.com>
> > > 
> > >      ...
> > >      (ggc_alloc): Install the type's destructor as the finalizer
> > > if it
> > >      might do something.
> > > 
> > > Please give me some hint about ggc_alloc migration, thanks a lot!
> > 
> > if you look at the patches they convert ggc_alloc_foo to
> > ggc_alloc<foo>
> > and you should do the same.
> 
> Thanks for your hint! I do the same :) 
> https://github.com/xiangzhai/dragonegg/blob/master/src/Cache.cpp#L255
> PS: how to find the relative patch for the ChangeLog's item? I use 
> Google, for example: (ggc_alloc): Install the type's destructor as
> the 
> finalizer if it might do something.

Another way is to use "git blame" on the ChangeLog to find the commit
that added the ChangeLog entry.

For "archived" ChangeLog files like "ChangeLog-2014" that will just
tell you which commit moved all of the entries for that years ChangeLog
entries to "ChangeLog-2014", so you can use "git log":

  git log gcc/ChangeLog-2014

to identify the commit that archived the ChangeLog:

commit e64e0023b9a6796858262f8fd38005a08d234d82
Author: green <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Jan 1 15:43:47 2015 +0000

    Roll ChangeLog file.  Limit offsets to 16 bits for moxie.


Once you have that commit you can use "^" to find the prior state of
the tree, and then use git blame:

  git blame e64e0023b9a6796858262f8fd38005a08d234d82^ gcc/ChangeLog

and then search for the text of interest:

9296020474 (tbsaunde      2014-05-17 23:15:55 +0000 38073) 2014-05-17  Trevor Saunders  <tsaunders@mozilla.com>
9296020474 (tbsaunde      2014-05-17 23:15:55 +0000 38074) 
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38075)      * ggc-common.c (ggc_internal_cleared_alloc): Adjust.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38076)      * ggc-none.c (ggc_internal_alloc): Assert if a finalizer is passed.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38077)      (ggc_internal_cleared_alloc): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38078)      * ggc-page.c (finalizer): New class.
b540cb16c9 (uros          2014-05-18 07:24:24 +0000 38079)      (vec_finalizer): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38080)      (globals::finalizers): New member.
b540cb16c9 (uros          2014-05-18 07:24:24 +0000 38081)      (globals::vec_finalizers): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38082)      (ggc_internal_alloc): Record the finalizer if any for the block bei
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38083)      allocated.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38084)      (ggc_handle_finalizers): New function.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38085)      (ggc_collect): Call ggc_handle_finalizers.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38086)      * ggc.h (ggc_internal_alloc): Add arguments to allow installing a
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38087)      finalizer.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38088)      (ggc_internal_cleared_alloc): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38089)      (finalize): New function.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38090)      (need_finalization_p): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38091)      (ggc_alloc): Install the type's destructor as the finalizer if it
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38092)      might do something.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38093)      (ggc_cleared_alloc): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38094)      (ggc_vec_alloc): Likewise.
92f06184bb (tbsaunde      2014-05-17 23:08:00 +0000 38095)      (ggc_cleared_vec_alloc): Likewise.

which identifies the commit as 92f06184bb.

"git show 92f06184bb" shows the commit you're looking for, and contains this line:

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210568 138bc75d-0d04-0410-961f-82ee72b054a4

from which you can see (if you need to) that the SVN commit was r210568.

> Dave



More information about the Gcc mailing list