From: <mt...@us...> - 2010-09-20 06:35:23
|
Revision: 16574 http://x10.svn.sourceforge.net/x10/?rev=16574&view=rev Author: mtake Date: 2010-09-20 06:35:16 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Fix for XTENLANG-1832 Modified Paths: -------------- trunk/x10.compiler/src/x10/emitter/Emitter.java trunk/x10.runtime/src-java/x10/rtt/Types.java Modified: trunk/x10.compiler/src/x10/emitter/Emitter.java =================================================================== --- trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-20 03:47:34 UTC (rev 16573) +++ trunk/x10.compiler/src/x10/emitter/Emitter.java 2010-09-20 06:35:16 UTC (rev 16574) @@ -2017,18 +2017,22 @@ public void generateRTTInstance(X10ClassDef def) { - String unsignedClassName = null; + boolean isUnsignedType = isUnsignedClassType(def.asType()); + String unsignedClassName = null; - if (isUnsignedClassType(def.asType())) { + if (isUnsignedType) { unsignedClassName = def.asType().name().toString(); - w.write("public static final x10.rtt."+unsignedClassName+"Type"); - } else { + } + +// if (isUnsignedType) { +// w.write("public static final x10.rtt."+unsignedClassName+"Type"); +// } else { w.write("public static final x10.rtt.RuntimeType"); - } +// } w.write("<"); printType(def.asType(), X10PrettyPrinterVisitor.BOX_PRIMITIVES | X10PrettyPrinterVisitor.NO_QUALIFIER); w.write(">"); - if (isUnsignedClassType(def.asType())) { + if (isUnsignedType) { w.write(" _RTT = new x10.rtt."+unsignedClassName+"Type"); } else { w.write(" _RTT = new x10.rtt.RuntimeType"); @@ -2084,19 +2088,12 @@ w.write("};"); w.newline(); - if (isUnsignedClassType(def.asType())) { - w.write("static {"); - w.write("x10.rtt.Types."+unsignedClassName.toUpperCase()+" = _RTT;"); - w.write("}"); - w.newline(); - } - if (!def.flags().isInterface()) { - if (isUnsignedClassType(def.asType())) { - w.write("public x10.rtt."+unsignedClassName+"Type<"+unsignedClassName+"> getRTT() {"); - } else { +// if (isUnsignedType) { +// w.write("public x10.rtt."+unsignedClassName+"Type<"+unsignedClassName+"> getRTT() {"); +// } else { w.write("public x10.rtt.RuntimeType<?> getRTT() {"); - } +// } w.write("return _RTT;"); w.write("}"); w.newline(); Modified: trunk/x10.runtime/src-java/x10/rtt/Types.java =================================================================== --- trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-09-20 03:47:34 UTC (rev 16573) +++ trunk/x10.runtime/src-java/x10/rtt/Types.java 2010-09-20 06:35:16 UTC (rev 16574) @@ -161,10 +161,28 @@ }; public static Type<Object> ANY = new RuntimeType<Object>(Object.class); - public static Type<?> UBYTE; // instance created and set in UByte static initializer - public static Type<?> USHORT; // instance created and set in UShort static initializer - public static Type<?> UINT; // instance created and set in UInt static initializer - public static Type<?> ULONG; // instance created and set in ULong static initializer + public static Type<?> UBYTE; + public static Type<?> USHORT; + public static Type<?> UINT; + public static Type<?> ULONG; + static { + try { + Class<?> c; + java.lang.reflect.Field f; + c = Class.forName("x10.lang.UByte"); + f = c.getDeclaredField("_RTT"); + UBYTE = (RuntimeType<?>) f.get(null); + c = Class.forName("x10.lang.UShort"); + f = c.getDeclaredField("_RTT"); + USHORT = (RuntimeType<?>) f.get(null); + c = Class.forName("x10.lang.UInt"); + f = c.getDeclaredField("_RTT"); + UINT = (RuntimeType<?>) f.get(null); + c = Class.forName("x10.lang.ULong"); + f = c.getDeclaredField("_RTT"); + ULONG = (RuntimeType<?>) f.get(null); + } catch (Exception e) {} + } public static Type<?> getNativeRepRTT(Object o) { if (o instanceof Boolean) return BOOLEAN; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |