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

Loom: Stack chunks allocation code uses TLABs even when TLABs are disabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 20
    • 19, 20
    • hotspot
    • None
    • gc
    • b26

    Description

      Look at this code in `Freeze<ConfigT>::allocate_chunk`:

      ```
        StackChunkAllocator allocator(klass, size_in_words, stack_size, current);
        oop fast_oop = allocator.try_allocate_in_existing_tlab();
      ```

      ...it calls:

      ```
      oop MemAllocator::try_allocate_in_existing_tlab() {
        oop obj = NULL;
        {
          HeapWord* mem = allocate_inside_tlab_fast();
          ...
        }
        return obj;
      }

      HeapWord* MemAllocator::allocate_inside_tlab_fast() const {
        return _thread->tlab().allocate(_word_size);
      }
      ```

      ...without checking for `UseTLAB`. If you reach to `_thread->tlab()` when TLABs are disabled, then you would get into the uncomfortable territory of dealing with uninitialized TLABs, because it initialization is predicated on `UseTLAB` itself:

      ```
      void Thread::initialize_tlab() {
        if (UseTLAB) {
          tlab().initialize();
        }
      }
      ```

      This also disallows quickly testing the allocation slowpaths in Loom code.

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: