diff -r dd47cf4734f2 -r c32a0cc19877 hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp --- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jan 20 16:33:51 2016 +0100 +++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jan 20 14:22:46 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -489,7 +489,6 @@ if (result != JVMCIEnv::ok) { return result; } - process_exception_handlers(); _debug_recorder->pcs_size(); // ehm, create the sentinel record @@ -523,7 +522,6 @@ if (result != JVMCIEnv::ok) { return result; } - process_exception_handlers(); int stack_slots = _total_frame_size / HeapWordSize; // conversion to words @@ -574,7 +572,6 @@ _parameter_count = 0; } _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code)); - _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code)); _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code)); _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code); @@ -608,8 +605,8 @@ objArrayOop sites = this->sites(); for (int i = 0; i < sites->length(); i++) { oop site = sites->obj_at(i); - if (site != NULL && site->is_a(CompilationResult_Mark::klass())) { - oop id_obj = CompilationResult_Mark::id(site); + if (site != NULL && site->is_a(site_Mark::klass())) { + oop id_obj = site_Mark::id(site); if (id_obj != NULL) { if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) { JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name()); @@ -669,18 +666,18 @@ if (patch.is_null()) { THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); } - Handle reference = CompilationResult_DataPatch::reference(patch); + Handle reference = site_DataPatch::reference(patch); if (reference.is_null()) { THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); } - if (!reference->is_a(CompilationResult_ConstantReference::klass())) { + if (!reference->is_a(site_ConstantReference::klass())) { JVMCI_ERROR_OK("invalid patch in data section: %s", reference->klass()->signature_name()); } - Handle constant = CompilationResult_ConstantReference::constant(reference); + Handle constant = site_ConstantReference::constant(reference); if (constant.is_null()) { THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); } - address dest = _constants->start() + CompilationResult_Site::pcOffset(patch); + address dest = _constants->start() + site_Site::pcOffset(patch); if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { if (HotSpotMetaspaceConstantImpl::compressed(constant)) { #ifdef _LP64 @@ -716,27 +713,30 @@ THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok); } - jint pc_offset = CompilationResult_Site::pcOffset(site); + jint pc_offset = site_Site::pcOffset(site); - if (site->is_a(CompilationResult_Call::klass())) { + if (site->is_a(site_Call::klass())) { TRACE_jvmci_4("call at %i", pc_offset); site_Call(buffer, pc_offset, site, CHECK_OK); - } else if (site->is_a(CompilationResult_Infopoint::klass())) { + } else if (site->is_a(site_Infopoint::klass())) { // three reasons for infopoints denote actual safepoints - oop reason = CompilationResult_Infopoint::reason(site); - if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) { + oop reason = site_Infopoint::reason(site); + if (site_InfopointReason::SAFEPOINT() == reason || site_InfopointReason::CALL() == reason || site_InfopointReason::IMPLICIT_EXCEPTION() == reason) { TRACE_jvmci_4("safepoint at %i", pc_offset); site_Safepoint(buffer, pc_offset, site, CHECK_OK); } else { TRACE_jvmci_4("infopoint at %i", pc_offset); site_Infopoint(buffer, pc_offset, site, CHECK_OK); } - } else if (site->is_a(CompilationResult_DataPatch::klass())) { + } else if (site->is_a(site_DataPatch::klass())) { TRACE_jvmci_4("datapatch at %i", pc_offset); site_DataPatch(buffer, pc_offset, site, CHECK_OK); - } else if (site->is_a(CompilationResult_Mark::klass())) { + } else if (site->is_a(site_Mark::klass())) { TRACE_jvmci_4("mark at %i", pc_offset); site_Mark(buffer, pc_offset, site, CHECK_OK); + } else if (site->is_a(site_ExceptionHandler::klass())) { + TRACE_jvmci_4("exceptionhandler at %i", pc_offset); + site_ExceptionHandler(pc_offset, site); } else { JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name()); } @@ -802,21 +802,14 @@ _dependencies->assert_call_site_target_value(callSite(), methodHandle()); } -void CodeInstaller::process_exception_handlers() { - if (exception_handlers() != NULL) { - objArrayOop handlers = exception_handlers(); - for (int i = 0; i < handlers->length(); i++) { - oop exc = handlers->obj_at(i); - jint pc_offset = CompilationResult_Site::pcOffset(exc); - jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); +void CodeInstaller::site_ExceptionHandler(jint pc_offset, Handle exc) { + jint handler_offset = site_ExceptionHandler::handlerPos(exc); - // Subtable header - _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); + // Subtable header + _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); - // Subtable entry - _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0)); - } - } + // Subtable entry + _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0)); } // If deoptimization happens, the interpreter should reexecute these bytecodes. @@ -988,7 +981,7 @@ } void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { - Handle debug_info = CompilationResult_Infopoint::debugInfo(site); + Handle debug_info = site_Infopoint::debugInfo(site); if (debug_info.is_null()) { JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset); } @@ -1002,7 +995,7 @@ } void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { - Handle debug_info = CompilationResult_Infopoint::debugInfo(site); + Handle debug_info = site_Infopoint::debugInfo(site); if (debug_info.is_null()) { JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset); } @@ -1017,7 +1010,7 @@ } void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { - Handle target = CompilationResult_Call::target(site); + Handle target = site_Call::target(site); InstanceKlass* target_klass = InstanceKlass::cast(target->klass()); Handle hotspot_method; // JavaMethod @@ -1029,7 +1022,7 @@ hotspot_method = target; } - Handle debug_info = CompilationResult_Call::debugInfo(site); + Handle debug_info = site_Call::debugInfo(site); assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type"); @@ -1066,11 +1059,11 @@ } void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { - Handle reference = CompilationResult_DataPatch::reference(site); + Handle reference = site_DataPatch::reference(site); if (reference.is_null()) { THROW(vmSymbols::java_lang_NullPointerException()); - } else if (reference->is_a(CompilationResult_ConstantReference::klass())) { - Handle constant = CompilationResult_ConstantReference::constant(reference); + } else if (reference->is_a(site_ConstantReference::klass())) { + Handle constant = site_ConstantReference::constant(reference); if (constant.is_null()) { THROW(vmSymbols::java_lang_NullPointerException()); } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { @@ -1080,8 +1073,8 @@ } else { JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name()); } - } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) { - int data_offset = CompilationResult_DataSectionReference::offset(reference); + } else if (reference->is_a(site_DataSectionReference::klass())) { + int data_offset = site_DataSectionReference::offset(reference); if (0 <= data_offset && data_offset < _constants_size) { pd_patch_DataSectionReference(pc_offset, data_offset); } else { @@ -1093,7 +1086,7 @@ } void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) { - Handle id_obj = CompilationResult_Mark::id(site); + Handle id_obj = site_Mark::id(site); if (id_obj.not_null()) { if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) {