Hi,

Forgot to mention that I am using SVN-Head 

The code compiles with the released x10 2.0 c++ backend.

This also runs, but randomly gives exceptions of the form:

Uncaught exception at place 0: x10.lang.NullPointerException
x10.lang.NullPointerException
        at x10::lang::Throwable::fillInStackTrace()
        at x10aux::throwNPE()
        at x10aux::ref<testIt> x10aux::nullCheck<testIt>(x10aux::ref<testIt>)
        at actualtest__closure__1::apply()
        at x10::runtime::Activity::run()
        at x10_runtime_Runtime__closure__20::apply()
        at x10::runtime::NativeRuntime::runAtLocal(int, 
x10aux::ref<x10::lang::VoidFun_0_0>)
        at x10::runtime::Runtime::run(x10aux::ref<x10::runtime::Activity>)
        at x10::runtime::Worker::loop(x10aux::ref<x10::runtime::Latch>, bool)
        at x10::runtime::Worker::join(x10aux::ref<x10::runtime::Latch>)
        at x10_runtime_Runtime__closure__19::apply()
        at x10::runtime::NativeRuntime::runAtLocal(int, 
x10aux::ref<x10::lang::VoidFun_0_0>)
        at x10::runtime::Runtime::join(x10aux::ref<x10::runtime::Latch>)
        at x10::runtime::RootFinish::waitForFinish(bool)
        at x10::runtime::Runtime::stopFinish()
        at actualtest::make()
        at 
actualtest::main(x10aux::ref<x10::lang::Rail<x10aux::ref<x10::lang::String> > >)
        at x10aux::BootStrapClosure::apply()
        at x10_runtime_Runtime__closure__1::apply()
        at x10::runtime::Activity::run()
        at x10_runtime_Runtime__closure__20::apply()
        at x10::runtime::NativeRuntime::runAtLocal(int, 
x10aux::ref<x10::lang::VoidFun_0_0>)
        at x10::runtime::Runtime::run(x10aux::ref<x10::runtime::Activity>)
        at x10::runtime::Worker::loop(x10aux::ref<x10::runtime::Latch>, bool)
        at x10::runtime::Worker::apply()
        at x10::runtime::Pool::apply()
        at x10::runtime::Runtime::start(x10aux::ref<x10::lang::VoidFun_0_0>, 
x10aux::ref<x10::lang::VoidFun_0_0>)
        at int x10aux::template_main<x10::runtime::Runtime, actualtest>(int, 
char**)
        at main
        at __libc_start_main
        at std::ios_base::Init::~Init()

-
ganesh


----- Forwarded Message ----
From: Ganesh Venkateshwara <tovgan...@yahoo.co.in>
To: x10-users@lists.sourceforge.net
Sent: Wed, 13 January, 2010 10:09:04 AM
Subject: problem compiling code

Hi,

I have a piece of code (attached below). The code doesn't compile with C++ 
backend and gives the following error:

x10c++: In file included from actualtest.cc:4:
     actualtest.inc: In member function ‘void actualtest__closure__1::apply()’:
     actualtest.inc:33: error: invalid use of member (did you forget the ‘&’ ?)
     actualtest.inc:33: error: invalid use of member (did you forget the ‘&’ ?)
x10c++: Non-zero return code: 1
2 errors.

With Java backend the code compiles and runs, but randomly gives exceptions of 
the form:

java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at x10.core.GrowableRail.grow(GrowableRail.java:81)
        at x10.core.GrowableRail.add(GrowableRail.java:46)
        at x10.util.ArrayList.add(ArrayList.java:175)
        at actualtest$1.apply(actualtest.java:108)
        at x10.lang.Activity.run(Activity.java:169)
        at x10.lang.Runtime$Worker$3.apply(Runtime.java:3222)
        at x10.runtime.impl.java.Runtime.runAt(Runtime.java:101)
        at x10.lang.Runtime$Worker.loop(Runtime.java:3189)
        at x10.lang.Runtime$Worker.apply(Runtime.java:3077)
        at x10.lang.Runtime$Pool$1.apply(Runtime.java:3408)
        at x10.runtime.impl.java.Thread$1.run(Thread.java:36)
        at java.lang.Thread.run(Thread.java:619)

Any help is appreciated.

The code:
---------------------------------------

import x10.util.*;

class testIt {
  public var i:Int;

  public def this(ii:Int) { i = ii; }
}

public class actualtest {
    public def this() { }
    public def make() {
        val strs = new ArrayList[testIt]();

        finish for(var i:Int=0; i<100; i++) {
            val ii = i;
            async { strs.add(new testIt(ii)); };
        }

        finish foreach(s in strs) x10.io.Console.OUT.println((s as 
testIt{self.at(this)}).i);
    }

    public static def main(args:Rail[String]!) : void {
        new actualtest().make();
    }
}

---------------------------------------------



In the beginning there was nothing. God said, 'Let there be light!' And there 
was light. There was still nothing, but you could see it a whole lot better.
- Ellen DeGeneres


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to