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

Add OSInfo API for static OS information

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b11

      Many APIs in the "os" class (e.g, os::vm_page_size()) return information about the OS that's collected during VM bootstrap and never changes afterwards.

      Add a new OSInfo API to access such information efficiently, and simplify the per-OS implementation:

      class OSInfo : AllStatic {
        static int _vm_page_size;
        static int _vm_allocation_granularity;
        [... more ...]

      public:
        // Returns the byte size of a virtual memory page
        static int vm_page_size() { return _vm_page_size; }

        // Returns the size in bytes of memory blocks which can be allocated.
        static int vm_allocation_granularity() { return _vm_allocation_granularity; }

         static void set_vm_page_size(int n) {
          assert(_vm_page_size < 0, "init only once");
          assert(n > 0, "sanity");
          _vm_page_size = n;
        }

        static void set_vm_allocation_granularity(int n) {
          assert(_vm_allocation_granularity < 0, "init only once");
          assert(n > 0, "sanity");
          _vm_allocation_granularity = n;
        }

         [... more ...]

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: