void TemplateInterpreter::initialize() { if (_code != NULL) return; // assertions assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length, "dispatch table too small"); AbstractInterpreter::initialize(); TemplateTable::initialize(); // generate interpreter { ResourceMark rm; TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime)); int code_size = InterpreterCodeSize; NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space #if INCLUDE_JVMTI if (CodeCacheExtensions::saving_generated_interpreter()) { // May requires several versions of the codelets. // Final size will automatically be optimized. code_size *= 2; } #endif _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL, "Interpreter"); TemplateInterpreterGenerator g(_code); }
void StubRoutines::initialize1() { if (_code1 == NULL) { ResourceMark rm; TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime)); _code1 = BufferBlob::create("StubRoutines (1)", code_size1); if (_code1 == NULL) { vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)"); } CodeBuffer buffer(_code1); StubGenerator_generate(&buffer, false); // When new stubs added we need to make sure there is some space left // to catch situation when we should increase size again. assert(code_size1 == 0 || buffer.insts_remaining() > 200, "increase code_size1"); } }
void TemplateInterpreter::initialize() { if (_code != NULL) return; // assertions assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length, "dispatch table too small"); AbstractInterpreter::initialize(); TemplateTable::initialize(); // generate interpreter { ResourceMark rm; TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime)); int code_size = InterpreterCodeSize; NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL, "Interpreter"); TemplateInterpreterGenerator g(_code); }
void StubRoutines::initialize2() { if (_code2 == NULL) { ResourceMark rm; TraceTime timer("StubRoutines generation 2", TRACETIME_LOG(Info, startuptime)); _code2 = BufferBlob::create("StubRoutines (2)", code_size2); if (_code2 == NULL) { vm_exit_out_of_memory(code_size2, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (2)"); } CodeBuffer buffer(_code2); StubGenerator_generate(&buffer, true); // When new stubs added we need to make sure there is some space left // to catch situation when we should increase size again. assert(code_size2 == 0 || buffer.insts_remaining() > 200, "increase code_size2"); } #ifdef ASSERT #define TEST_ARRAYCOPY(type) \ test_arraycopy_func( type##_arraycopy(), sizeof(type)); \ test_arraycopy_func( type##_disjoint_arraycopy(), sizeof(type)); \ test_arraycopy_func(arrayof_##type##_arraycopy(), sizeof(HeapWord)); \ test_arraycopy_func(arrayof_##type##_disjoint_arraycopy(), sizeof(HeapWord)) // Make sure all the arraycopy stubs properly handle zero count TEST_ARRAYCOPY(jbyte); TEST_ARRAYCOPY(jshort); TEST_ARRAYCOPY(jint); TEST_ARRAYCOPY(jlong); #undef TEST_ARRAYCOPY #define TEST_FILL(type) \ if (_##type##_fill != NULL) { \ union { \ double d; \ type body[96]; \ } s; \ \ int v = 32; \ for (int offset = -2; offset <= 2; offset++) { \ for (int i = 0; i < 96; i++) { \ s.body[i] = 1; \ } \ type* start = s.body + 8 + offset; \ for (int aligned = 0; aligned < 2; aligned++) { \ if (aligned) { \ if (((intptr_t)start) % HeapWordSize == 0) { \ ((void (*)(type*, int, int))StubRoutines::_arrayof_##type##_fill)(start, v, 80); \ } else { \ continue; \ } \ } else { \ ((void (*)(type*, int, int))StubRoutines::_##type##_fill)(start, v, 80); \ } \ for (int i = 0; i < 96; i++) { \ if (i < (8 + offset) || i >= (88 + offset)) { \ assert(s.body[i] == 1, "what?"); \ } else { \ assert(s.body[i] == 32, "what?"); \ } \ } \ } \ } \ } \ TEST_FILL(jbyte); TEST_FILL(jshort); TEST_FILL(jint); #undef TEST_FILL #define TEST_COPYRTN(type) \ test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::conjoint_##type##s_atomic), sizeof(type)); \ test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::arrayof_conjoint_##type##s), (int)MAX2(sizeof(HeapWord), sizeof(type))) // Make sure all the copy runtime routines properly handle zero count TEST_COPYRTN(jbyte); TEST_COPYRTN(jshort); TEST_COPYRTN(jint); TEST_COPYRTN(jlong); #undef TEST_COPYRTN test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::conjoint_words), sizeof(HeapWord)); test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::disjoint_words), sizeof(HeapWord)); test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::disjoint_words_atomic), sizeof(HeapWord)); // Aligned to BytesPerLong test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_conjoint_words), sizeof(jlong)); test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_disjoint_words), sizeof(jlong)); // test safefetch routines // Not on Windows 32bit until 8074860 is fixed #if ! (defined(_WIN32) && defined(_M_IX86)) test_safefetch32(); test_safefetchN(); #endif #endif }