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

Bump bytecode with Deserialized literal #894

Closed
tisonkun opened this issue Jul 5, 2018 · 2 comments
Closed

Bump bytecode with Deserialized literal #894

tisonkun opened this issue Jul 5, 2018 · 2 comments

Comments

@tisonkun
Copy link
Contributor

tisonkun commented Jul 5, 2018

#!/usr/bin/env perl6

say "hello world";

If we compile the code snip above into bytecode and then bump it, in the bump info we cannot find "hello world" literal. I propose to keep this info by comment, think of how javap does

public class Main {
  public static void main(String[] args) {
    System.out.println("hello world");
  }
}
...
Constant pool:
   #1 = Methodref          #6.#15         // java/lang/Object."<init>":()V
   #2 = Fieldref           #16.#17        // java/lang/System.out:Ljava/io/PrintStream;
   #3 = String             #18            // hello world
...
@jnthn
Copy link
Member

jnthn commented Jul 5, 2018

Rakudo doesn't code-gen a string literal in Perl 6 as a MoarVM string literal, but rather as wval fetching a boxed Str object holding that string literal. The bytecode dump does dump string literals (take a look at any findmeth or const_s instruction). Note that if you were to use the Rakudo JVM backend and look at the generated bytecode, you'd not see the literal in the generated code for that Perl 6 program either, for the same reason.

Objects are held in a serialized blob. We can't deserialize it without having its dependencies available (to provide the required metadata to know how to deserialize a Str), but the --dump option is intended to work only on a single bytecode file without running anything in it.

One useful thing we could provide is a way to ask the debug server for the bytecode once the program is running, and when much more information is available.

@tisonkun
Copy link
Contributor Author

close as no longer interested in.

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

2 participants