From: Vijay S. (JIRA) <ji...@co...> - 2011-11-09 12:55:01
|
ICE on x(j)++; where x is an Array. ----------------------------------- Key: XTENLANG-2964 URL: https://jira.codehaus.org/browse/XTENLANG-2964 Project: X10 Issue Type: Bug Components: X10 Compiler: Front-end Desugaring Environment: command line Reporter: Vijay Saraswat Assignee: Vijay Saraswat The source code is: import x10.util.Random; import x10.io.Console; public class Integrate { // working, serial public static def compute1(n:Int, p:Int, mx:Int, my:Int, mz:Int):Double { val r = new Random(1); var result:Double = 0.0; for ([i] in 1..n) { val x = r.nextInt(mx); val y = r.nextInt(my); val z = r.nextInt(mz); if (z < x*x - y*y) { result++; } } return ((result/n)*(mx*my*mz)); } // no synchronization -> accuracy issues on result public static def compute2(n:Int, p:Int, mx:Int, my:Int, mz:Int):Double { var result:Double = 0.0; val m = n/p; finish for ([j] in 1..p) { async { val r = new Random(j); for ([i] in 1..m) { val x = r.nextInt(mx); val y = r.nextInt(my); val z = r.nextInt(mz); if (z < x*x - y*y) { result++; } } } } return ((result/n)*(mx*my*mz)); } // local result, summed up later public static def compute3(n:Int, p:Int, mx:Int, my:Int, mz:Int):Double { val m = n/p; var results:Array[Double] = new Array[Double](p); finish for ([j] in 1..p) { async { val r = new Random(j); for ([i] in 1..m) { val x = r.nextInt(mx); val y = r.nextInt(my); val z = r.nextInt(mz); if (z < x*x - y*y) { results(j) += 1; } } } } return ((results.reduce((a:Double,b:Double)=>a+b,0.0)/n)*(mx*my*mz)); } public static def main(s: Array[String](1)) { Console.OUT.println("compute1: " + compute1(1000000,8,10,10,10)); Console.OUT.println("compute2: " + compute2(1000000,8,10,10,10)); Console.OUT.println("compute3: " + compute3(1000000,8,10,10,10)); } } The ICE is: x10c Integrate.x10 x10c Integrate.x10 C:\eclipsews\csnext1\X10 playground\src\Integrate.x10:48: Unexpected exception while creating assignment 1 error. Exception in thread "main" polyglot.util.InternalCompilerError: C:\eclipsews\csnext1\X10 playground\src\Integrate.x10:48,42-53: Unexpected exception while creating assignment at x10.visit.Desugarer.assign(Desugarer.java:295) at x10.visit.Desugarer.assign(Desugarer.java:287) at x10.visit.Desugarer.unaryPre(Desugarer.java:231) at x10.visit.Desugarer.visitUnary(Desugarer.java:251) at x10.visit.Desugarer.leaveCall(Desugarer.java:148) at polyglot.visit.ErrorHandlingVisitor.leaveCall(ErrorHandlingVisitor.java:144) at polyglot.visit.ErrorHandlingVisitor.leave(ErrorHandlingVisitor.java:282) at polyglot.visit.ContextVisitor.leave(ContextVisitor.java:140) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:258) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Eval_c.visitChildren(Eval_c.java:58) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at x10.visit.Desugarer.override(Desugarer.java:134) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:214) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.If_c.visitChildren(If_c.java:89) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at x10.ast.X10Loop_c.visitChildren(X10Loop_c.java:329) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at x10.ast.Async_c.visitChildren(Async_c.java:137) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at x10.ast.X10Loop_c.visitChildren(X10Loop_c.java:329) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at x10.ast.Finish_c.visitChildren(Finish_c.java:103) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:72) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.MethodDecl_c.visitChildren(MethodDecl_c.java:160) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at x10.ast.X10ClassBody_c.visitChildren(X10ClassBody_c.java:340) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at x10.ast.X10ClassDecl_c.visitChildren(X10ClassDecl_c.java:1584) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visitChild(Node_c.java:180) at polyglot.ast.Node_c.visitList(Node_c.java:240) at polyglot.ast.SourceFile_c.visitChildren(SourceFile_c.java:118) at polyglot.ast.JL_c.visitChildren(JL_c.java:45) at x10.extension.X10Del_c.visitChildren(X10Del_c.java:143) at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:251) at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:217) at polyglot.ast.Node_c.visit(Node_c.java:184) at polyglot.frontend.VisitorGoal.runTask(VisitorGoal.java:48) at x10.ExtensionInfo$X10Scheduler$ValidatingVisitorGoal.runTask(ExtensionInfo.java:1003) at polyglot.frontend.Scheduler.runPass(Scheduler.java:371) at x10.ExtensionInfo$X10Scheduler.runPass(ExtensionInfo.java:1146) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:133) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.AbstractGoal_c.run(AbstractGoal_c.java:75) at polyglot.types.LazyRef_c.get(LazyRef_c.java:56) at polyglot.frontend.Scheduler.attempt(Scheduler.java:271) at polyglot.frontend.Scheduler.runToCompletion(Scheduler.java:205) at polyglot.frontend.Scheduler.runToCompletion(Scheduler.java:191) at polyglot.frontend.Compiler.compile(Compiler.java:279) at polyglot.frontend.Compiler.compileFiles(Compiler.java:239) at polyglot.main.Main.start(Main.java:135) at polyglot.main.Main.start(Main.java:76) at polyglot.main.Main.main(Main.java:185) Caused by: polyglot.types.NoMemberException: No valid method call found for call in given type. Call: operator()=(x10.array.Array[x10.lang.Double], x10.lang.Int, x10.lang.Double) Type: (p$0:x10.array.Array[x10.lang.Double], p$1:x10.lang.Int{self==j})=> x10.lang.Double ]0;/cygdrive/c/eclipsews/csnext1/X10 playground/src -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |