Fixing interdex plugin bug
Fixing interdex plugin bug

Summary:
I didn't see this having any impact in practice, but trying to understand the code, I felt like something was wrong here.

Here's the flow that I found fishy:
- InterDex::emit_class calls gather_refs which in turn calls gather_mrefs on plugins.
- If TypeErasureInterDexPlugin::gather_mrefs finds mergable classes behind OPCODE_NEW_INSTANCE instructions,
  it would remember this in various pieces of state.
- If the class doesn't fit the dex, InterDex::flush_out_dex flushes the current dex, calling
  TypeErasureInterDexPlugin::additional_classes along the way, which erases various pieces of state, including
  m_current_mergeables.
- emit_class would proceed adding the class to a new dex. However, at this point...
  - Various pieces of state in TypeErasureInterDexPlugin got cleaned out, and TypeErasureInterDexPlugin may not actually
    later emit related mergable classes, as it lost that information.
  - TypeErasureInterDexPlugin::leftover_classes would later emit the mergable classes, but in the very last dex(es), which is probably
    not a good place.
  - The various refs still got attributed to the next dex, even though the associated classes might not get emittd into that dex (see above).

As an easy fix, I suggest to just call the side-effecting gather_(m)refs again after flushing.

Reviewed By: emma0303

Differential Revision: D13411751

fbshipit-source-id: 5a976adf3a0866f123b46e86d75f3e4739c19963

facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex