6964458: Reimplement class meta-data storage to use native memory

Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes

Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
This commit is contained in:
Jon Masamitsu 2012-09-01 13:25:18 -04:00 committed by Coleen Phillimore
parent 36eee7c8c8
commit 5c58d27aac
853 changed files with 26124 additions and 82956 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -31,8 +31,8 @@
#include "interpreter/interpreterGenerator.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "oops/arrayOop.hpp"
#include "oops/methodDataOop.hpp"
#include "oops/methodOop.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
@ -65,7 +65,7 @@
CALL_VM_NOCHECK_NOFIX(func) \
fixup_after_potential_safepoint()
int CppInterpreter::normal_entry(methodOop method, intptr_t UNUSED, TRAPS) {
int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
// Allocate and initialize our frame.
@ -90,7 +90,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
methodOop method = istate->method();
Method* method = istate->method();
intptr_t *result = NULL;
int result_slots = 0;
@ -114,7 +114,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
// Examine the message from the interpreter to decide what to do
if (istate->msg() == BytecodeInterpreter::call_method) {
methodOop callee = istate->callee();
Method* callee = istate->callee();
// Trim back the stack to put the parameters at the top
stack->set_sp(istate->stack() + 1);
@ -215,7 +215,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
stack->push(result[-i]);
}
int CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
// Make sure method is native and not abstract
assert(method->is_native() && !method->is_abstract(), "should be");
@ -485,7 +485,7 @@ int CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
return 0;
}
int CppInterpreter::accessor_entry(methodOop method, intptr_t UNUSED, TRAPS) {
int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
intptr_t *locals = stack->sp();
@ -518,7 +518,7 @@ int CppInterpreter::accessor_entry(methodOop method, intptr_t UNUSED, TRAPS) {
// Get the entry from the constant pool cache, and drop into
// the slow path if it has not been resolved
constantPoolCacheOop cache = method->constants()->cache();
ConstantPoolCache* cache = method->constants()->cache();
ConstantPoolCacheEntry* entry = cache->entry_at(index);
if (!entry->is_resolved(Bytecodes::_getfield)) {
return normal_entry(method, 0, THREAD);
@ -613,7 +613,7 @@ int CppInterpreter::accessor_entry(methodOop method, intptr_t UNUSED, TRAPS) {
return 0;
}
int CppInterpreter::empty_entry(methodOop method, intptr_t UNUSED, TRAPS) {
int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
@ -629,7 +629,7 @@ int CppInterpreter::empty_entry(methodOop method, intptr_t UNUSED, TRAPS) {
return 0;
}
int CppInterpreter::method_handle_entry(methodOop method,
int CppInterpreter::method_handle_entry(Method* method,
intptr_t UNUSED, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
@ -737,7 +737,7 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
MethodHandles::EntryKind entry_kind =
(MethodHandles::EntryKind) (((intptr_t) entry) & 0xffffffff);
methodOop method = NULL;
Method* method = NULL;
switch (entry_kind) {
case MethodHandles::_invokestatic_mh:
direct_to_method = true;
@ -761,13 +761,13 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
}
if (entry_kind != MethodHandles::_invokespecial_mh) {
intptr_t index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
instanceKlass* rcvrKlass =
(instanceKlass *) receiver->klass()->klass_part();
InstanceKlass* rcvrKlass =
(InstanceKlass *) receiver->klass();
if (entry_kind == MethodHandles::_invokevirtual_mh) {
method = (methodOop) rcvrKlass->start_of_vtable()[index];
method = (Method*) rcvrKlass->start_of_vtable()[index];
}
else {
oop iclass = java_lang_invoke_MethodHandle::vmtarget(method_handle);
oop iclass = java_lang_invoke_MethodHandle::next_target(method_handle);
itableOffsetEntry* ki =
(itableOffsetEntry *) rcvrKlass->start_of_itable();
int i, length = rcvrKlass->itable_length();
@ -873,7 +873,7 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
case MethodHandles::_adapter_retype_only:
case MethodHandles::_adapter_retype_raw:
src_rtype = result_type_of_handle(
java_lang_invoke_MethodHandle::vmtarget(method_handle));
java_lang_invoke_MethodHandle::next_target(method_handle));
dst_rtype = result_type_of_handle(method_handle);
break;
@ -883,12 +883,12 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
oop arg = VMSLOTS_OBJECT(arg_slot);
if (arg != NULL) {
klassOop objKlassOop = arg->klass();
klassOop klassOf = java_lang_Class::as_klassOop(
Klass* objKlassOop = arg->klass();
Klass* klassOf = java_lang_Class::as_Klass(
java_lang_invoke_AdapterMethodHandle::argument(method_handle));
if (objKlassOop != klassOf &&
!objKlassOop->klass_part()->is_subtype_of(klassOf)) {
!objKlassOop->is_subtype_of(klassOf)) {
ResourceMark rm(THREAD);
const char* objName = Klass::cast(objKlassOop)->external_name();
const char* klassName = Klass::cast(klassOf)->external_name();
@ -1089,14 +1089,14 @@ void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
if (direct_to_method) {
if (method == NULL) {
method =
(methodOop) java_lang_invoke_MethodHandle::vmtarget(method_handle);
(Method*) java_lang_invoke_MethodHandle::vmtarget(method_handle);
}
address entry_point = method->from_interpreted_entry();
Interpreter::invoke_method(method, entry_point, THREAD);
}
else {
process_method_handle(
java_lang_invoke_MethodHandle::vmtarget(method_handle), THREAD);
java_lang_invoke_MethodHandle::next_target(method_handle), THREAD);
}
// NB all oops now trashed
@ -1172,7 +1172,7 @@ void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
oop return_type = java_lang_invoke_MethodType::rtype(method_type);
return java_lang_Class::as_BasicType(return_type, (klassOop *) NULL);
return java_lang_Class::as_BasicType(return_type, (Klass* *) NULL);
}
intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
@ -1189,7 +1189,7 @@ IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
THROW_MSG(name, message);
IRT_END
InterpreterFrame *InterpreterFrame::build(const methodOop method, TRAPS) {
InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
@ -1285,7 +1285,7 @@ int AbstractInterpreter::BasicType_as_index(BasicType type) {
return i;
}
BasicType CppInterpreter::result_type_of(methodOop method) {
BasicType CppInterpreter::result_type_of(Method* method) {
BasicType t;
switch (method->result_index()) {
case 0 : t = T_BOOLEAN; break;
@ -1440,7 +1440,7 @@ InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
return (InterpreterFrame *) fp;
}
int AbstractInterpreter::layout_activation(methodOop method,
int AbstractInterpreter::layout_activation(Method* method,
int tempcount,
int popframe_extra_args,
int moncount,
@ -1496,7 +1496,7 @@ int AbstractInterpreter::layout_activation(methodOop method,
void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
frame* caller,
frame* current,
methodOop method,
Method* method,
intptr_t* locals,
intptr_t* stack,
intptr_t* stack_base,
@ -1539,7 +1539,7 @@ address CppInterpreter::deopt_entry(TosState state, int length) {
// Helper for (runtime) stack overflow checks
int AbstractInterpreter::size_top_interpreter_activation(methodOop method) {
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
return 0;
}