From: <ipe...@us...> - 2010-03-08 20:25:40
|
Revision: 13272 http://x10.svn.sourceforge.net/x10/?rev=13272&view=rev Author: ipeshansky Date: 2010-03-08 20:25:34 +0000 (Mon, 08 Mar 2010) Log Message: ----------- Fix XTENLANG-1126. Add a test case for comparing remote references for equality. Modified Paths: -------------- trunk/x10.runtime/src-cpp/x10/lang/Object.h Added Paths: ----------- trunk/x10.tests/examples/Constructs/References/ trunk/x10.tests/examples/Constructs/References/RemoteRefEquality.x10 Modified: trunk/x10.runtime/src-cpp/x10/lang/Object.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Object.h 2010-03-08 20:23:07 UTC (rev 13271) +++ trunk/x10.runtime/src-cpp/x10/lang/Object.h 2010-03-08 20:25:34 UTC (rev 13272) @@ -103,9 +103,9 @@ virtual x10aux::ref<x10::lang::String> typeName(); // Needed for linking - do not override - virtual x10_boolean _struct_equals(x10aux::ref<Object> other) { + virtual x10_boolean _struct_equals(x10aux::ref<Reference> other) { assert(other!=x10aux::null); // checked in basic_functions.h x10aux::struct_equals - if (other == x10aux::ref<Object>(this)) return true; + if (other == x10aux::ref<Reference>(this)) return true; if (this->location == x10aux::here) return false; // already tested above if (other->location == this->location && x10aux::get_remote_ref(other.operator->()) == x10aux::get_remote_ref(this)) Added: trunk/x10.tests/examples/Constructs/References/RemoteRefEquality.x10 =================================================================== --- trunk/x10.tests/examples/Constructs/References/RemoteRefEquality.x10 (rev 0) +++ trunk/x10.tests/examples/Constructs/References/RemoteRefEquality.x10 2010-03-08 20:25:34 UTC (rev 13272) @@ -0,0 +1,39 @@ +/* + * This file is part of the X10 project (http://x10-lang.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * (C) Copyright IBM Corporation 2006-2010. + */ + +import harness.x10Test; + +/** + * Two remote references to the same object must be equal. + * @author igor 06/2009 + */ +class RemoteRefEquality extends x10Test { + + val rr:RemoteRefEquality; + + public def this(v:RemoteRefEquality) { rr = v; } + + public def this() { this(null); } + + public def run(): boolean { + chk(Place.places.length > 1, "This test must be run with multiple places"); + val local = new RemoteRefEquality(); + val remote = at (here.next()) new RemoteRefEquality(local); + Console.OUT.println(local == (at (remote) remote.rr)); // workaround XTENLANG-1124 + Console.OUT.println(at (remote) remote.rr == local); + return at (remote) remote.rr == local; + } + + public static def main(Rail[String]) { + new RemoteRefEquality().execute(); + } +} + Property changes on: trunk/x10.tests/examples/Constructs/References/RemoteRefEquality.x10 ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |