Source location information

Gary Frost gary.frost at oracle.com
Tue Apr 2 08:45:46 UTC 2024


I prefer the former form, where we tag the op with location info

func @"f" @loc="11:5" (%0 : int, %1 : int)int -> {
    %2 : Var<int> = var %0 @"a" @loc="11:18";
    %3 : Var<int> = var %1 @"b" @loc="11:25";
     ....
};

Over the latter form

func @"f" (%0 : int, %1 : int)int -> {
    line @"11:18";
    %2 : Var<int> = var %0 @"a";
    line @"11:25";
    %3 : Var<int> = var %1 @"b";
}

As it is more obvious to me how we might handle transformations. Otherwise we need to track 'prev-sibling' nodes in the tree...

Q. though.  Don't we also need to capture the 'source file' somehow.... Can we do this from the model?

Maybe the func level @loc also includes the source ?

func @"f" @loc="SourceFile.java:11:5" (%0 : int, %1 : int)int -> {
    %2 : Var<int> = var %0 @"a" @loc="11:18";
    %3 : Var<int> = var %1 @"b" @loc="11:25";
     ....
};

________________________________
From: babylon-dev <babylon-dev-retn at openjdk.org> on behalf of Paul Sandoz <paul.sandoz at oracle.com>
Sent: Friday, March 29, 2024 8:29 PM
To: babylon-dev at openjdk.org <babylon-dev at openjdk.org>
Subject: Source location information

Hi,

Attached is a document discussing support for source location in code models. It briefly presents some possible approaches and requirements, and does not (yet) choose a specific approach and describe in more detail (because I don’t know what that should be).

Paul.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/babylon-dev/attachments/20240402/41940551/attachment-0001.htm>


More information about the babylon-dev mailing list