Fix a bug freeing ProfData's ProfTransRecs
commit368d319f075c25bcedccac87f76be98bd1cfa6e8
authorGuilherme Ottoni <ottoni@fb.com>
Mon, 12 Oct 2015 23:09:31 +0000 (12 16:09 -0700)
committerhhvm-bot <hhvm-bot@fb.com>
Mon, 12 Oct 2015 23:30:41 +0000 (12 16:30 -0700)
treef3c7c1cdb061f1a36a7274eaba61bf9223c60180
parent359acecc8ac0530ca0df47925af1887ffe9fecc4
Fix a bug freeing ProfData's ProfTransRecs

Summary: These were being freed in MCGenerator::translate() as soon as the TC
filled up. However, in retranslateOpt(), translate() is initially
called to generate the DV funclets along with the prologues before the
call to regionizeFunc(), which could cause the ProfData to be cleared
before regionizeFunc().  That could crash regionizeFunc() because it
still needs the ProfTransRecs in ProfData.  This diff fixes the issue
by moving the call to ProfData::free() out of translate() and into
both retranslateOpt() and retranslate().

While here, also stop calling ProfData::freeFuncData(), which is now
unnecessary and simplifies the logic a tiny bit.

Reviewed By: @binliu19

Differential Revision: D2529878

fb-gh-sync-id: 3405b53db28c91d16e55a5ee281b2ec5d43e10f4
hphp/runtime/vm/jit/mc-generator.cpp