Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

NPE when compiling Scala library #1

Closed
jmgrosen opened this Issue · 2 comments

3 participants

@jmgrosen

Compiling a simple "Hello World" scala file gives me two files in classes/, HelloWorldScala.java and HelloWorldScala$.java. Then, to compile it to a binary, I use robovm -verbose -cp scala-library.jar:classes/ HelloWorldScala. It goes through and compiles a lot of classes, but then eventually gets to scala.concurrent.forkjoin.ForkJoinTask and fails with this exception:

java.lang.NullPointerException
    at soot.jimple.toolkits.annotation.arraycheck.ArrayBoundsCheckerAnalysis.doAnalysis(ArrayBoundsCheckerAnalysis.java:344)
    at soot.jimple.toolkits.annotation.arraycheck.ArrayBoundsCheckerAnalysis.<init>(ArrayBoundsCheckerAnalysis.java:135)
    at soot.jimple.toolkits.annotation.arraycheck.ArrayBoundsChecker.internalTransform(ArrayBoundsChecker.java:86)
    at soot.BodyTransformer.transform(BodyTransformer.java:51)
    at soot.Transform.apply(Transform.java:104)
    at soot.BodyPack.internalApply(BodyPack.java:49)
    at soot.Pack.apply(Pack.java:124)
    at org.robovm.compiler.MethodCompiler.doCompile(MethodCompiler.java:228)
    at org.robovm.compiler.AbstractMethodCompiler.compile(AbstractMethodCompiler.java:83)
    at org.robovm.compiler.ClassCompiler.method(ClassCompiler.java:927)
    at org.robovm.compiler.ClassCompiler.compile(ClassCompiler.java:451)
    at org.robovm.compiler.ClassCompiler.compile(ClassCompiler.java:257)
    at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:204)
    at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:220)
    at org.robovm.compiler.AppCompiler.main(AppCompiler.java:361)

This is using Scala 2.10 and RoboVM 0.0.1.

@h31

Same for me on Linux x86 with JRE 1.7.0_09.

@ntherning ntherning closed this issue from a commit
@ntherning ntherning Fixes #1. NPE is thrown by Soot's ArrayBoundsCheckerAnalysis when the…
… first unit in a static method is the target of other units in the method. We now insert a nop as the first unit in such methods to work around this problem. This thread on Soot's mailing list has more info: http://www.sable.mcgill.ca/listarchives/soot-list/msg01397.html.
99a324c
@ntherning ntherning closed this in 99a324c
@ntherning
Owner

Here's some Java code which triggers this Soot problem:

    static int[] x = {1};
    static void foo() {
        while (true) {
            x[0]++;
        }
    }
@ntherning ntherning referenced this issue from a commit
@ntherning ntherning Fixed LocalVariable tables in Soot for parameters and 'this' to alway…
…s start

on the first unit of the body of a method. This fixes an issue with the
LocalSplitter splitting parameters which are written without being read first.
(#597)

Also removed the special compilation of Object.<init>() as it didn't create
allocas as expected by compiler plugins. Object.<init>() will now be compiled
as any other method and the call to register_finalizable() will be inserted
afterwards.

Also fixed so that the nop inserted by MethodCompiler to workaround a bug in
Soot's ArrayBoundsCheckerAnalysis (see #1) is removed right after the Soot
passes have been run. Otherwise the start unit for parameter LocalVariables
will not be the first unit of the method any longer.
341379e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.