Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8028128

Add a type safe alternative for working with counter based data

    Details

    • Subcomponent:
      svc
    • Resolved In Build:
      b119
    • Verification:
      Not verified

      Backports

        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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mgronlun Markus Grönlund
                  Reporter:
                  mgronlun Markus Grönlund
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: