On Mon, 26 Oct 2020 11:37:52 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
>> Since I found it close to impossible to review the changes when I could not >> get a diff with the changes done to hsdis.c/cpp, I created a webrev which >> shows these changes. I made this by renaming hsdis.cpp back to hsdis.c, and >> then webrev could match it up. It is available here: >> >> http://cr.openjdk.java.net/~ihse/hsdis-llvm-backend-diff-webrev/ > > Some notes (perhaps most to myself) about how this ties into the existing > hsdis implementation, and with JDK-8188073 (Capstone porting). > > When printing disassembly from hotspot, the current solution tries to locate > and load the hsdis library, which prints disassembly using bfd. The reason > for using the separate library approach is, as far as I can understand, > perhaps a mix of both incompatible licensing for bfd, and a wish to not > burden the jvm library with additional bloat which is needed only for > debugging. > > The Capstone approach, in the prototype patch presented by Jorn in the issue, > is to create a new capstonedis library, and dispatch to it instead of hsdis. > > The approach used in this patch is to refactor the existing hsdis library > into an abstract base class for hsdis backends, with two concrete > implementations, one for bfd and one for llvm. > > Unfortunately, I think the resulting code in hsdis.cpp in this patch is hard > to read and understand. I think a proper solution to both this and the Capstone implementation is to provide a proper framework for selecting the hsdis backend as a first step, and refactor the existing bfd implementation as the first such backend. After that, we can add llvm and capstone as alternative hsdis backend implementations. ------------- PR: https://git.openjdk.java.net/jdk/pull/392