From: <ta...@us...> - 2010-01-09 04:35:10
|
Revision: 12477 http://x10.svn.sourceforge.net/x10/?rev=12477&view=rev Author: tardieu Date: 2010-01-09 04:34:59 +0000 (Sat, 09 Jan 2010) Log Message: ----------- added support for @NativeClass structs and type parameters replace @NativeRep PlaceLocalHandle with @NativeClass Modified Paths: -------------- trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java trunk/x10.runtime/src-cpp/Makefile trunk/x10.runtime/src-cpp/x10/lang/Rail.cc trunk/x10.runtime/src-cpp/x10aux/network.cc trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 Added Paths: ----------- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.cc trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.h trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.struct_h Removed Paths: ------------- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.cc trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.h trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.struct_h Modified: trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java =================================================================== --- trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.compiler/src/x10/visit/NativeClassVisitor.java 2010-01-09 04:34:59 UTC (rev 12477) @@ -53,6 +53,7 @@ import x10.ast.X10MethodDecl; import x10.ast.X10NodeFactory; import x10.extension.X10Ext; +import x10.types.ParameterType; import x10.types.X10Def; import x10.types.X10ConstructorDef; import x10.types.X10ClassDef; @@ -154,13 +155,25 @@ Position p = Position.COMPILER_GENERATED; // create fake def for native class - ClassDef fake = xts.createClassDef(); + X10ClassDef fake = (X10ClassDef) xts.createClassDef(); fake.name(Name.make(cname)); fake.kind(ClassDef.TOP_LEVEL); fake.setFromEncodedClassFile(); - fake.setFlags(X10Flags.NONE); + if (cdef.isStruct()) { + fake.setFlags(X10Flags.STRUCT); + } else { + fake.setFlags(X10Flags.NONE); + } fake.setPackage(Types.ref(ts.packageForName(QName.make(getNativeClassPackage(cdef))))); + java.util.Iterator<ParameterType> ps = cdef.typeParameters().iterator(); + java.util.Iterator<ParameterType.Variance> vs = cdef.variances().iterator(); + while (ps.hasNext()) { + ParameterType pp = ps.next(); + ParameterType.Variance vv = vs.next(); + fake.addTypeParameter(pp, vv); + } + // add field with native type Name fname = Name.make("__NATIVE_FIELD__"); Id fid = xnf.Id(p, fname); @@ -169,6 +182,7 @@ Flags fflags = X10Flags.GLOBAL.Private().Final(); FieldDef fdef = xts.fieldDef(p, Types.ref(cdef.asType()), fflags, Types.ref(ftype), fname); cmembers.add(xnf.FieldDecl(p, xnf.FlagsNode(p, fflags), ftnode, fid).fieldDef(fdef)); + cdef.addField(fdef); // field selector Receiver special = xnf.This(p).type(cdef.asType()); @@ -187,7 +201,7 @@ ConstructorDef sdef = xts.findConstructor(cdecl.superClass().type(), xts.ConstructorMatcher(cdecl.superClass().type(), Collections.<Type>emptyList(), context)).def(); - ConstructorDecl xd = xnf.ConstructorDecl(p, + X10ConstructorDecl xd = (X10ConstructorDecl) xnf.ConstructorDecl(p, xnf.FlagsNode(p, X10Flags.PRIVATE), cdecl.name(), Collections.<Formal>singletonList(f), @@ -195,6 +209,8 @@ xnf.Block(p, xnf.SuperCall(p, Collections.<Expr>emptyList()).constructorInstance(sdef.asInstance()), xnf.Eval(p, assign))); + xd.typeParameters(cdecl.typeParameters()); + xd.returnType(ftnode); ConstructorDef xdef = xts.constructorDef(p, Types.ref(cdef.asType()), @@ -235,6 +251,7 @@ // reuse x10 method instance for delegate method but make it global to avoid place check MethodInstance minst = mdef.asInstance(); minst = (MethodInstance) minst.flags(((X10Flags) minst.flags()).Global()); + minst = (MethodInstance) minst.container(ftype); // call delegate Receiver target = mdef.flags().isStatic() ? ftnode : field; @@ -299,7 +316,7 @@ } if (!hasNativeConstructor) { - throw new SemanticException("@NativeClass " + cdecl.name() + " must be declare a native constructor."); + throw new SemanticException("@NativeClass " + cdecl.name() + " must declare a native constructor."); } return cdecl.body(cbody.members(cmembers)); Modified: trunk/x10.runtime/src-cpp/Makefile =================================================================== --- trunk/x10.runtime/src-cpp/Makefile 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/Makefile 2010-01-09 04:34:59 UTC (rev 12477) @@ -250,7 +250,7 @@ x10/lang/ValRail.o \ x10/lang/Deque.o \ x10/lang/Lock__ReentrantLock.o \ - x10/lang/PlaceLocalHandle.o \ + x10/lang/PlaceLocalHandle_Impl.o \ x10/lang/Thread.o \ x10/util/GrowableRail.o \ x10/util/concurrent/atomic/AtomicBoolean.o \ Deleted: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.cc 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.cc 2010-01-09 04:34:59 UTC (rev 12477) @@ -1,25 +0,0 @@ -#include <x10aux/config.h> -#include <x10aux/alloc.h> -#include <x10aux/RTT.h> - -#include <x10/lang/PlaceLocalHandle.h> - -using namespace x10aux; -using namespace x10::lang; - -namespace x10 { - namespace lang { - - x10aux::RuntimeType PlaceLocalHandle<void>::rtt; - - void - _initRTTHelper_PlaceLocalHandle(RuntimeType *location, const RuntimeType *rtt) { - const RuntimeType* params[1] = { rtt }; - RuntimeType::Variance variances[1] = { RuntimeType::invariant }; - const RuntimeType *canonical = x10aux::getRTT<PlaceLocalHandle<void> >(); - const char *name = alloc_printf("x10.lang.PlaceLocalHandle[+%s]",rtt->name()); - location->init(canonical, name, 0, NULL, 1, params, variances); - } - } -} - Deleted: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.h 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.h 2010-01-09 04:34:59 UTC (rev 12477) @@ -1,15 +0,0 @@ -#ifndef X10_LANG_PLACELOCALHANDLE_H -#define X10_LANG_PLACELOCALHANDLE_H - -#include <x10rt.h> - -#include <x10/lang/PlaceLocalHandle.struct_h> - -namespace x10 { - namespace lang { - namespace PlaceLocalHandle_ns { - } - } -} -#endif - Deleted: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.struct_h =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.struct_h 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.struct_h 2010-01-09 04:34:59 UTC (rev 12477) @@ -1,99 +0,0 @@ -#ifndef X10_LANG_PLACELOCALHANDLE_STRUCT_H -#define X10_LANG_PLACELOCALHANDLE_STRUCT_H - -#include <x10rt.h> - -#include <x10/lang/String.h> - -namespace x10 { - namespace lang { - - void _initRTTHelper_PlaceLocalHandle(x10aux::RuntimeType *location, const x10aux::RuntimeType *rtt); - - template <class T> class PlaceLocalHandle { - public: - RTT_H_DECLS_STRUCT - - T FMGL(localStorage); - x10_int FMGL(id); - bool FMGL(cached); - - PlaceLocalHandle<T>* operator->() { return this; } - - static PlaceLocalHandle<T> createHandle() { - PlaceLocalHandle<T> result; - x10_int id = x10aux::place_local::nextId(); - result.FMGL(id) = id; - result.FMGL(cached) = false; - return result; - } - - void set(T newVal) { - assert(!FMGL(cached)); - FMGL(localStorage) = newVal; - FMGL(cached) = true; - T *tmp = x10aux::alloc<T>(); - *tmp = newVal; - x10aux::place_local::registerData(FMGL(id), (void*)tmp); - } - - T get() { - if (!FMGL(cached)) { - T *tmp = (T*)(x10aux::place_local::lookupData(FMGL(id))); - FMGL(localStorage) = *tmp; - FMGL(cached) = true; - } - return FMGL(localStorage); - } - - x10aux::ref<x10::lang::String> toString() { - if (FMGL(cached)) { - return x10aux::to_string(FMGL(localStorage)); - } else { - return x10::lang::String::Lit("PlaceLocalHandle(uncached data)"); - } - } - - x10_int hashCode() { - return x10aux::hash_code(FMGL(id)); - } - - - x10_boolean _struct_equals(PlaceLocalHandle<T> that) { - return FMGL(id) == that->FMGL(id); - } - - static void _serialize(PlaceLocalHandle<T> this_, x10aux::serialization_buffer &buf); - - static PlaceLocalHandle<T> _deserialize(x10aux::deserialization_buffer& buf); - }; - - template <> class PlaceLocalHandle<void> { - public: - static x10aux::RuntimeType rtt; - static const x10aux::RuntimeType* getRTT() { return &rtt; } - }; - - template<class T> void PlaceLocalHandle<T>::_initRTT() { - rtt.canonical = &rtt; - x10::lang::_initRTTHelper_PlaceLocalHandle(&rtt, x10aux::getRTT<T>()); - } - - template<class T> x10aux::RuntimeType PlaceLocalHandle<T>::rtt; - - template <class T> void PlaceLocalHandle<T>::_serialize(PlaceLocalHandle<T> this_, x10aux::serialization_buffer &buf) { - // NOTE specialized semantics. Only id is serialized, cached and localStorage are place local! - buf.write(this_->FMGL(id)); - } - - template<class T> PlaceLocalHandle<T> PlaceLocalHandle<T>::_deserialize(x10aux::deserialization_buffer& buf) { - // NOTE specialized semantics. Only id is serialized, cached is automatically set to false; will be looked up on first use. - PlaceLocalHandle<T> this_; - this_->FMGL(id) = buf.read<x10_int>(); - this_->FMGL(cached) = false; - return this_; - } - } -} -#endif - Copied: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.cc (from rev 12466, trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.cc) =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.cc (rev 0) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.cc 2010-01-09 04:34:59 UTC (rev 12477) @@ -0,0 +1,25 @@ +#include <x10aux/config.h> +#include <x10aux/alloc.h> +#include <x10aux/RTT.h> + +#include <x10/lang/PlaceLocalHandle_Impl.h> + +using namespace x10aux; +using namespace x10::lang; + +namespace x10 { + namespace lang { + + x10aux::RuntimeType PlaceLocalHandle_Impl<void>::rtt; + + void + _initRTTHelper_PlaceLocalHandle_Impl(RuntimeType *location, const RuntimeType *rtt) { + const RuntimeType* params[1] = { rtt }; + RuntimeType::Variance variances[1] = { RuntimeType::invariant }; + const RuntimeType *canonical = x10aux::getRTT<PlaceLocalHandle_Impl<void> >(); + const char *name = alloc_printf("x10.lang.PlaceLocalHandle_Impl[+%s]",rtt->name()); + location->init(canonical, name, 0, NULL, 1, params, variances); + } + } +} + Copied: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.h (from rev 12466, trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.h) =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.h (rev 0) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.h 2010-01-09 04:34:59 UTC (rev 12477) @@ -0,0 +1,15 @@ +#ifndef X10_LANG_PLACELOCALHANDLE_IMPL_H +#define X10_LANG_PLACELOCALHANDLE_IMPL_H + +#include <x10rt.h> + +#include <x10/lang/PlaceLocalHandle_Impl.struct_h> + +namespace x10 { + namespace lang { + namespace PlaceLocalHandle_Impl_ns { + } + } +} +#endif + Copied: trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.struct_h (from rev 12466, trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle.struct_h) =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.struct_h (rev 0) +++ trunk/x10.runtime/src-cpp/x10/lang/PlaceLocalHandle_Impl.struct_h 2010-01-09 04:34:59 UTC (rev 12477) @@ -0,0 +1,118 @@ +#ifndef X10_LANG_PLACELOCALHANDLE_IMPL_STRUCT_H +#define X10_LANG_PLACELOCALHANDLE_IMPL_STRUCT_H + +#include <x10rt.h> + +#include <x10/lang/String.h> + +namespace x10 { + namespace lang { + + void _initRTTHelper_PlaceLocalHandle_Impl(x10aux::RuntimeType *location, const x10aux::RuntimeType *rtt); + + template <class T> class PlaceLocalHandle_Impl { + public: + RTT_H_DECLS_STRUCT + + T FMGL(localStorage); + x10_int FMGL(id); + bool FMGL(cached); + + PlaceLocalHandle_Impl<T>* operator->() { return this; } + + void set(T newVal) { + assert(!FMGL(cached)); + FMGL(localStorage) = newVal; + FMGL(cached) = true; + T *tmp = x10aux::alloc<T>(); + *tmp = newVal; + x10aux::place_local::registerData(FMGL(id), (void*)tmp); + } + + T apply() { + if (!FMGL(cached)) { + T *tmp = (T*)(x10aux::place_local::lookupData(FMGL(id))); + FMGL(localStorage) = *tmp; + FMGL(cached) = true; + } + return FMGL(localStorage); + } + + x10aux::ref<x10::lang::String> toString() { + if (FMGL(cached)) { + return x10aux::to_string(FMGL(localStorage)); + } else { + return x10::lang::String::Lit("PlaceLocalHandle_Impl(uncached data)"); + } + } + + x10_int hashCode() { + return x10aux::hash_code(FMGL(id)); + } + + + x10_boolean _struct_equals(PlaceLocalHandle_Impl<T> that) { + return FMGL(id) == that->FMGL(id); + } + + static void _serialize(PlaceLocalHandle_Impl<T> this_, x10aux::serialization_buffer &buf); + + static PlaceLocalHandle_Impl<T> _deserialize(x10aux::deserialization_buffer& buf); + }; + + template <> class PlaceLocalHandle_Impl<void> { + public: + static x10aux::RuntimeType rtt; + static const x10aux::RuntimeType* getRTT() { return &rtt; } + }; + + template<class T> void PlaceLocalHandle_Impl<T>::_initRTT() { + rtt.canonical = &rtt; + x10::lang::_initRTTHelper_PlaceLocalHandle_Impl(&rtt, x10aux::getRTT<T>()); + } + + template<class T> x10aux::RuntimeType PlaceLocalHandle_Impl<T>::rtt; + + template <class T> void PlaceLocalHandle_Impl<T>::_serialize(PlaceLocalHandle_Impl<T> this_, x10aux::serialization_buffer &buf) { + // NOTE specialized semantics. Only id is serialized, cached and localStorage are place local! + buf.write(this_->FMGL(id)); + } + + template<class T> PlaceLocalHandle_Impl<T> PlaceLocalHandle_Impl<T>::_deserialize(x10aux::deserialization_buffer& buf) { + // NOTE specialized semantics. Only id is serialized, cached is automatically set to false; will be looked up on first use. + PlaceLocalHandle_Impl<T> this_; + this_->FMGL(id) = buf.read<x10_int>(); + this_->FMGL(cached) = false; + return this_; + } + + template <class T> class PlaceLocalHandle_Impl_methods { + public: + static PlaceLocalHandle_Impl<T> _make() { + PlaceLocalHandle_Impl<T> result; + x10_int id = x10aux::place_local::nextId(); + result.FMGL(id) = id; + result.FMGL(cached) = false; + return result; + } + + static T apply(PlaceLocalHandle_Impl<T> this_) { + return this_.apply(); + } + + static void set(PlaceLocalHandle_Impl<T> this_, T newVal) { + this_.set(newVal); + } + + static x10_int hashCode(PlaceLocalHandle_Impl<T> this_) { + return this_.hashCode(); + } + + static x10aux::ref<x10::lang::String> toString(PlaceLocalHandle_Impl<T> this_) { + return this_.toString(); + } + }; + } +} +#endif + Modified: trunk/x10.runtime/src-cpp/x10/lang/Rail.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10/lang/Rail.cc 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/x10/lang/Rail.cc 2010-01-09 04:34:59 UTC (rev 12477) @@ -30,7 +30,7 @@ void x10::lang::Rail_notifyEnclosingFinish(deserialization_buffer& buf) { ref<Reference> fs = buf.read<ref<Reference> >(); - ref<x10::lang::Runtime> rt = x10::lang::Runtime::FMGL(runtime)->get(); + ref<x10::lang::Runtime> rt = x10::lang::PlaceLocalHandle_methods<x10aux::ref<x10::lang::Runtime> >::apply(x10::lang::Runtime::FMGL(runtime)); // olivier says the incr should be just after the notifySubActivitySpawn (fs.operator->()->*(findITable<x10::lang::Runtime__FinishState>(fs->_getITables())->notifyActivityCreation))(); (fs.operator->()->*(findITable<x10::lang::Runtime__FinishState>(fs->_getITables())->notifyActivityTermination))(); @@ -40,7 +40,7 @@ { // dst is the place where the finish update will occur, i.e. where the notifier runs dst = x10aux::parent(dst); - ref<x10::lang::Runtime> rt = x10::lang::Runtime::FMGL(runtime)->get(); + ref<x10::lang::Runtime> rt = x10::lang::PlaceLocalHandle_methods<x10aux::ref<x10::lang::Runtime> >::apply(x10::lang::Runtime::FMGL(runtime)); ref<Reference> fs = rt->currentState(); (fs.operator->()->*(findITable<x10::lang::Runtime__FinishState>(fs->_getITables())->notifySubActivitySpawn))(x10::lang::Place_methods::_make(dst)); buf.write(fs); Modified: trunk/x10.runtime/src-cpp/x10aux/network.cc =================================================================== --- trunk/x10.runtime/src-cpp/x10aux/network.cc 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-cpp/x10aux/network.cc 2010-01-09 04:34:59 UTC (rev 12477) @@ -285,7 +285,7 @@ remote_free(p.dest_place, (x10_ulong)(size_t)env); x10aux::deserialization_buffer buf(static_cast<char*>(p.msg)); x10aux::ref<x10::lang::Reference> fs = buf.read<x10aux::ref<x10::lang::Reference> >(); - x10aux::ref<x10::lang::Runtime> rt = x10::lang::Runtime::FMGL(runtime)->get(); + x10aux::ref<x10::lang::Runtime> rt = x10::lang::PlaceLocalHandle_methods<x10aux::ref<x10::lang::Runtime> >::apply(x10::lang::Runtime::FMGL(runtime)); (fs.operator->()->*(x10aux::findITable<x10::lang::Runtime__FinishState>(fs->_getITables())->notifyActivityCreation))(); (fs.operator->()->*(x10aux::findITable<x10::lang::Runtime__FinishState>(fs->_getITables())->notifyActivityTermination))(); } Modified: trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java =================================================================== --- trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-java/x10/runtime/impl/java/PlaceLocalHandle.java 2010-01-09 04:34:59 UTC (rev 12477) @@ -17,11 +17,11 @@ public final class PlaceLocalHandle<T>{ private final Object[] objects; - private PlaceLocalHandle() { + public PlaceLocalHandle(Object t) { objects = new Object[Runtime.MAX_PLACES]; } - public T get() { + public T apply() { int here = Thread.currentThread().home(); Object data = objects[here]; assert data != null : "At "+here+": get called on uninitialized local object"; @@ -33,8 +33,4 @@ assert objects[here] == null : "At "+here+" set called on already initialized local object"; objects[here] = data; } - - public static <T> PlaceLocalHandle<T> createHandle() { - return new PlaceLocalHandle<T>(); - } } Modified: trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 =================================================================== --- trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 2010-01-09 04:06:03 UTC (rev 12476) +++ trunk/x10.runtime/src-x10/x10/lang/PlaceLocalHandle.x10 2010-01-09 04:34:59 UTC (rev 12477) @@ -9,7 +9,7 @@ package x10.lang; import x10.compiler.Native; -import x10.compiler.NativeRep; +import x10.compiler.NativeClass; /** * A PlaceLocalHandle is used in conjunction with the PlaceLocalStorage @@ -32,45 +32,34 @@ * using the particular PlaceLocalHandle (mapping the same object at * multiple places or mapping distinct object at each place).</p> */ -@NativeRep("c++", "x10::lang::PlaceLocalHandle<#1 >", "x10::lang::PlaceLocalHandle<#1 >", null) -@NativeRep("java", "x10.runtime.impl.java.PlaceLocalHandle<#1>", null, null) +@NativeClass("c++", "x10.lang", "PlaceLocalHandle_Impl") +@NativeClass("java", "x10.runtime.impl.java", "PlaceLocalHandle") public final struct PlaceLocalHandle[T]{T <: Object} { - /** - * @return the object mapped to the handle at the current place - */ - // TODO: make everyone use apply() instead - @Native("c++", "(#0)->get()") - @Native("java", "#0.get()") - public native safe def get():T!; + public native def this(); - @Native("c++", "(#0)->get()") - @Native("java", "#0.get()") - public native safe def apply():T!; + /** + * @return the object mapped to the handle at the current place + */ + public native safe def apply():T!; - @Native("c++", "(#0)->hashCode()") - @Native("java", "#0.hashCode()") - public native safe def hashCode():int; + // TODO: make everyone use apply() instead + public safe def get():T! = apply(); - @Native("c++", "(#0)->toString()") - @Native("java", "#0.toString()") - public global safe native def toString():String; + // Only to be used by create methods in PlaceLocalStorage + public native def set(newVal:T!):void; - // Only to be used by create methods in PlaceLocalStorage - @Native("c++", "(#0)->set(#1)") - @Native("java", "#0.set(#1)") - native def set(newVal:T!):void; + // Only to be used by create methods in PlaceLocalStorage + static def createHandle[T]():PlaceLocalHandle[T] = PlaceLocalHandle[T](); - // Only to be used by create methods in PlaceLocalStorage - @Native("c++", "x10::lang::PlaceLocalHandle<#1 >::createHandle()") - @Native("java", "x10.runtime.impl.java.PlaceLocalHandle.createHandle()") - static native def createHandle[T]():PlaceLocalHandle[T]; + public native safe def hashCode():int; + public global safe native def toString():String; - @Native("java", "x10.lang.System.copyTo(#0,#1,#2,#3)") - @Native("c++", "x10::lang::System::copyTo(#0,#1,#2,#3)") - public native def copyTo (dst:Place, len:Int, notifier:()=>Void) : Void; - + // TODO: fix guard and cast + public def copyTo[U](dst:Place, len:Int, notifier:()=>Void)/* {T<:Rail[U]} */:Void { + x10.lang.System.copyTo[U](this as Any as PlaceLocalHandle[Rail[U]], dst, len, notifier); + } } // vim:shiftwidth=4:tabstop=4:expandtab This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |