RFR (L) 8037210: Get rid of char-based descriptions 'J' of basic types (original) (raw)
Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Mar 26 15:01:41 UTC 2014
- Previous message: RFR (L) 8037210: Get rid of char-based descriptions 'J' of basic types
- Next message: [9] RFR (M): 8037209: Improvements and cleanups to bytecode assembly for lambda forms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Here's a version with the new naming scheme: http://cr.openjdk.java.net/~vlivanov/8037210/webrev.03.naming
I like existing naming scheme and OBJECT/VOID/LONG/etc names are quite popular(e.g. Wrapper & ASM (Opcodes) use them). So, I'm in favor of leaving it as is.
Best regards, Vladimir Ivanov
On 3/26/14 12:24 AM, Christian Thalinger wrote:
+ enum BasicType { + LTYPE('L', Object.class, Wrapper.OBJECT), // all reference types + ITYPE('I', int.class, Wrapper.INT), + JTYPE('J', long.class, Wrapper.LONG), + FTYPE('F', float.class, Wrapper.FLOAT), + DTYPE('D', double.class, Wrapper.DOUBLE), // all primitive types + VTYPE('V', void.class, Wrapper.VOID); // not valid in all contexts
I would suggest to not name them XTYPE but give them meaningful names like Int, Float, Void. The enum BasicType already infers that it’s a type. If you think it’s not clear that it’s a type just use BasicType.Double in that places. On Mar 24, 2014, at 9:29 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
Updated version: http://cr.openjdk.java.net/~vlivanov/8037210/webrev.03/
- changed the way how arrays of types are created: static final BasicType[] ALLTYPES = BasicType.values(); static final BasicType[] ARGTYPES = Arrays.copyOf(ALLTYPES, ALLTYPES.length-1); - added a test for BasicType (LambdaFormTest.testBasicType). Best regards, Vladimir Ivanov On 3/22/14 2:08 AM, Vladimir Ivanov wrote: John, thanks for the feedback.
Updated webrev: http://cr.openjdk.java.net/~vlivanov/8037210/webrev.02 Also moved LambdaForm.testShortenSignature() into a stand-alone unit test. Best regards, Vladimir Ivanov On 3/21/14 10:54 PM, John Rose wrote: On Mar 21, 2014, at 8:49 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com <mailto:vladimir.x.ivanov at oracle.com>> wrote:
Thanks for the feedback.
What do you think about the following: http://cr.openjdk.java.net/~vlivanov/8037210/webrev.01/ That looks nice. Strong typing; who woulda' thunk it. :-) The uses of ".ordinal()" are the extra cost relative to using just small integers. They seem totally reasonable in the code. I suggest either wrapping "ordinal" as something like "id" or else changing temp names like "id" to "ord", to reinforce the use of a common name. Don't make the enum class public. And especially don't make the mutable arrays public: + public static final BasicType[] ALLTYPES = { LTYPE, ITYPE, JTYPE, FTYPE, DTYPE, VTYPE }; + public static final BasicType[] ARGTYPES = { LTYPE, ITYPE, JTYPE, FTYPE, DTYPE }; — John P.S. That would only be safe if we had (what we don't yet) a notion of frozen arrays like: + public static final BasicType final[] ALLTYPES = { LTYPE, ITYPE, JTYPE, FTYPE, DTYPE, VTYPE }; + public static final BasicType final[] ARGTYPES = { LTYPE, ITYPE, JTYPE, FTYPE, DTYPE };
mlvm-dev mailing list mlvm-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
mlvm-dev mailing list mlvm-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
mlvm-dev mailing list mlvm-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
- Previous message: RFR (L) 8037210: Get rid of char-based descriptions 'J' of basic types
- Next message: [9] RFR (M): 8037209: Improvements and cleanups to bytecode assembly for lambda forms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]