Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6804523
Votes 0
Synopsis some languages and libraries must work with value tuples
Category hotspot:compiler2
Reported Against
Release Fixed
State 1-Dispatched, request for enhancement
Priority: 3-Medium
Related Bugs
Submit Date 12-FEB-2009
Description
http://blogs.sun.com/jrose/entry/tuples_in_the_vm

The Java language and VM provide a flexible  customer  model, with subclassing, interfaces, generically typed containers, and both mutable and immutable objects.  They also provide a basic set of primitive types, which map efficiently and predictably to hardware operations.

The primitive types are limited to 64 bits in size, and so cannot represent the information content of important data types, such as pixels, complex numbers, and (short-SIMD) vectors.  In addition, even if there were (say) a long-long type added, it would not be possible to program with all of those data types in a type-safe manner.

Small fixed-sized value-oriented types like vectors are called "structs" in the C family of languages.  (Note that structs do not have to be homogeneous like vectors.)  Taking a JVM-centric point of view, we may interpret this concept in the JVM as "tuples" of pre-existing supported types, the references and primitives.

The current workaround for tuples is to require the programmer to box them in either arrays (for homogeneous tuples only) or in small (often final and read-only) objects.  These workarounds are awkward to code with and do not have predictable performance models (even with escape analysis optimization).

There are additional problems due to the lack of tuples:
 - impossible to return multiple values from methods
 - impossible to build patterned heterogeneous arrays (for optimized data structures)
 - no credible numeric stack on the JVM which includes complex or transform types
 - many APIs work directly with "int" types with implicit typing, losing static checking

We propose a general solution for these problems in the form of tuple types:
 - extension to method, field, and array component signature repertoire
 - tuple types have a nominal tag for type safety (e.g., ints with units)
 - as in C, calling sequences are purely value oriented
 - there is a standard framework of wrapper classes supported by the JVM, for autoboxing conversions
Posted Date : 2009-02-12 01:06:26.0
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang