[Soot-list] java.lang.VerifyError: (class: org/apache/lucene/util/CloseableThreadLocal, method: set signature: (Ljava/lang/Object; )V) Incompatible object argument for function call

Nikhil cs16m028 at smail.iitm.ac.in
Tue May 15 01:29:31 EDT 2018


Hi,

for my work I need to replace *InterfaceInvokeExpr* with *VirtualInvokeExpr* 
using same receiver and arguments.

e.g) if Map.put(K,V) is called in program I want to change it to 
HashMap.put(K,V)

Please note that in this program Map is implemented using only HashMap.
Map<k,v> map = new HashMap<>();

The way I am trying to achieve it is like this:

if(unit instanceof InvokeStmt) 
{
    InvokeExpr ie = ((InvokeStmt) u).getInvokeExpr();
    if(ie instanceof InterfaceInvokeExpr)
    {
    SootMethod sM = Scene.v().getMethod("method signature here"); //Here I 
am getting the method successfully
    InvokeExpr vi = Jimple.v().newVirtualInvokeExpr(local,sM.makeRef(),ie.
getArgs())
    }
}



After that I replace it successfully.

But after replacing I am getting java.lang.VerifyError: (class: 
org/apache/lucene/util/CloseableThreadLocal, method: set signature: 
(Ljava/lang/Object;)V) Incompatible object argument for function call

After closely reviewing class org.apache.lucene.util.CloseableThreadLocal I 
found that the replaced VirtualInvokeExpr does not use same arguments as 
InterfaceInvokeExpr.

InterfaceInvokeExpr:

        $r1 = new java.lang.ThreadLocal;

        $r9 = r0.<org.apache.lucene.util.CloseableThreadLocal: java.util.Map 
hardRefs>;

        $r10 = staticinvoke <java.lang.Thread: java.lang.Thread 
currentThread()>();

        interfaceinvoke $r9.<java.util.Map: java.lang.Object put(java.lang.
Object,java.lang.Object)>($r10, r1);


        
VirtualInvokeExpr:

        r0 := @this: org.apache.lucene.util.CloseableThreadLocal;
        
        $r4 = r12.<org.apache.lucene.util.CloseableThreadLocal: java.util.
Map hardRefs>;

        $r5 = staticinvoke <java.lang.Thread: java.lang.Thread currentThread
()>();

        r16 = (java.util.HashMap) $r4;

        virtualinvoke r16.<java.util.HashMap: java.lang.Object put(java.lang
.Object,java.lang.Object)>($r5, r0);



Here r0 and r1 have different type I think that is why the error is 
occuring.
Any guesses why this is happening? Am I setting the arguments for the 
function call incorrectly?

Full error message for the reference:
=======================================================
TamiFlex Play-In Agent Version 2.0.3
Loaded properties from /home/nikkhil/.tamiflex/pia.properties
=======================================================
===== DaCapo 9.12-MR1 luindex starting =====
java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.dacapo.harness.Luindex.iterate(Luindex.java:66)
    at org.dacapo.harness.Benchmark.run(Benchmark.java:187)
    at org.dacapo.harness.TestHarness.runBenchmark(TestHarness.java:199)
    at org.dacapo.harness.TestHarness.main(TestHarness.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at Harness.main(Unknown Source)
Caused by: java.lang.VerifyError: (class: org/apache/lucene/util/
CloseableThreadLocal, method: set signature: (Ljava/lang/Object;)V) 
Incompatible object argument for function call
    at org.apache.lucene.analysis.Analyzer.<init>(Analyzer.java:50)
    at org.apache.lucene.analysis.standard.StandardAnalyzer.<init>(
StandardAnalyzer.java:102)
    at org.apache.lucene.analysis.standard.StandardAnalyzer.<init>(
StandardAnalyzer.java:93)
    at org.dacapo.luindex.Index.main(Index.java:64)
    ... 13 more




Thanks,
--Nikhil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180514/e9692cf5/attachment-0001.html>


More information about the Soot-list mailing list