Alex headshot

AlBlue’s Blog

Macs, Modularity and More

EclipseCon 2016: Optimising Eclipse Plug-ins

2016, book, eclipse, eclipsecon, java, perforfmance

It doesn’t seem that long ago since I was last at EclipseCon Europe, but time has flown by – and my hair has gone even more grey 👴🏻 – someone complained that my headshot was out of date!

In any case, as with last time, I’ve managed to negotiate a discount on my newest Eclipse book – Eclipse Plug-in Development for Beginners, 2nd ed – which came out earlier this year. You can get 30% off the eBook until the end of October with CONECD30, or you can reach out to me via @alblue on Twitter if you’re interested

I’ve also got a pair of my Eclipse Plug-in books (Eclipse Plug-in Development, second edition, and Mastering Eclipse Plug-in Development) that I’m going to give away to someone randomly chosen from those who retweet this link 🐦, and will hand it out after my session on Thursday before lunchtime. I’ll tweet out the winner of the books before my session starts, and you can meet me at the Bürgersaal 2 room at 11:35 or shortly thereafter.

My session is on optimising Eclipse plug-ins; a generally useful overview for how to optimise Java programs generally, but also tailored to some of the specifics that affect Eclipse and OSGi applications. I’ll talk about how to measure Eclipse’s use with Java Flight Recorder and Memory Analyzer Toolkit, as well as touching on YourKit and Censum as well. Slides will be available on my speakerdeck profile afterwards. I’m also happy to have a discussion over lunch in more detail if anyone is interested.

JavaOne 2016: HotSpot Under the Hood

2016, assembly, hotspot, hsdis, java, javaone, openjdk, presentation

I’ve just given a presentation at JavaOne 2016, entitled “HotSpot Under the Hood”. It’s a new version of the talk I gave for the DocklandsLJC earlier on this year.

Unfortunately the talk wasn’t recorded (ony a few of the rooms appear to have any video recording in them) but the video from the above DocklandsLJC talk has just been published on InfoQ. It’s mostly the same presentation as before, but the JavaOne version was formatted to widescreen and a few additional slides were added (hopefully self sufficient).

I’ve uploaded the version of the presentation that I gave at JavaOne to my SpeakerDeck account, if you want to step through the slides individually.

Building hsdis

You don’t actually need to clone the whole OpenJDK repository in order to be able to compile hsdis; you just need to be able to grab the files from the hotspot/src/share/tools/hsdis/ directory. Specifically, you need to download:

There’s also a README file, which is useful but not necessary.

To build, you’ll also need to download binutils and expand it to a directory build/binutils.

Or, you can just copy and paste the following into an appropriate directory:

Building HSDIS
curl -O -O -O -O{hsdis.c,hsdis.h,Makefile,README}
mkdir -p build/binutils
curl | tar --strip-components=1 -C build/binutils -z -x -f -
make both || make
# make both # for dual 32-bit and 64-bit platforms
# make      # for single-type platforms

This will download all the necessary files, run the build, and you’ll be left with a number of .dylib (for macOS) and corresponding .so and .dll for other platforms.

The macOS platform can support building and using both 32-bit and 64-bit binaries on the same platform; however, Linux platforms generally can’t handle both types.

Note that if you’re building on Windows with Mingw, you’ll need to replace the AR command with ${MINGW)-ar, in the same line that changes the CC variant for ${MINGW}-gcc. Ideally this should be fixed upstream but championing a fix is non trivial.

Command Options

The command options that I used in the talk were as follows:

  • -XX:+UnlockDiagnosticVMOptions – needed for the vast number of -XX:Print* flags
  • -XX:+PrintInterpreter – dump the template interpreter table
  • -XX:+PrintCompilation – show the compilation of methods as they occur, and what level they run as
  • -XX:+PrintAssembly – dump the assembly code for methods as they are compiled
  • -XX:+/-UseCompressedOops – turn on (or off) the ability to compress OOPs on a 64 bit JVM (defaults to on for less than 32G)
  • -XX:+/-UseCompressedClassPointers – turn on (or off) the compression of class pointers (defaults to on for 64 bit platforms)
  • -XX:ObjectAlignmentInBytes=8 – align objects on 8 byte boundary. Must be multiple of 2. Can use up to 64G if set to 16 but caution/testing required.
  • -XX:+/-TieredCompilation – defaults to on for Java 8 but off for Java 7

When you’re using OpenJDK flags, it’s sometimes a benefit to add -version to the end so you don’t get the help usage. For example, if you want to see what all the flags you can use -XX:+PrintFlagsFinal -version which will dump everything you can tweak (including what flags have been detected based on your VM configuration).

Moving on

2016, eclipse, java

I’ve been working for the last decade in the finance industry in London, most recently at Credit Suisse where I was the JCP Executive Committe representative, attending meetings and voting on behalf of the firm. (You can see more information about what makes up the JCP EC; there are representatives from companies such as Azul, Eclipse, RedHat and Twitter as well as user groups such as SouJava and the London Java Community – along with big users of Java technology, such as Credit Suisse and Goldman Sachs.)

Working in finance has always been an interesting challenge, with a scale of computing resources unknown outside of a small set of cloud-scale technology companies. Furthermore time tends to be profitable which means large scale computing and/or meaty hardware, which from a technology perspective comes with its own challenges and interesting solutions. I’ve heard it said that some companies in the finance industry, if they were considered to be technology companies rather than financial houses, that they would be the biggest technology firms in the city.

The other thing that I’ve enjoyed has been writing books, speaking at conferences, and writing for InfoQ – not to mention the open source contributions that I’ve been doing over the years. Thanks to my previous employers for being understanding. It has also helped launch the Docklands.LJC, which has entered its teens and had speakers from across the globe come and talk to interested attendees from around the Wharf.

However, the time has come for me to move on, and at the end of this week I start somewhere new. It’s a well known technology company that you will have heard of, but it’s an ideal move for me and I am definitely looking forward to the challenges that lie ahead. My LinkedIn profile has me as a Director of Bandlem Ltd, which is my own company, but I need to verify what I can (and can’t) say before I say it publicly. As a result, and with the ramp up of the new role, I may be slightly quieter than usual here and on Twitter for the near future, but the good news is that I will be speaking at both JavaOne and EclipseCon later this year, as an independent speaker.

It also means that I will be handing over the reins of the Docklands.LJC to my co-founder Robert Barr, who will take over the organisation of events in the Docklands. Hopefully I’ll still be able to come over to them in the future, time permitting, so I may well see you at future events over there.

I will also be taking a sabbatical from writing at InfoQ for the time being; although my writing output has dropped (both here on the blog and at InfoQ), which I put down to having spent so long writing books. It will be an interesting exercise to see what I will do with free time in the evenings now.

I’m really looking forward to where I’m going, and I can’t wait to start.