< prev index next >

src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp

Print this page

1982         //   - klass can be fastpath allocated (e.g. does not have finalizer)
1983         //   - TLAB accepts the allocation
1984         ConstantPool* constants = istate->method()->constants();
1985         if (UseTLAB && !constants->tag_at(index).is_unresolved_klass()) {
1986           Klass* entry = constants->resolved_klass_at(index);
1987           InstanceKlass* ik = InstanceKlass::cast(entry);
1988           if (ik->is_initialized() && ik->can_be_fastpath_allocated()) {
1989             size_t obj_size = ik->size_helper();
1990             HeapWord* result = THREAD->tlab().allocate(obj_size);
1991             if (result != nullptr) {
1992               // Initialize object field block:
1993               //   - if TLAB is pre-zeroed, we can skip this path
1994               //   - in debug mode, ThreadLocalAllocBuffer::allocate mangles
1995               //     this area, and we still need to initialize it
1996               if (DEBUG_ONLY(true ||) !ZeroTLAB) {
1997                 size_t hdr_size = oopDesc::header_size();
1998                 Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
1999               }
2000 
2001               // Initialize header, mirrors MemAllocator.
2002               oopDesc::set_mark(result, markWord::prototype());
2003               oopDesc::set_klass_gap(result, 0);
2004               oopDesc::release_set_klass(result, ik);
2005 



2006               oop obj = cast_to_oop(result);
2007 
2008               // Must prevent reordering of stores for object initialization
2009               // with stores that publish the new object.
2010               OrderAccess::storestore();
2011               SET_STACK_OBJECT(obj, 0);
2012               UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
2013             }
2014           }
2015         }
2016         // Slow case allocation
2017         CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
2018                 handle_exception);
2019         // Must prevent reordering of stores for object initialization
2020         // with stores that publish the new object.
2021         OrderAccess::storestore();
2022         SET_STACK_OBJECT(THREAD->vm_result(), 0);
2023         THREAD->set_vm_result(nullptr);
2024         UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
2025       }

1982         //   - klass can be fastpath allocated (e.g. does not have finalizer)
1983         //   - TLAB accepts the allocation
1984         ConstantPool* constants = istate->method()->constants();
1985         if (UseTLAB && !constants->tag_at(index).is_unresolved_klass()) {
1986           Klass* entry = constants->resolved_klass_at(index);
1987           InstanceKlass* ik = InstanceKlass::cast(entry);
1988           if (ik->is_initialized() && ik->can_be_fastpath_allocated()) {
1989             size_t obj_size = ik->size_helper();
1990             HeapWord* result = THREAD->tlab().allocate(obj_size);
1991             if (result != nullptr) {
1992               // Initialize object field block:
1993               //   - if TLAB is pre-zeroed, we can skip this path
1994               //   - in debug mode, ThreadLocalAllocBuffer::allocate mangles
1995               //     this area, and we still need to initialize it
1996               if (DEBUG_ONLY(true ||) !ZeroTLAB) {
1997                 size_t hdr_size = oopDesc::header_size();
1998                 Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
1999               }
2000 
2001               // Initialize header, mirrors MemAllocator.
2002               if (UseCompactObjectHeaders) {
2003                 oopDesc::release_set_mark(result, ik->prototype_header());
2004               } else {
2005                 oopDesc::set_mark(result, markWord::prototype());
2006                 oopDesc::set_klass_gap(result, 0);
2007                 oopDesc::release_set_klass(result, ik);
2008               }
2009               oop obj = cast_to_oop(result);
2010 
2011               // Must prevent reordering of stores for object initialization
2012               // with stores that publish the new object.
2013               OrderAccess::storestore();
2014               SET_STACK_OBJECT(obj, 0);
2015               UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
2016             }
2017           }
2018         }
2019         // Slow case allocation
2020         CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
2021                 handle_exception);
2022         // Must prevent reordering of stores for object initialization
2023         // with stores that publish the new object.
2024         OrderAccess::storestore();
2025         SET_STACK_OBJECT(THREAD->vm_result(), 0);
2026         THREAD->set_vm_result(nullptr);
2027         UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
2028       }
< prev index next >