RFR: 6819: Agent instrumentation causing stack map frame verification error

Kangcheng Xu kxu at openjdk.java.net
Wed Jun 3 16:39:06 UTC 2020


This pr fixes [JMC-6819: Agent instrumentation causing stack map frame verification
error](https://bugs.openjdk.java.net/browse/JMC-6819).

The issue is reproducible when the target function consists of multiple exit points, and a compressed stack map frame
describing a jump target, followed by a function exit (eg. `*return` instructions). A simple example could be something
like(, given `javac` writes a compressed frame instead of a new expanded frame):  public int echo(int arg) {
    if (arg > 42) {
        return 42;
    }
    return arg;
}

When fixing [JMC-6532: Instrumentation fails for methods containing try-catch
clauses](https://bugs.openjdk.java.net/browse/JMC-6532), compressed frames were [forcefully
expanded](https://github.com/thegreystone/jmc-old/commit/e4acc9c93bfb21317caeead2d7646c7677c7a4a6#diff-af337d6e5f3fd3b585e66e0cebcb056fR132),
but the method was faulty. It turns out the ASM lib supports expanding frames automatically, which this pr adopts.

This pr comes with test cases generating bytecode for the example above. The generation is done by ASM lib manually to
make sure various compressed frame types (`same_frame`, `chop_frame`, `append_frame`) are tested.

-------------

Commit messages:
 - Handles compressed frames correctly

Changes: https://git.openjdk.java.net/jmc/pull/79/files
 Webrev: https://webrevs.openjdk.java.net/jmc/79/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JMC-6819
  Stats: 172 lines in 5 files changed: 158 ins; 12 del; 2 mod
  Patch: https://git.openjdk.java.net/jmc/pull/79.diff
  Fetch: git fetch https://git.openjdk.java.net/jmc pull/79/head:pull/79

PR: https://git.openjdk.java.net/jmc/pull/79


More information about the jmc-dev mailing list