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

fix: remove instrumentation of throw instruction #203

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

algomaster99
Copy link
Member

Fixes #201

The changes remove instrumentation of throw because an getLogReturn expects the return type of the method on top of the stack, however it receives a type of exception and hence it fails.

If we want to instrument throw, we need to make sure we instrument with the correct type of exception.

Bytecode

LINENUMBER 102 L1
   FRAME SAME
    NEW org/apache/commons/math3/exception/OutOfRangeException
    DUP
    DLOAD 1
    INVOKESTATIC java/lang/Double.valueOf (D)Ljava/lang/Double;
    ICONST_0
    INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;
    ICONST_1
    INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;
    INVOKESPECIAL org/apache/commons/math3/exception/OutOfRangeException.<init> (Ljava/lang/Number;Ljava/lang/Number;Ljava/lang/Number;)V
    DUP
    INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;
    LDC "inverseCumulativeProbability"
    GETSTATIC java/lang/Integer.TYPE : Ljava/lang/Class;
    LDC "org.apache.commons.math3.distribution.AbstractIntegerDistribution"
    INVOKESTATIC java/lang/Class.forName (Ljava/lang/String;)Ljava/lang/Class;
    ALOAD 54
    INVOKESTATIC io/github/chains_project/collector/util/ContextCollector.logReturn (Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Class;Ljava/util/List;)V
    ATHROW

Source Code

https://github.com/ASSERT-KTH/collector-sahab-experiments/blob/4601a1dc0f9e8b5a616019fde76291dd3f7e33d7/Math-2/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java#L101-L103

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

Successfully merging this pull request may close these issues.

Bad instrumentation in Math-2
1 participant