JDK-8028128 : Add a type safe alternative for working with counter based data
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-11-11
  • Updated: 2014-01-14
  • Resolved: 2013-11-25
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 7 JDK 8 Other
7u60Fixed 8 b119Fixed hs25Fixed
Currently, when working with counter based data, the primary data type representation in the VM are raw jlong's. jlong's are employed to represent both:

1. a single instance in time, for example a "now" timestamp
2. a time duration, a timespan, for example the duration between "now" - "then"

Having a raw jlong type represent both of these shifts the responsibility to the programmer to always ensure the correct, without any assistance either at compile or at runtime.

The event based tracing framework relies heavily on counter based data in order to keep track of time and timing related information and we have seen counter data errors where the representation sent to the tracing framework has submitted the wrong time, i.e. a timespan when a time instant was expected and vice versa.

We should therefore add an alternative to jlongs for representing counter based data. We should enlist the help of the type system to enforce the correct data types at compile time as well as introduce strong runtime asserts in order to reduce the number of potential bugs.

I will therefore add two new type's in src/share/vm/utilities:

1. "Ticks" - represents a single counter based timestamp.
2. "Tickspan" - represents a counter based duration, a timespan, between two "Ticks"

I will also update the existing event based tracing "event sites" to employ the stronger types.

7u60-critical-request-justification: backport this from JDK8 to 7u60. Thanks Markus


Release team: Approved for fixing