United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8028128 : Add a type safe alternative for working with counter based data

Details
Type:
Bug
Submit Date:
2013-11-11
Status:
Resolved
Updated Date:
2013-12-10
Project Name:
JDK
Resolved Date:
2013-11-25
Component:
hotspot
OS:
Sub-Component:
svc
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

Description
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.


Thanks
Markus
                                    

Comments
Release team: Approved for fixing
                                     
2013-11-21
http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/86e6d691f2e1
                                     
2013-11-25
URL:   http://hg.openjdk.java.net/jdk8/jdk8/hotspot/rev/86e6d691f2e1
User:  amurillo
Date:  2013-12-03 22:05:32 +0000

                                     
2013-12-03
7u60-critical-request-justification:

backport this from JDK8 to 7u60.

Thanks
Markus
                                     
2013-12-09



Hardware and Software, Engineered to Work Together