Skip to content

Wrong line number in IR #221

Description

@svenkeidel

📝 Overall Description

Tai-E computes the wrong line numbers for certain IR statements.

The problem occurs, for example, in Jasml (https://github.com/JavaQualitasCorpus/jasml-0.10) in method com.jasml.compiler.SourceCodeParser.parseMethod(), but the problem likely appears in other places too.

$ javap -private -verbose -cp jasml.jar com.jasml.compiler.SourceCodeParser
public class com.jasml.compiler.SourceCodeParser implements com.jasml.compiler.Scannable
  ...
  private com.jasml.classes.Method parseMethod() throws com.jasml.compiler.ParsingException, com.jasml.compiler.GrammerException;
    descriptor: ()Lcom/jasml/classes/Method;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=7, locals=7, args_size=1
        ...
        91: invokespecial #333                // Method parseMethodInstructions:(Lcom/jasml/classes/Method;)Lcom/jasml/compiler/SourceCodeParser$LabeledInstructions;
        94: astore_2
        95: new           #335                // class com/jasml/classes/Attribute_Code
        ...

      LineNumberTable:
        ...
        line 92: 91
        line 95: 94
        line 96: 95
        ...

🎯 Expected Behavior

The line for the invokespecial at PC 91 should be 92.

🐛 Current Behavior

Tai-E computes a line number of 95 for the invokespecial:

World.get().getClassHierarchy().getClass("com.jasml.compiler.SourceCodeParser").getDeclaredMethod("parseMethod").getIR().getStmts().get(30)
-> "<com.jasml.compiler.SourceCodeParser: com.jasml.classes.Method parseMethod()>[30@L95] li = invokespecial this.parseMethodInstructions(method)"

🔄 Reproducible Example

Here are the jars which I used for this example: jasml.zip

I preprocessed the jars with a tool that gives each instruction its own unique line number based on the program counter of the instruction. This way it holds that line-number = program-counter + 1. You can use this as a test to check if you got it right.

⚙️ Tai-e Arguments

Main.main("-cp", "jasml/jasml.jar", "-cp", "jasml/entrypoint.jar",
                "-m", "Entrypoint",
                "-a", "pta")

📜 Tai-e Log

[Tai-e] starts ...
Output directory: Tai-e/output
Writing options to Tai-e/output/options.yml
Writing log to Tai-e/output/tai-e.log
java.version: 17.0.20.1
java.version.date: 2026-08-18
java.runtime.version: 17.0.20.1+1
java.vendor: Eclipse Adoptium
java.vendor.version: Temurin-17.0.20.1+1
os.name: Linux
os.version: 7.0.0-30-generic
os.arch: amd64
Available CPU cores: 14
Total memory: 31002MB
Tai-e Version: 0.5.5-SNAPSHOT
Tai-e Commit: 2c925c6b3b064ec54b3f95c386c17c87d04b39b1
Writing analysis plan to Tai-e/output/tai-e-plan.yml
[WorldBuilder] starts ...

6420 classes with 66297 methods in the world
[WorldBuilder] elapsed time: 0.18s; CPU usage: start 28.66%, peak 60.37%, end 85.80%; Memory usage: start 147MB, peak 201MB, end 243MB

ℹ️ Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions