< prev index next >

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

Print this page

1927         //   - klass can be fastpath allocated (e.g. does not have finalizer)
1928         //   - TLAB accepts the allocation
1929         ConstantPool* constants = istate->method()->constants();
1930         if (UseTLAB && !constants->tag_at(index).is_unresolved_klass()) {
1931           Klass* entry = constants->resolved_klass_at(index);
1932           InstanceKlass* ik = InstanceKlass::cast(entry);
1933           if (ik->is_initialized() && ik->can_be_fastpath_allocated()) {
1934             size_t obj_size = ik->size_helper();
1935             HeapWord* result = THREAD->tlab().allocate(obj_size);
1936             if (result != NULL) {
1937               // Initialize object field block:
1938               //   - if TLAB is pre-zeroed, we can skip this path
1939               //   - in debug mode, ThreadLocalAllocBuffer::allocate mangles
1940               //     this area, and we still need to initialize it
1941               if (DEBUG_ONLY(true ||) !ZeroTLAB) {
1942                 size_t hdr_size = oopDesc::header_size();
1943                 Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
1944               }
1945 
1946               // Initialize header, mirrors MemAllocator.



1947               oopDesc::set_mark(result, markWord::prototype());
1948               oopDesc::set_klass_gap(result, 0);
1949               oopDesc::release_set_klass(result, ik);
1950 
1951               oop obj = cast_to_oop(result);
1952 
1953               // Must prevent reordering of stores for object initialization
1954               // with stores that publish the new object.
1955               OrderAccess::storestore();
1956               SET_STACK_OBJECT(obj, 0);
1957               UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1958             }
1959           }
1960         }
1961         // Slow case allocation
1962         CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
1963                 handle_exception);
1964         // Must prevent reordering of stores for object initialization
1965         // with stores that publish the new object.
1966         OrderAccess::storestore();
1967         SET_STACK_OBJECT(THREAD->vm_result(), 0);
1968         THREAD->set_vm_result(NULL);
1969         UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1970       }

1927         //   - klass can be fastpath allocated (e.g. does not have finalizer)
1928         //   - TLAB accepts the allocation
1929         ConstantPool* constants = istate->method()->constants();
1930         if (UseTLAB && !constants->tag_at(index).is_unresolved_klass()) {
1931           Klass* entry = constants->resolved_klass_at(index);
1932           InstanceKlass* ik = InstanceKlass::cast(entry);
1933           if (ik->is_initialized() && ik->can_be_fastpath_allocated()) {
1934             size_t obj_size = ik->size_helper();
1935             HeapWord* result = THREAD->tlab().allocate(obj_size);
1936             if (result != NULL) {
1937               // Initialize object field block:
1938               //   - if TLAB is pre-zeroed, we can skip this path
1939               //   - in debug mode, ThreadLocalAllocBuffer::allocate mangles
1940               //     this area, and we still need to initialize it
1941               if (DEBUG_ONLY(true ||) !ZeroTLAB) {
1942                 size_t hdr_size = oopDesc::header_size();
1943                 Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
1944               }
1945 
1946               // Initialize header, mirrors MemAllocator.
1947 #ifdef _LP64
1948               oopDesc::release_set_mark(result, ik->prototype_header());
1949 #else
1950               oopDesc::set_mark(result, markWord::prototype());

1951               oopDesc::release_set_klass(result, ik);
1952 #endif
1953               oop obj = cast_to_oop(result);
1954 
1955               // Must prevent reordering of stores for object initialization
1956               // with stores that publish the new object.
1957               OrderAccess::storestore();
1958               SET_STACK_OBJECT(obj, 0);
1959               UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1960             }
1961           }
1962         }
1963         // Slow case allocation
1964         CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index),
1965                 handle_exception);
1966         // Must prevent reordering of stores for object initialization
1967         // with stores that publish the new object.
1968         OrderAccess::storestore();
1969         SET_STACK_OBJECT(THREAD->vm_result(), 0);
1970         THREAD->set_vm_result(NULL);
1971         UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1);
1972       }
< prev index next >