microbat icon indicating copy to clipboard operation
microbat copied to clipboard

[Instrumentation] Branch target offset too large for short

Open llmhyy opened this issue 6 years ago • 1 comments

Hi Lyly,

May I ask why the following exception happens during instrumentation? Thanks!

***working on the 15th bug of Chart project.
analyzing the 15th bug in Chart project.
#####working on test case org.jfree.chart.plot.junit.PiePlot3DTests#testDrawWithNullDataset
precheck..
Precheck dumpfile: C:\Users\linyun\AppData\Local\Temp\tracePrecheck7082283915265644779.info
E:\linyun\bug_repo\jdk1.7.0_800\bin\java -Xmx30g -XX:+UseG1GC -ea -noverify -javaagent:E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\instrumentator.jar=precheck=true,excludes=java.util.Properties*,java_home=E:\linyun\bug_repo\jdk1.7.0_800,stepLimit=1000000,log=printProgress;error,require_method_split=false,working_dir=E:\linyun\bug_repo\Chart\15\bug,varLayer=1,launch_class=org.jfree.chart.plot.junit.PiePlot3DTests,class_path=E:\linyun\bug_repo\Chart\15\bug\build-tests;E:\linyun\bug_repo\Chart\15\bug\build;E:\linyun\bug_repo\Chart\15\bug\lib\itext-2.0.6.jar;E:\linyun\bug_repo\Chart\15\bug\lib\junit.jar;E:\linyun\bug_repo\Chart\15\bug\lib\servlet.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\junit.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\org.hamcrest.core.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\testrunner.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\bcel-6.0.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\javassist.jar,dump_file_path=C:\Users\linyun\AppData\Local\Temp\tracePrecheck7082283915265644779.info,avoid_proxy_tostring=true -cp E:\linyun\bug_repo\Chart\15\bug\build-tests;E:\linyun\bug_repo\Chart\15\bug\build;E:\linyun\bug_repo\Chart\15\bug\lib\itext-2.0.6.jar;E:\linyun\bug_repo\Chart\15\bug\lib\junit.jar;E:\linyun\bug_repo\Chart\15\bug\lib\servlet.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\junit.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\org.hamcrest.core.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\testrunner.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\bcel-6.0.jar;E:\linyun\software\eclipse-java-mars\eclipse-java-mars-clean\eclipse\dropins\junit_lib\javassist.jar microbat.evaluation.junit.MicroBatTestRunner org.jfree.chart.plot.junit.PiePlot3DTests testDrawWithNullDataset
org.apache.bcel.generic.ClassGenException: Branch target offset too large for short: 35214
	at org.apache.bcel.generic.BranchInstruction.dump(BranchInstruction.java:81)
	at org.apache.bcel.generic.InstructionList.getByteCode(InstructionList.java:942)
	at org.apache.bcel.generic.MethodGen.getMethod(MethodGen.java:625)
	at microbat.instrumentation.precheck.PrecheckInstrumenter.calculateTraceInstrumentation(PrecheckInstrumenter.java:61)
	at microbat.instrumentation.precheck.PrecheckInstrumenter.instrument(PrecheckInstrumenter.java:46)
	at microbat.instrumentation.instr.AbstractInstrumenter.instrument(AbstractInstrumenter.java:29)
	at microbat.instrumentation.precheck.PrecheckTransformer.doTransform(PrecheckTransformer.java:38)
	at microbat.instrumentation.instr.AbstractTransformer.transform(AbstractTransformer.java:34)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at org.jfree.chart.ChartFactory.createPieChart3D(ChartFactory.java:694)
	at org.jfree.chart.plot.junit.PiePlot3DTests.testDrawWithNullDataset(PiePlot3DTests.java:137)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
	at microbat.evaluation.junit.MicroBatTestRunner.runTest(MicroBatTestRunner.java:48)
	at microbat.evaluation.junit.MicroBatTestRunner.main(MicroBatTestRunner.java:28)

llmhyy avatar Dec 29 '18 08:12 llmhyy

this is the case that the generated bytecode of instrumentation method exceeds limit, org.jfree.chart.plot.PiePlot3D#drawSide(Ljava/awt/Graphics2D:Ljava/awt/geom/Rectangle2D:Ljava/awt/geom/Arc2D:Ljava/awt/geom/Area:Ljava/awt/geom/Area:Ljava/awt/Paint:Ljava/awt/Paint:Ljava/awt/Stroke:ZZ)V Although the stacktrace is printed out, the error is actually ignored.

lylytran avatar Dec 31 '18 06:12 lylytran