Skip to content

Heavily nested functions do not decompile correctly #5

@N3rdL0rd

Description

@N3rdL0rd

I was poking around the Dead Cells bytecode with the GUI and noticed that a lot of functions seemed to cut off at a certain depth, even though the opcodes still had more instructions - so I wrote a small test class:

class Nested {
    static function main() {
        var b = 512.0;
        while (b > 5) {
            b /= 2;
            if (b < 10) {
                while (b < 100) {
                    b *= 2;
                    if (b > 50) {
                        break;
                    }
                }
            }
        }
    }
}

Once decompiled, it yields the following output:

class Nested {
    static function main() {
        var b = 512;
        while ([no condition]) {
            b = b / 2;
            while ([no condition]) {
                b = b * 2;
                break;
            }
        }
    }
}

I assume the [no condition] blocks are a separate issue - but the lack of nesting beyond a certain point is far more concerning when it comes to the overall accuracy of the decompilation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions