United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6674617 : languages with dynamically typed numbers need more efficient autoboxing

Details
Type:
Enhancement
Submit Date:
2008-03-12
Status:
Open
Updated Date:
2014-01-16
Project Name:
JDK
Resolved Date:
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Unresolved
Affected Versions:
7
Targeted Versions:
9

Related Reports

Sub Tasks

Description
Public discussion: http://blogs.sun.com/jrose/entry/fixnums_in_the_vm

Dynamic languages typically perform arithmetic using dynamically typed references to boxed numbers.  Language-specific implementations often use pseudo-pointers to represent a commonly used subset of numbers, with the actual bits of the pseudo-pointer carrying the value field.

The JVM should support fixnums for the sake of these languages.  It would also help some Java applications that use autoboxing.  Autoboxing occurs frequently when generic collections are used to hold integers and other primitive types.

Solution:  The Hotspot JVM can cleanly represent fixnums and other immediate data types by modifying the 'oop' type to include 'pseudo-oops'.  (Historically, 'oop' stands for 'ordinary object pointer'.  So this RFE is about non-oop oops.)

Implementation tactic:  Divide the machine word into an implementation-defined set of three fields, tag, klass, and value.  The sizes of these are implementation-dependent, but on 32-bit systems the tag is generally 1-3 bits, the klass 0-5 bits, and the value 24-31 bits.  On 64-bit machines, the klass may in fact be a restricted pointer value (31 bits or so), with klass and tag sharing one 32-bit subword and the value in the other.

                                    

Comments



Hardware and Software, Engineered to Work Together