JDK-6674617 : Languages with dynamically typed numbers need more efficient autoboxing
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7,9,10
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2008-03-12
  • Updated: 2017-04-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
Public discussion: https://blogs.oracle.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.