Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHI/UNPHI Removes Objects With as Attribute #3820

Closed
volodya-lombrozo opened this issue Jan 16, 2025 · 18 comments
Closed

PHI/UNPHI Removes Objects With as Attribute #3820

volodya-lombrozo opened this issue Jan 16, 2025 · 18 comments

Comments

@volodya-lombrozo
Copy link
Member

I run the following integration test:

bytecode -> (disassemble) xmir -> phi -> unphi -> unroll -> xmir (assemble) -> bytecode.

And this test fails because phi/unphi alter the original xmir file.

Steps to reproduce:

  1. I generate App.xmir from App.class file (jeo:disassemble).
  2. Then I use eo:0.50.0:xmir-to-phi to generate App.phi (eo:xmir-to-phi).
  3. Then I run eo:0.50.0:phi-to-xmir to generate App.xmir (eo:phi-to-xmir).
  4. Then I run jeo:unroll and get exceptions about incorrect xmir (jeo:unroll`).

Actually, phi/unphi loose <o as="body-1299402125" base="jeo.seq.of3"> object. Later I see the following error:

Can't find object with attribute as='body' in ...

Expected behaviour:

App.xmir.disassemble.txt and App.xmir.unphi.txt files should be the same. In other words, phi/unphi does not
have to change the original xmir file.

Actual behaviour:

App.xmir.disassemble.txt and App.xmir.unphi.txt files are different. phi/unphi significantly changes the original xmir.

Details:

App.phi.txt
App.xmir.disassemble.txt
App.xmir.unphi.txt
App.xmir.unroll.txt

@volodya-lombrozo
Copy link
Member Author

Blocks: objectionary/jeo-maven-plugin#969

@volodya-lombrozo
Copy link
Member Author

I tried to change XMIR according with this suggestion.

@volodya-lombrozo
Copy link
Member Author

@maxonfjvipon Could you help with this issue, please?

@maxonfjvipon
Copy link
Member

@volodya-lombrozo the original XMIR is not really valid because of duality in application bindings. I created a ticket in lints, let's wait until it's implemented. Then you use the new version of linst with this check and we'll get back to this problem again.

@maxonfjvipon
Copy link
Member

@volodya-lombrozo but also there's a bug in to-phi.xsl, I'll try to fix it

maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Jan 16, 2025
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Jan 16, 2025
yegor256 added a commit that referenced this issue Jan 16, 2025
@maxonfjvipon
Copy link
Member

@yegor256 let's make a new release

@yegor256
Copy link
Member

@rultor release, tag is 0.50.1

@rultor
Copy link
Contributor

rultor commented Jan 16, 2025

@rultor release, tag is 0.50.1

@yegor256 OK, I will release it now. Please check the progress here.

@rultor
Copy link
Contributor

rultor commented Jan 16, 2025

@rultor release, tag is 0.50.1

@yegor256 Done! FYI, the full log is here (took me 11min).

@maxonfjvipon
Copy link
Member

@volodya-lombrozo please try new version, maybe it resolves your problem, but also don't forget about this

@volodya-lombrozo
Copy link
Member Author

@maxonfjvipon I'm getting the following during the unroll phase:

Caused by: java.lang.IllegalArgumentException: Path '/org/eolang/parser/add-default-package.xsl' not found in classpath

Can I simply remove add-default-package.xsl from jeo:unroll?

@volodya-lombrozo
Copy link
Member Author

volodya-lombrozo commented Jan 16, 2025

@maxonfjvipon Same about /org/eolang/parser/explicit-data.xsl'

Here is my Java code
 private static XML unroll(final XML parsed) {
        return new Xsline(
            new TrFast(
                new TrJoined<Shift>(
                    new TrClasspath<>(
                        "/org/eolang/parser/wrap-method-calls.xsl"
                    ).back(),
                    new TrDefault<>(
                        new StEndless(
                            new StClasspath(
                                "/org/eolang/parser/roll-bases.xsl"
                            )
                        )
                    ),
                    new TrClasspath<>(
                        "/org/eolang/parser/add-refs.xsl",
                        "/org/eolang/parser/add-cuts.xsl"
                    ).back(),
                    new TrDefault<Shift>(
                        new StEndless(
                            new StClasspath(
                                "/org/eolang/parser/vars-float-down.xsl"
                            )
                        )
                    ),
                    new TrClasspath<Shift>(
                        "/org/eolang/parser/remove-cuts.xsl",
//                        "/org/eolang/parser/add-default-package.xsl",
                        "/org/eolang/parser/explicit-data.xsl"
                    ).back()
                ),
                CanonicalXmir.class,
                5
            )
        ).pass(parsed);
    }

@maxonfjvipon
Copy link
Member

maxonfjvipon commented Jan 16, 2025

@volodya-lombrozo these xsls were moved to /org/eolang/parser/shake directory, please update it, but don't remove

@volodya-lombrozo
Copy link
Member Author

volodya-lombrozo commented Jan 16, 2025

@volodya-lombrozo please try new version, maybe it resolves your problem, but also don't forget about this

@maxonfjvipon Unfortunately, it didn't help (I see the same error.)

@maxonfjvipon
Copy link
Member

@volodya-lombrozo please send me your disassembled XMIR and PHI

@volodya-lombrozo
Copy link
Member Author

@maxonfjvipon
Copy link
Member

@volodya-lombrozo are you sure, you use the newest version?
I've just tried it on your disassembled XMIR and I got this phi which looks correctly:

phi.txt

@volodya-lombrozo
Copy link
Member Author

@maxonfjvipon You are absolutely right! I've just forgotten to update objectionary/eo in the test itself. My bad.

Thank you for the help and for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants