Skip to content

decompiling lambdas fails due to missing local variable declarations #10

@jurgenvinju

Description

@jurgenvinju

This is a disassembled lambda where you can see that there are no LOCALVARIABLE instructions for stack location 0 and 1. This stops their LOAD instructions from being decompiled and that blocks further decompilation steps downstream.

My guess is that the creating scope is captured by the 0 and 1 stack locations in lambda's, and so we need to add rules for recovering expressions for these LOADs somehow.

methodDesc(
      void(),
      "lambda$11",
      [
        object("java.lang.Object"),
        object("java.lang.Object"),
        object("io.usethesource.vallang.IConstructor"),
        object("java.lang.Integer")
      ]),
    [
      var(
        object("java.lang.Object"),
        "arg_0"),
      var(
        object("java.lang.Object"),
        "arg_0"),
      var(
        object("io.usethesource.vallang.IConstructor"),
        "arg_0"),
      var(
        object("java.lang.Integer"),
        "arg_0")
    ],
    [asm([
          LABEL("L20804602"),
          LINENUMBER(589,"L20804602"),
          ALOAD(0),
          ALOAD(3),
          INVOKEVIRTUAL(
            object("java.lang.Integer"),
            methodDesc(
              integer(),
              "intValue",
              []),
            false),
          ALOAD(1),
          INVOKESTATIC(
            object("java.lang.reflect.Array"),
            methodDesc(
              void(),
              "set",
              [
                object("java.lang.Object"),
                integer(),
                object("java.lang.Object")
              ]),
            false),
          RETURN(),
          LABEL("L1344519051"),
          LOCALVARIABLE(
            "S",
            object("io.usethesource.vallang.IConstructor"),
            "L20804602",
            "L1344519051",
            2),
          LOCALVARIABLE(
            "ind",
            object("java.lang.Integer"),
            "L20804602",
            "L1344519051",
            3)
        ])])

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions