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

Stack overflow logic is incomplete in template interpreter

    Details

    • Subcomponent:
    • CPU:
      generic

      Description

      When the interpreter checks if there's enough free stack space to
      executed the method being invoked, it doesn't take account the
      biggest execution stack of the method (method->max_stack()).

      InterpreterGenerator::generate_stack_overflow_check() verifies
      that there's enough space for:
         - space for extra locals (non argument local variables)
         - monitor space
         - fixed frame header

      AbstractInterpreterGenerator::bang_stack_shadow_pages() verifies
      that there's at least StackShadowPages available.

      But no there's no test considering the execution stack used
      by the interpreter while executing the method.

      It might be possible to generate a valid method with a huge
      execution stack, that passes the interpreter checks but hits the
      Yellow zone during its execution.

      Even worse, the stack banging is also wrong, because it starts
      from the current SP, when the frame has an empty execution stack.
      So, what the current code is doing is to ensure that there's
      at least StackShadowPages*os::vm_page_size() - method->max_stack()
      free space (rounded at page granularity) to execute VM code.
      If method->max_stack() becomes huge, the real stack space available
      for the VM can be much less than StackShadowPages.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fparain Frederic Parain
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: