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

Evaluate if the large value for DEFAULT_STACK_SHADOW_PAGES is still necessary

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot

      I happened to notice the following in globals_aarch64.hpp https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/globals_aarch64.hpp#L47 :

      // Java_java_net_SocketOutputStream_socketWrite0() uses a 64k buffer on the
      // stack if compiled for unix and LP64. To pass stack overflow tests we need
      // 20 shadow pages.
      #define DEFAULT_STACK_SHADOW_PAGES (20 DEBUG_ONLY(+5))

      The same #define is present for other platforms too.

      The comment there notes that this value is higher to accomodate the implementation of Java_java_net_SocketOutputStream_socketWrite0() function which (used to) allocate a very large buffer on the stack. That value for DEFAULT_STACK_SHADOW_PAGES for aarch64 was done as part of https://bugs.openjdk.org/browse/JDK-8173339 (RFR https://mail.openjdk.org/pipermail/aarch64-port-dev/2017-January/004163.html ). But this issue isn't aarch64 specific - other platforms too are using this same value.

      The Java_java_net_SocketOutputStream_socketWrite0() function no longer exists in mainline. It would be good to reevaluate this default value and determine if such a large value (for several platforms) is still necessary either due to some other existing functions allocating such large buffers or due to some code relying on this larger default value.

            Unassigned Unassigned
            jpai Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: