2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2016-01-12 12:35:08 -05:00
|
|
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
2015-02-13 14:37:35 +01:00
|
|
|
#include "classfile/javaClasses.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "classfile/systemDictionary.hpp"
|
|
|
|
#include "classfile/vmSymbols.hpp"
|
2015-06-23 17:48:34 +02:00
|
|
|
#include "code/codeCache.hpp"
|
2015-07-01 10:53:26 +02:00
|
|
|
#include "code/codeCacheExtensions.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "compiler/compileBroker.hpp"
|
2012-11-30 15:23:16 -08:00
|
|
|
#include "compiler/disassembler.hpp"
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "gc/shared/collectedHeap.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "interpreter/interpreter.hpp"
|
|
|
|
#include "interpreter/interpreterRuntime.hpp"
|
|
|
|
#include "interpreter/linkResolver.hpp"
|
|
|
|
#include "interpreter/templateTable.hpp"
|
2015-12-22 16:29:48 -05:00
|
|
|
#include "logging/log.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "memory/oopFactory.hpp"
|
2016-04-04 12:57:48 -04:00
|
|
|
#include "memory/resourceArea.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "memory/universe.inline.hpp"
|
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
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/constantPool.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/instanceKlass.hpp"
|
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
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/methodData.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/objArrayKlass.hpp"
|
2015-02-13 14:37:35 +01:00
|
|
|
#include "oops/objArrayOop.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/oop.inline.hpp"
|
2011-01-27 16:11:27 -08:00
|
|
|
#include "oops/symbol.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "prims/jvmtiExport.hpp"
|
|
|
|
#include "prims/nativeLookup.hpp"
|
2014-06-04 11:56:44 +02:00
|
|
|
#include "runtime/atomic.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/biasedLocking.hpp"
|
|
|
|
#include "runtime/compilationPolicy.hpp"
|
|
|
|
#include "runtime/deoptimization.hpp"
|
|
|
|
#include "runtime/fieldDescriptor.hpp"
|
|
|
|
#include "runtime/handles.inline.hpp"
|
2014-07-04 11:46:01 +02:00
|
|
|
#include "runtime/icache.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/interfaceSupport.hpp"
|
|
|
|
#include "runtime/java.hpp"
|
|
|
|
#include "runtime/jfieldIDWorkaround.hpp"
|
|
|
|
#include "runtime/osThread.hpp"
|
|
|
|
#include "runtime/sharedRuntime.hpp"
|
|
|
|
#include "runtime/stubRoutines.hpp"
|
|
|
|
#include "runtime/synchronizer.hpp"
|
|
|
|
#include "runtime/threadCritical.hpp"
|
|
|
|
#include "utilities/events.hpp"
|
|
|
|
#ifdef COMPILER2
|
|
|
|
#include "opto/runtime.hpp"
|
|
|
|
#endif
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
class UnlockFlagSaver {
|
|
|
|
private:
|
|
|
|
JavaThread* _thread;
|
|
|
|
bool _do_not_unlock;
|
|
|
|
public:
|
|
|
|
UnlockFlagSaver(JavaThread* t) {
|
|
|
|
_thread = t;
|
|
|
|
_do_not_unlock = t->do_not_unlock_if_synchronized();
|
|
|
|
t->set_do_not_unlock_if_synchronized(false);
|
|
|
|
}
|
|
|
|
~UnlockFlagSaver() {
|
|
|
|
_thread->set_do_not_unlock_if_synchronized(_do_not_unlock);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// State accessors
|
|
|
|
|
|
|
|
void InterpreterRuntime::set_bcp_and_mdp(address bcp, JavaThread *thread) {
|
|
|
|
last_frame(thread).interpreter_frame_set_bcp(bcp);
|
|
|
|
if (ProfileInterpreter) {
|
|
|
|
// ProfileTraps uses MDOs independently of ProfileInterpreter.
|
|
|
|
// That is why we must check both ProfileInterpreter and mdo != NULL.
|
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
2012-09-01 13:25:18 -04:00
|
|
|
MethodData* mdo = last_frame(thread).interpreter_frame_method()->method_data();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (mdo != NULL) {
|
|
|
|
NEEDS_CLEANUP;
|
|
|
|
last_frame(thread).interpreter_frame_set_mdp(mdo->bci_to_dp(last_frame(thread).interpreter_frame_bci()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Constants
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* thread, bool wide))
|
|
|
|
// access constant pool
|
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
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPool* pool = method(thread)->constants();
|
2010-05-23 01:38:26 -07:00
|
|
|
int index = wide ? get_index_u2(thread, Bytecodes::_ldc_w) : get_index_u1(thread, Bytecodes::_ldc);
|
2007-12-01 00:00:00 +00:00
|
|
|
constantTag tag = pool->tag_at(index);
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
|
|
|
|
Klass* klass = pool->klass_at(index, CHECK);
|
2011-03-18 16:00:34 -07:00
|
|
|
oop java_class = klass->java_mirror();
|
2007-12-01 00:00:00 +00:00
|
|
|
thread->set_vm_result(java_class);
|
|
|
|
IRT_END
|
|
|
|
|
2010-06-09 18:50:45 -07:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
|
|
|
|
assert(bytecode == Bytecodes::_fast_aldc ||
|
|
|
|
bytecode == Bytecodes::_fast_aldc_w, "wrong bc");
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
methodHandle m (thread, method(thread));
|
2011-01-13 22:15:41 -08:00
|
|
|
Bytecode_loadconstant ldc(m, bci(thread));
|
2011-05-25 16:04:09 -07:00
|
|
|
oop result = ldc.resolve_constant(CHECK);
|
|
|
|
#ifdef ASSERT
|
|
|
|
{
|
|
|
|
// The bytecode wrappers aren't GC-safe so construct a new one
|
|
|
|
Bytecode_loadconstant ldc2(m, bci(thread));
|
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
2012-09-01 13:25:18 -04:00
|
|
|
oop coop = m->constants()->resolved_references()->obj_at(ldc2.cache_index());
|
|
|
|
assert(result == coop, "expected result for assembly code");
|
2011-05-25 16:04:09 -07:00
|
|
|
}
|
|
|
|
#endif
|
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
2012-09-01 13:25:18 -04:00
|
|
|
thread->set_vm_result(result);
|
2010-06-09 18:50:45 -07:00
|
|
|
}
|
|
|
|
IRT_END
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Allocation
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
|
|
|
|
Klass* k_oop = pool->klass_at(index, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
instanceKlassHandle klass (THREAD, k_oop);
|
|
|
|
|
|
|
|
// Make sure we are not instantiating an abstract klass
|
|
|
|
klass->check_valid_for_instantiation(true, CHECK);
|
|
|
|
|
|
|
|
// Make sure klass is initialized
|
|
|
|
klass->initialize(CHECK);
|
|
|
|
|
|
|
|
// At this point the class may not be fully initialized
|
|
|
|
// because of recursive initialization. If it is fully
|
|
|
|
// initialized & has_finalized is not set, we rewrite
|
|
|
|
// it into its fast version (Note: no locking is needed
|
|
|
|
// here since this is an atomic byte write and can be
|
|
|
|
// done more than once).
|
|
|
|
//
|
|
|
|
// Note: In case of classes with has_finalized we don't
|
|
|
|
// rewrite since that saves us an extra check in
|
|
|
|
// the fast version which then would call the
|
|
|
|
// slow version anyway (and do a call back into
|
|
|
|
// Java).
|
|
|
|
// If we have a breakpoint, then we don't rewrite
|
|
|
|
// because the _breakpoint bytecode would be lost.
|
|
|
|
oop obj = klass->allocate_instance(CHECK);
|
|
|
|
thread->set_vm_result(obj);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::newarray(JavaThread* thread, BasicType type, jint size))
|
|
|
|
oop obj = oopFactory::new_typeArray(type, size, CHECK);
|
|
|
|
thread->set_vm_result(obj);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::anewarray(JavaThread* thread, ConstantPool* pool, int index, jint size))
|
|
|
|
Klass* klass = pool->klass_at(index, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
|
|
|
|
thread->set_vm_result(obj);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::multianewarray(JavaThread* thread, jint* first_size_address))
|
|
|
|
// We may want to pass in more arguments - could make this slightly faster
|
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
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPool* constants = method(thread)->constants();
|
2010-05-23 01:38:26 -07:00
|
|
|
int i = get_index_u2(thread, Bytecodes::_multianewarray);
|
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
2012-09-01 13:25:18 -04:00
|
|
|
Klass* klass = constants->klass_at(i, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
int nof_dims = number_of_dimensions(thread);
|
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
2012-09-01 13:25:18 -04:00
|
|
|
assert(klass->is_klass(), "not a class");
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(nof_dims >= 1, "multianewarray rank must be nonzero");
|
|
|
|
|
|
|
|
// We must create an array of jints to pass to multi_allocate.
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
const int small_dims = 10;
|
|
|
|
jint dim_array[small_dims];
|
|
|
|
jint *dims = &dim_array[0];
|
|
|
|
if (nof_dims > small_dims) {
|
|
|
|
dims = (jint*) NEW_RESOURCE_ARRAY(jint, nof_dims);
|
|
|
|
}
|
|
|
|
for (int index = 0; index < nof_dims; index++) {
|
|
|
|
// offset from first_size_address is addressed as local[index]
|
|
|
|
int n = Interpreter::local_offset_in_bytes(index)/jintSize;
|
|
|
|
dims[index] = first_size_address[n];
|
|
|
|
}
|
2012-09-29 06:40:00 -04:00
|
|
|
oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
thread->set_vm_result(obj);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
|
|
|
|
assert(obj->is_oop(), "must be a valid oop");
|
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
2012-09-01 13:25:18 -04:00
|
|
|
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
|
|
|
|
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
// Quicken instance-of and check-cast bytecodes
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
|
|
|
|
// Force resolving; quicken the bytecode
|
2010-05-23 01:38:26 -07:00
|
|
|
int which = get_index_u2(thread, Bytecodes::_checkcast);
|
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
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPool* cpool = method(thread)->constants();
|
2007-12-01 00:00:00 +00:00
|
|
|
// We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
|
|
|
|
// program we might have seen an unquick'd bytecode in the interpreter but have another
|
|
|
|
// thread quicken the bytecode before we get here.
|
|
|
|
// assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
|
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
2012-09-01 13:25:18 -04:00
|
|
|
Klass* klass = cpool->klass_at(which, CHECK);
|
|
|
|
thread->set_vm_result_2(klass);
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Exceptions
|
|
|
|
|
2013-09-15 15:28:58 +02:00
|
|
|
void InterpreterRuntime::note_trap_inner(JavaThread* thread, int reason,
|
|
|
|
methodHandle trap_method, int trap_bci, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (trap_method.not_null()) {
|
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
2012-09-01 13:25:18 -04:00
|
|
|
MethodData* trap_mdo = trap_method->method_data();
|
|
|
|
if (trap_mdo == NULL) {
|
|
|
|
Method::build_interpreter_method_data(trap_method, THREAD);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
2013-09-15 15:28:58 +02:00
|
|
|
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())),
|
|
|
|
"we expect only an OOM error here");
|
2007-12-01 00:00:00 +00:00
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
}
|
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
2012-09-01 13:25:18 -04:00
|
|
|
trap_mdo = trap_method->method_data();
|
2007-12-01 00:00:00 +00:00
|
|
|
// and fall through...
|
|
|
|
}
|
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
2012-09-01 13:25:18 -04:00
|
|
|
if (trap_mdo != NULL) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Update per-method count of trap events. The interpreter
|
|
|
|
// is updating the MDO to simulate the effect of compiler traps.
|
|
|
|
Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-15 15:28:58 +02:00
|
|
|
// Assume the compiler is (or will be) interested in this event.
|
|
|
|
// If necessary, create an MDO to hold the information, and record it.
|
|
|
|
void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) {
|
|
|
|
assert(ProfileTraps, "call me only if profiling");
|
|
|
|
methodHandle trap_method(thread, method(thread));
|
|
|
|
int trap_bci = trap_method->bci_from(bcp(thread));
|
|
|
|
note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CC_INTERP
|
|
|
|
// As legacy note_trap, but we have more arguments.
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci))
|
|
|
|
methodHandle trap_method(method);
|
|
|
|
note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
// Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper
|
|
|
|
// for each exception.
|
|
|
|
void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci)
|
|
|
|
{ if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); }
|
|
|
|
void InterpreterRuntime::note_div0Check_trap(JavaThread* thread, Method *method, int trap_bci)
|
|
|
|
{ if (ProfileTraps) note_trap(thread, Deoptimization::Reason_div0_check, method, trap_bci); }
|
|
|
|
void InterpreterRuntime::note_rangeCheck_trap(JavaThread* thread, Method *method, int trap_bci)
|
|
|
|
{ if (ProfileTraps) note_trap(thread, Deoptimization::Reason_range_check, method, trap_bci); }
|
|
|
|
void InterpreterRuntime::note_classCheck_trap(JavaThread* thread, Method *method, int trap_bci)
|
|
|
|
{ if (ProfileTraps) note_trap(thread, Deoptimization::Reason_class_check, method, trap_bci); }
|
|
|
|
void InterpreterRuntime::note_arrayCheck_trap(JavaThread* thread, Method *method, int trap_bci)
|
|
|
|
{ if (ProfileTraps) note_trap(thread, Deoptimization::Reason_array_check, method, trap_bci); }
|
|
|
|
#endif // CC_INTERP
|
|
|
|
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
static Handle get_preinitialized_exception(Klass* k, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// get klass
|
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
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass* klass = InstanceKlass::cast(k);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(klass->is_initialized(),
|
|
|
|
"this klass should have been initialized during VM initialization");
|
|
|
|
// create instance - do not call constructor since we may have no
|
|
|
|
// (java) stack space left (should assert constructor is empty)
|
|
|
|
Handle exception;
|
|
|
|
oop exception_oop = klass->allocate_instance(CHECK_(exception));
|
|
|
|
exception = Handle(THREAD, exception_oop);
|
|
|
|
if (StackTraceInThrowable) {
|
|
|
|
java_lang_Throwable::fill_in_stack_trace(exception);
|
|
|
|
}
|
|
|
|
return exception;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Special handling for stack overflow: since we don't have any (java) stack
|
|
|
|
// space left we use the pre-allocated & pre-initialized StackOverflowError
|
|
|
|
// klass to create an stack overflow error instance. We do not call its
|
|
|
|
// constructor for the same reason (it is empty, anyway).
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread))
|
|
|
|
Handle exception = get_preinitialized_exception(
|
|
|
|
SystemDictionary::StackOverflowError_klass(),
|
|
|
|
CHECK);
|
2015-06-09 10:26:25 -04:00
|
|
|
// Increment counter for hs_err file reporting
|
|
|
|
Atomic::inc(&Exceptions::_stack_overflow_errors);
|
2007-12-01 00:00:00 +00:00
|
|
|
THROW_HANDLE(exception);
|
|
|
|
IRT_END
|
|
|
|
|
2016-04-08 00:38:00 -07:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_delayed_StackOverflowError(JavaThread* thread))
|
2015-12-11 09:07:07 -08:00
|
|
|
Handle exception = get_preinitialized_exception(
|
|
|
|
SystemDictionary::StackOverflowError_klass(),
|
|
|
|
CHECK);
|
|
|
|
java_lang_Throwable::set_message(exception(),
|
|
|
|
Universe::delayed_stack_overflow_error_message());
|
|
|
|
// Increment counter for hs_err file reporting
|
|
|
|
Atomic::inc(&Exceptions::_stack_overflow_errors);
|
|
|
|
THROW_HANDLE(exception);
|
|
|
|
IRT_END
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message))
|
|
|
|
// lookup exception klass
|
2011-01-27 16:11:27 -08:00
|
|
|
TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (ProfileTraps) {
|
|
|
|
if (s == vmSymbols::java_lang_ArithmeticException()) {
|
|
|
|
note_trap(thread, Deoptimization::Reason_div0_check, CHECK);
|
|
|
|
} else if (s == vmSymbols::java_lang_NullPointerException()) {
|
|
|
|
note_trap(thread, Deoptimization::Reason_null_check, CHECK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// create exception
|
2011-01-27 16:11:27 -08:00
|
|
|
Handle exception = Exceptions::new_exception(thread, s, message);
|
2007-12-01 00:00:00 +00:00
|
|
|
thread->set_vm_result(exception());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
|
|
|
|
ResourceMark rm(thread);
|
2012-11-12 16:15:05 -05:00
|
|
|
const char* klass_name = obj->klass()->external_name();
|
2007-12-01 00:00:00 +00:00
|
|
|
// lookup exception klass
|
2011-01-27 16:11:27 -08:00
|
|
|
TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (ProfileTraps) {
|
|
|
|
note_trap(thread, Deoptimization::Reason_class_check, CHECK);
|
|
|
|
}
|
|
|
|
// create exception, with klass name as detail message
|
2011-01-27 16:11:27 -08:00
|
|
|
Handle exception = Exceptions::new_exception(thread, s, klass_name);
|
2007-12-01 00:00:00 +00:00
|
|
|
thread->set_vm_result(exception());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, char* name, jint index))
|
|
|
|
char message[jintAsStringSize];
|
|
|
|
// lookup exception klass
|
2011-01-27 16:11:27 -08:00
|
|
|
TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (ProfileTraps) {
|
|
|
|
note_trap(thread, Deoptimization::Reason_range_check, CHECK);
|
|
|
|
}
|
|
|
|
// create exception
|
|
|
|
sprintf(message, "%d", index);
|
2011-01-27 16:11:27 -08:00
|
|
|
THROW_MSG(s, message);
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_END
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
|
|
|
|
JavaThread* thread, oopDesc* obj))
|
|
|
|
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
char* message = SharedRuntime::generate_class_cast_message(
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
|
|
|
thread, obj->klass());
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
if (ProfileTraps) {
|
|
|
|
note_trap(thread, Deoptimization::Reason_class_check, CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
// create exception
|
|
|
|
THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
// exception_handler_for_exception(...) returns the continuation address,
|
|
|
|
// the exception oop (via TLS) and sets the bci/bcp for the continuation.
|
|
|
|
// The exception oop is returned to make sure it is preserved over GC (it
|
|
|
|
// is only on the stack if the exception was thrown explicitly via athrow).
|
|
|
|
// During this operation, the expression stack contains the values for the
|
|
|
|
// bci where the exception happened. If the exception was propagated back
|
|
|
|
// from a call, the expression stack contains the values for the bci at the
|
|
|
|
// invoke w/o arguments (i.e., as if one were inside the call).
|
|
|
|
IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception))
|
|
|
|
|
|
|
|
Handle h_exception(thread, exception);
|
|
|
|
methodHandle h_method (thread, method(thread));
|
|
|
|
constantPoolHandle h_constants(thread, h_method->constants());
|
|
|
|
bool should_repeat;
|
|
|
|
int handler_bci;
|
2010-06-09 18:50:45 -07:00
|
|
|
int current_bci = bci(thread);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-11-25 17:33:59 +01:00
|
|
|
if (thread->frames_to_pop_failed_realloc() > 0) {
|
|
|
|
// Allocation of scalar replaced object used in this frame
|
|
|
|
// failed. Unconditionally pop the frame.
|
|
|
|
thread->dec_frames_to_pop_failed_realloc();
|
|
|
|
thread->set_vm_result(h_exception());
|
|
|
|
// If the method is synchronized we already unlocked the monitor
|
|
|
|
// during deoptimization so the interpreter needs to skip it when
|
|
|
|
// the frame is popped.
|
|
|
|
thread->set_do_not_unlock_if_synchronized(true);
|
2014-12-15 09:36:46 +01:00
|
|
|
#ifdef CC_INTERP
|
|
|
|
return (address) -1;
|
|
|
|
#else
|
2014-11-25 17:33:59 +01:00
|
|
|
return Interpreter::remove_activation_entry();
|
2014-12-15 09:36:46 +01:00
|
|
|
#endif
|
2014-11-25 17:33:59 +01:00
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Need to do this check first since when _do_not_unlock_if_synchronized
|
|
|
|
// is set, we don't want to trigger any classloading which may make calls
|
|
|
|
// into java, or surprisingly find a matching exception handler for bci 0
|
|
|
|
// since at this moment the method hasn't been "officially" entered yet.
|
|
|
|
if (thread->do_not_unlock_if_synchronized()) {
|
|
|
|
ResourceMark rm;
|
|
|
|
assert(current_bci == 0, "bci isn't zero for do_not_unlock_if_synchronized");
|
|
|
|
thread->set_vm_result(exception);
|
|
|
|
#ifdef CC_INTERP
|
|
|
|
return (address) -1;
|
|
|
|
#else
|
|
|
|
return Interpreter::remove_activation_entry();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
should_repeat = false;
|
|
|
|
|
|
|
|
// assertions
|
|
|
|
#ifdef ASSERT
|
|
|
|
assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
|
|
|
|
assert(h_exception->is_oop(), "just checking");
|
|
|
|
// Check that exception is a subclass of Throwable, otherwise we have a VerifyError
|
2010-01-06 14:22:39 -08:00
|
|
|
if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (ExitVMOnVerifyError) vm_exit(-1);
|
|
|
|
ShouldNotReachHere();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// tracing
|
2015-12-22 16:29:48 -05:00
|
|
|
if (log_is_enabled(Info, exceptions)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
ResourceMark rm(thread);
|
2015-12-22 16:29:48 -05:00
|
|
|
stringStream tempst;
|
2016-01-12 12:35:08 -05:00
|
|
|
tempst.print("interpreter method <%s>\n"
|
2015-12-22 16:29:48 -05:00
|
|
|
" at bci %d for thread " INTPTR_FORMAT,
|
|
|
|
h_method->print_value_string(), current_bci, p2i(thread));
|
2016-01-12 12:35:08 -05:00
|
|
|
Exceptions::log_exception(h_exception, tempst);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// Don't go paging in something which won't be used.
|
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
2012-09-01 13:25:18 -04:00
|
|
|
// else if (extable->length() == 0) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// // disabled for now - interpreter is not using shortcut yet
|
|
|
|
// // (shortcut is not to call runtime if we have no exception handlers)
|
|
|
|
// // warning("performance bug: should not call runtime if method has no exception handlers");
|
|
|
|
// }
|
|
|
|
// for AbortVMOnException flag
|
2015-10-14 15:36:41 -07:00
|
|
|
Exceptions::debug_check_abort(h_exception);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// exception handler lookup
|
|
|
|
KlassHandle h_klass(THREAD, h_exception->klass());
|
2013-01-08 13:01:19 -05:00
|
|
|
handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
// We threw an exception while trying to find the exception handler.
|
|
|
|
// Transfer the new exception to the exception handle which will
|
|
|
|
// be set into thread local storage, and do another lookup for an
|
|
|
|
// exception handler for this exception, this time starting at the
|
|
|
|
// BCI of the exception handler which caused the exception to be
|
|
|
|
// thrown (bug 4307310).
|
|
|
|
h_exception = Handle(THREAD, PENDING_EXCEPTION);
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
if (handler_bci >= 0) {
|
|
|
|
current_bci = handler_bci;
|
|
|
|
should_repeat = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (should_repeat == true);
|
|
|
|
|
2015-10-08 12:49:30 -10:00
|
|
|
#if INCLUDE_JVMCI
|
2015-11-04 07:23:23 -10:00
|
|
|
if (EnableJVMCI && h_method->method_data() != NULL) {
|
2015-10-08 12:49:30 -10:00
|
|
|
ResourceMark rm(thread);
|
|
|
|
ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci, NULL);
|
|
|
|
if (pdata != NULL && pdata->is_BitData()) {
|
|
|
|
BitData* bit_data = (BitData*) pdata;
|
|
|
|
bit_data->set_exception_seen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// notify JVMTI of an exception throw; JVMTI will detect if this is a first
|
|
|
|
// time throw or a stack unwinding throw and accordingly notify the debugger
|
2010-02-01 17:35:05 -07:00
|
|
|
if (JvmtiExport::can_post_on_exceptions()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
JvmtiExport::post_exception_throw(thread, h_method(), bcp(thread), h_exception());
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CC_INTERP
|
|
|
|
address continuation = (address)(intptr_t) handler_bci;
|
|
|
|
#else
|
|
|
|
address continuation = NULL;
|
|
|
|
#endif
|
|
|
|
address handler_pc = NULL;
|
|
|
|
if (handler_bci < 0 || !thread->reguard_stack((address) &continuation)) {
|
|
|
|
// Forward exception to callee (leaving bci/bcp untouched) because (a) no
|
|
|
|
// handler in this method, or (b) after a stack overflow there is not yet
|
|
|
|
// enough stack space available to reprotect the stack.
|
|
|
|
#ifndef CC_INTERP
|
|
|
|
continuation = Interpreter::remove_activation_entry();
|
|
|
|
#endif
|
2016-03-30 09:52:02 -07:00
|
|
|
#if COMPILER2_OR_JVMCI
|
2007-12-01 00:00:00 +00:00
|
|
|
// Count this for compilation purposes
|
2013-04-09 17:17:41 -04:00
|
|
|
h_method->interpreter_throwout_increment(THREAD);
|
2016-03-30 09:52:02 -07:00
|
|
|
#endif
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
// handler in this method => change bci/bcp to handler bci/bcp and continue there
|
|
|
|
handler_pc = h_method->code_base() + handler_bci;
|
|
|
|
#ifndef CC_INTERP
|
|
|
|
set_bcp_and_mdp(handler_pc, thread);
|
|
|
|
continuation = Interpreter::dispatch_table(vtos)[*handler_pc];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
// notify debugger of an exception catch
|
|
|
|
// (this is good for exceptions caught in native methods as well)
|
2010-02-01 17:35:05 -07:00
|
|
|
if (JvmtiExport::can_post_on_exceptions()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
JvmtiExport::notice_unwind_due_to_exception(thread, h_method(), handler_pc, h_exception(), (handler_pc != NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
thread->set_vm_result(h_exception());
|
|
|
|
return continuation;
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_pending_exception(JavaThread* thread))
|
|
|
|
assert(thread->has_pending_exception(), "must only ne called if there's an exception pending");
|
|
|
|
// nothing to do - eventually we should remove this code entirely (see comments @ call sites)
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodError(JavaThread* thread))
|
|
|
|
THROW(vmSymbols::java_lang_AbstractMethodError());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeError(JavaThread* thread))
|
|
|
|
THROW(vmSymbols::java_lang_IncompatibleClassChangeError());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Fields
|
|
|
|
//
|
|
|
|
|
2015-04-01 22:03:17 -04:00
|
|
|
void InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode) {
|
|
|
|
Thread* THREAD = thread;
|
2007-12-01 00:00:00 +00:00
|
|
|
// resolve field
|
2013-09-13 22:38:02 -04:00
|
|
|
fieldDescriptor info;
|
2007-12-01 00:00:00 +00:00
|
|
|
constantPoolHandle pool(thread, method(thread)->constants());
|
2016-06-15 14:27:58 +02:00
|
|
|
methodHandle m(thread, method(thread));
|
2015-03-25 15:18:37 -07:00
|
|
|
bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield ||
|
|
|
|
bytecode == Bytecodes::_putstatic);
|
2007-12-01 00:00:00 +00:00
|
|
|
bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
|
|
|
|
|
|
|
|
{
|
|
|
|
JvmtiHideSingleStepping jhss(thread);
|
2013-09-13 22:38:02 -04:00
|
|
|
LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
|
2016-06-15 14:27:58 +02:00
|
|
|
m, bytecode, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
} // end JvmtiHideSingleStepping
|
|
|
|
|
|
|
|
// check if link resolution caused cpCache to be updated
|
2015-04-01 22:03:17 -04:00
|
|
|
ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
|
|
|
|
if (cp_cache_entry->is_resolved(bytecode)) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// compute auxiliary field attributes
|
|
|
|
TosState state = as_TosState(info.field_type());
|
|
|
|
|
2016-07-06 11:16:36 +02:00
|
|
|
// Put instructions on final fields are not resolved. This is required so we throw
|
|
|
|
// exceptions at the correct place (when the instruction is actually invoked).
|
|
|
|
// If we do not resolve an instruction in the current pass, leaving the put_code
|
|
|
|
// set to zero will cause the next put instruction to the same field to reresolve.
|
|
|
|
//
|
|
|
|
// Also, we need to delay resolving getstatic and putstatic instructions until the
|
|
|
|
// class is initialized. This is required so that access to the static
|
2007-12-01 00:00:00 +00:00
|
|
|
// field will call the initialization function every time until the class
|
|
|
|
// is completely initialized ala. in 2.17.5 in JVM Specification.
|
2013-09-13 22:38:02 -04:00
|
|
|
InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
|
2007-12-01 00:00:00 +00:00
|
|
|
bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
|
|
|
|
!klass->is_initialized());
|
|
|
|
|
2016-07-06 11:16:36 +02:00
|
|
|
Bytecodes::Code put_code = (Bytecodes::Code)0;
|
|
|
|
if (is_put && !info.access_flags().is_final() && !uninitialized_static) {
|
|
|
|
put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield);
|
|
|
|
}
|
|
|
|
|
|
|
|
Bytecodes::Code get_code = (Bytecodes::Code)0;
|
2007-12-01 00:00:00 +00:00
|
|
|
if (!uninitialized_static) {
|
|
|
|
get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
|
|
|
|
}
|
|
|
|
|
2015-04-01 22:03:17 -04:00
|
|
|
cp_cache_entry->set_field(
|
2007-12-01 00:00:00 +00:00
|
|
|
get_code,
|
|
|
|
put_code,
|
2013-09-13 22:38:02 -04:00
|
|
|
info.field_holder(),
|
|
|
|
info.index(),
|
|
|
|
info.offset(),
|
2007-12-01 00:00:00 +00:00
|
|
|
state,
|
|
|
|
info.access_flags().is_final(),
|
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
2012-09-01 13:25:18 -04:00
|
|
|
info.access_flags().is_volatile(),
|
|
|
|
pool->pool_holder()
|
2007-12-01 00:00:00 +00:00
|
|
|
);
|
2015-04-01 22:03:17 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Synchronization
|
|
|
|
//
|
|
|
|
// The interpreter's synchronization code is factored out so that it can
|
|
|
|
// be shared by method invocation and synchronized blocks.
|
|
|
|
//%note synchronization_3
|
|
|
|
|
|
|
|
//%note monitor_1
|
|
|
|
IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem))
|
|
|
|
#ifdef ASSERT
|
|
|
|
thread->last_frame().interpreter_frame_verify_monitor(elem);
|
|
|
|
#endif
|
|
|
|
if (PrintBiasedLockingStatistics) {
|
|
|
|
Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
|
|
|
|
}
|
|
|
|
Handle h_obj(thread, elem->obj());
|
|
|
|
assert(Universe::heap()->is_in_reserved_or_null(h_obj()),
|
|
|
|
"must be NULL or an object");
|
|
|
|
if (UseBiasedLocking) {
|
|
|
|
// Retry fast entry if bias is revoked to avoid unnecessary inflation
|
|
|
|
ObjectSynchronizer::fast_enter(h_obj, elem->lock(), true, CHECK);
|
|
|
|
} else {
|
|
|
|
ObjectSynchronizer::slow_enter(h_obj, elem->lock(), CHECK);
|
|
|
|
}
|
|
|
|
assert(Universe::heap()->is_in_reserved_or_null(elem->obj()),
|
|
|
|
"must be NULL or an object");
|
|
|
|
#ifdef ASSERT
|
|
|
|
thread->last_frame().interpreter_frame_verify_monitor(elem);
|
|
|
|
#endif
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
//%note monitor_1
|
|
|
|
IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorexit(JavaThread* thread, BasicObjectLock* elem))
|
|
|
|
#ifdef ASSERT
|
|
|
|
thread->last_frame().interpreter_frame_verify_monitor(elem);
|
|
|
|
#endif
|
|
|
|
Handle h_obj(thread, elem->obj());
|
|
|
|
assert(Universe::heap()->is_in_reserved_or_null(h_obj()),
|
|
|
|
"must be NULL or an object");
|
|
|
|
if (elem == NULL || h_obj()->is_unlocked()) {
|
|
|
|
THROW(vmSymbols::java_lang_IllegalMonitorStateException());
|
|
|
|
}
|
|
|
|
ObjectSynchronizer::slow_exit(h_obj(), elem->lock(), thread);
|
|
|
|
// Free entry. This must be done here, since a pending exception might be installed on
|
|
|
|
// exit. If it is not cleared, the exception handling code will try to unlock the monitor again.
|
|
|
|
elem->set_obj(NULL);
|
|
|
|
#ifdef ASSERT
|
|
|
|
thread->last_frame().interpreter_frame_verify_monitor(elem);
|
|
|
|
#endif
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::throw_illegal_monitor_state_exception(JavaThread* thread))
|
|
|
|
THROW(vmSymbols::java_lang_IllegalMonitorStateException());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::new_illegal_monitor_state_exception(JavaThread* thread))
|
|
|
|
// Returns an illegal exception to install into the current thread. The
|
|
|
|
// pending_exception flag is cleared so normal exception handling does not
|
|
|
|
// trigger. Any current installed exception will be overwritten. This
|
|
|
|
// method will be called during an exception unwind.
|
|
|
|
|
|
|
|
assert(!HAS_PENDING_EXCEPTION, "no pending exception");
|
|
|
|
Handle exception(thread, thread->vm_result());
|
|
|
|
assert(exception() != NULL, "vm result should be set");
|
|
|
|
thread->set_vm_result(NULL); // clear vm result before continuing (may cause memory leaks and assert failures)
|
2010-01-06 14:22:39 -08:00
|
|
|
if (!exception->is_a(SystemDictionary::ThreadDeath_klass())) {
|
2007-12-01 00:00:00 +00:00
|
|
|
exception = get_preinitialized_exception(
|
|
|
|
SystemDictionary::IllegalMonitorStateException_klass(),
|
|
|
|
CATCH);
|
|
|
|
}
|
|
|
|
thread->set_vm_result(exception());
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Invokes
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, Method* method, address bcp))
|
2007-12-01 00:00:00 +00:00
|
|
|
return method->orig_bytecode_at(method->bci_from(bcp));
|
|
|
|
IRT_END
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code))
|
2007-12-01 00:00:00 +00:00
|
|
|
method->set_orig_bytecode_at(method->bci_from(bcp), new_code);
|
|
|
|
IRT_END
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, Method* method, address bcp))
|
2007-12-01 00:00:00 +00:00
|
|
|
JvmtiExport::post_raw_breakpoint(thread, method, bcp);
|
|
|
|
IRT_END
|
|
|
|
|
2015-04-01 22:03:17 -04:00
|
|
|
void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode) {
|
|
|
|
Thread* THREAD = thread;
|
2007-12-01 00:00:00 +00:00
|
|
|
// extract receiver from the outgoing argument list if necessary
|
|
|
|
Handle receiver(thread, NULL);
|
|
|
|
if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) {
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
methodHandle m (thread, method(thread));
|
2011-01-13 22:15:41 -08:00
|
|
|
Bytecode_invoke call(m, bci(thread));
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* signature = call.signature();
|
2007-12-01 00:00:00 +00:00
|
|
|
receiver = Handle(thread,
|
|
|
|
thread->last_frame().interpreter_callee_receiver(signature));
|
|
|
|
assert(Universe::heap()->is_in_reserved_or_null(receiver()),
|
|
|
|
"sanity check");
|
|
|
|
assert(receiver.is_null() ||
|
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
2012-09-01 13:25:18 -04:00
|
|
|
!Universe::heap()->is_in_reserved(receiver->klass()),
|
2007-12-01 00:00:00 +00:00
|
|
|
"sanity check");
|
|
|
|
}
|
|
|
|
|
|
|
|
// resolve method
|
|
|
|
CallInfo info;
|
|
|
|
constantPoolHandle pool(thread, method(thread)->constants());
|
|
|
|
|
|
|
|
{
|
|
|
|
JvmtiHideSingleStepping jhss(thread);
|
|
|
|
LinkResolver::resolve_invoke(info, receiver, pool,
|
2015-04-01 22:03:17 -04:00
|
|
|
get_index_u2_cpcache(thread, bytecode), bytecode,
|
|
|
|
CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
|
|
|
|
int retry_count = 0;
|
|
|
|
while (info.resolved_method()->is_old()) {
|
|
|
|
// It is very unlikely that method is redefined more than 100 times
|
|
|
|
// in the middle of resolve. If it is looping here more than 100 times
|
|
|
|
// means then there could be a bug here.
|
|
|
|
guarantee((retry_count++ < 100),
|
|
|
|
"Could not resolve to latest version of redefined method");
|
|
|
|
// method is redefined in the middle of resolve so re-try.
|
|
|
|
LinkResolver::resolve_invoke(info, receiver, pool,
|
2015-04-01 22:03:17 -04:00
|
|
|
get_index_u2_cpcache(thread, bytecode), bytecode,
|
|
|
|
CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end JvmtiHideSingleStepping
|
|
|
|
|
|
|
|
// check if link resolution caused cpCache to be updated
|
2015-04-01 22:03:17 -04:00
|
|
|
ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
|
|
|
|
if (cp_cache_entry->is_resolved(bytecode)) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2013-09-13 22:38:02 -04:00
|
|
|
#ifdef ASSERT
|
|
|
|
if (bytecode == Bytecodes::_invokeinterface) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (info.resolved_method()->method_holder() ==
|
2010-01-06 14:22:39 -08:00
|
|
|
SystemDictionary::Object_klass()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
|
2013-09-13 22:38:02 -04:00
|
|
|
// (see also CallInfo::set_interface for details)
|
|
|
|
assert(info.call_kind() == CallInfo::vtable_call ||
|
|
|
|
info.call_kind() == CallInfo::direct_call, "");
|
2007-12-01 00:00:00 +00:00
|
|
|
methodHandle rm = info.resolved_method();
|
|
|
|
assert(rm->is_final() || info.has_vtable_index(),
|
|
|
|
"should have been set already");
|
2013-09-13 22:38:02 -04:00
|
|
|
} else if (!info.resolved_method()->has_itable_index()) {
|
|
|
|
// Resolved something like CharSequence.toString. Use vtable not itable.
|
|
|
|
assert(info.call_kind() != CallInfo::itable_call, "");
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
// Setup itable entry
|
2013-09-13 22:38:02 -04:00
|
|
|
assert(info.call_kind() == CallInfo::itable_call, "");
|
|
|
|
int index = info.resolved_method()->itable_index();
|
|
|
|
assert(info.itable_index() == index, "");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-09-13 22:38:02 -04:00
|
|
|
assert(info.call_kind() == CallInfo::direct_call ||
|
|
|
|
info.call_kind() == CallInfo::vtable_call, "");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
switch (info.call_kind()) {
|
|
|
|
case CallInfo::direct_call:
|
2015-04-01 22:03:17 -04:00
|
|
|
cp_cache_entry->set_direct_call(
|
2013-09-13 22:38:02 -04:00
|
|
|
bytecode,
|
|
|
|
info.resolved_method());
|
|
|
|
break;
|
|
|
|
case CallInfo::vtable_call:
|
2015-04-01 22:03:17 -04:00
|
|
|
cp_cache_entry->set_vtable_call(
|
2007-12-01 00:00:00 +00:00
|
|
|
bytecode,
|
|
|
|
info.resolved_method(),
|
|
|
|
info.vtable_index());
|
2013-09-13 22:38:02 -04:00
|
|
|
break;
|
|
|
|
case CallInfo::itable_call:
|
2015-04-01 22:03:17 -04:00
|
|
|
cp_cache_entry->set_itable_call(
|
2013-09-13 22:38:02 -04:00
|
|
|
bytecode,
|
|
|
|
info.resolved_method(),
|
|
|
|
info.itable_index());
|
|
|
|
break;
|
|
|
|
default: ShouldNotReachHere();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2012-07-24 10:51:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// First time execution: Resolve symbols, create a permanent MethodType object.
|
2015-04-01 22:03:17 -04:00
|
|
|
void InterpreterRuntime::resolve_invokehandle(JavaThread* thread) {
|
|
|
|
Thread* THREAD = thread;
|
2012-07-24 10:51:00 -07:00
|
|
|
const Bytecodes::Code bytecode = Bytecodes::_invokehandle;
|
|
|
|
|
|
|
|
// resolve method
|
|
|
|
CallInfo info;
|
|
|
|
constantPoolHandle pool(thread, method(thread)->constants());
|
|
|
|
{
|
|
|
|
JvmtiHideSingleStepping jhss(thread);
|
|
|
|
LinkResolver::resolve_invoke(info, Handle(), pool,
|
2015-04-01 22:03:17 -04:00
|
|
|
get_index_u2_cpcache(thread, bytecode), bytecode,
|
|
|
|
CHECK);
|
2012-07-24 10:51:00 -07:00
|
|
|
} // end JvmtiHideSingleStepping
|
|
|
|
|
2015-04-01 22:03:17 -04:00
|
|
|
ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
|
|
|
|
cp_cache_entry->set_method_handle(pool, info);
|
2012-07-24 10:51:00 -07:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2009-10-30 16:22:59 -07:00
|
|
|
// First time execution: Resolve symbols, create a permanent CallSite object.
|
2015-04-01 22:03:17 -04:00
|
|
|
void InterpreterRuntime::resolve_invokedynamic(JavaThread* thread) {
|
|
|
|
Thread* THREAD = thread;
|
2009-04-21 23:21:04 -07:00
|
|
|
const Bytecodes::Code bytecode = Bytecodes::_invokedynamic;
|
|
|
|
|
2012-07-24 10:51:00 -07:00
|
|
|
//TO DO: consider passing BCI to Java.
|
|
|
|
// int caller_bci = method(thread)->bci_from(bcp(thread));
|
2009-04-21 23:21:04 -07:00
|
|
|
|
2012-07-24 10:51:00 -07:00
|
|
|
// resolve method
|
|
|
|
CallInfo info;
|
|
|
|
constantPoolHandle pool(thread, method(thread)->constants());
|
|
|
|
int index = get_index_u4(thread, bytecode);
|
|
|
|
{
|
2009-04-21 23:21:04 -07:00
|
|
|
JvmtiHideSingleStepping jhss(thread);
|
2012-07-24 10:51:00 -07:00
|
|
|
LinkResolver::resolve_invoke(info, Handle(), pool,
|
|
|
|
index, bytecode, CHECK);
|
|
|
|
} // end JvmtiHideSingleStepping
|
2010-07-15 18:40:45 -07:00
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPoolCacheEntry* cp_cache_entry = pool->invokedynamic_cp_cache_entry_at(index);
|
2012-11-02 12:30:46 -07:00
|
|
|
cp_cache_entry->set_dynamic_call(pool, info);
|
2009-04-21 23:21:04 -07:00
|
|
|
}
|
|
|
|
|
2015-04-01 22:03:17 -04:00
|
|
|
// This function is the interface to the assembly code. It returns the resolved
|
|
|
|
// cpCache entry. This doesn't safepoint, but the helper routines safepoint.
|
|
|
|
// This function will check for redefinition!
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::resolve_from_cache(JavaThread* thread, Bytecodes::Code bytecode)) {
|
|
|
|
switch (bytecode) {
|
|
|
|
case Bytecodes::_getstatic:
|
|
|
|
case Bytecodes::_putstatic:
|
|
|
|
case Bytecodes::_getfield:
|
|
|
|
case Bytecodes::_putfield:
|
|
|
|
resolve_get_put(thread, bytecode);
|
|
|
|
break;
|
|
|
|
case Bytecodes::_invokevirtual:
|
|
|
|
case Bytecodes::_invokespecial:
|
|
|
|
case Bytecodes::_invokestatic:
|
|
|
|
case Bytecodes::_invokeinterface:
|
|
|
|
resolve_invoke(thread, bytecode);
|
|
|
|
break;
|
|
|
|
case Bytecodes::_invokehandle:
|
|
|
|
resolve_invokehandle(thread);
|
|
|
|
break;
|
|
|
|
case Bytecodes::_invokedynamic:
|
|
|
|
resolve_invokedynamic(thread);
|
|
|
|
break;
|
|
|
|
default:
|
2015-09-29 11:02:08 +02:00
|
|
|
fatal("unexpected bytecode: %s", Bytecodes::name(bytecode));
|
2015-04-01 22:03:17 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IRT_END
|
2009-04-21 23:21:04 -07:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
//------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Miscellaneous
|
|
|
|
|
|
|
|
|
2009-09-02 00:04:29 -07:00
|
|
|
nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp) {
|
|
|
|
nmethod* nm = frequency_counter_overflow_inner(thread, branch_bcp);
|
|
|
|
assert(branch_bcp != NULL || nm == NULL, "always returns null for non OSR requests");
|
|
|
|
if (branch_bcp != NULL && nm != NULL) {
|
|
|
|
// This was a successful request for an OSR nmethod. Because
|
|
|
|
// frequency_counter_overflow_inner ends with a safepoint check,
|
|
|
|
// nm could have been unloaded so look it up again. It's unsafe
|
|
|
|
// to examine nm directly since it might have been freed and used
|
|
|
|
// for something else.
|
|
|
|
frame fr = thread->last_frame();
|
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
2012-09-01 13:25:18 -04:00
|
|
|
Method* method = fr.interpreter_frame_method();
|
2009-09-02 00:04:29 -07:00
|
|
|
int bci = method->bci_from(fr.interpreter_frame_bcp());
|
2010-09-03 17:51:07 -07:00
|
|
|
nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
|
2009-09-02 00:04:29 -07:00
|
|
|
}
|
2012-06-13 11:36:03 -07:00
|
|
|
#ifndef PRODUCT
|
|
|
|
if (TraceOnStackReplacement) {
|
|
|
|
if (nm != NULL) {
|
2015-10-09 09:42:33 +02:00
|
|
|
tty->print("OSR entry @ pc: " INTPTR_FORMAT ": ", p2i(nm->osr_entry()));
|
2012-06-13 11:36:03 -07:00
|
|
|
nm->print();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2009-09-02 00:04:29 -07:00
|
|
|
return nm;
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_ENTRY(nmethod*,
|
2009-09-02 00:04:29 -07:00
|
|
|
InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp))
|
2007-12-01 00:00:00 +00:00
|
|
|
// use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
|
|
|
|
// flag, in case this method triggers classloading which will call into Java.
|
|
|
|
UnlockFlagSaver fs(thread);
|
|
|
|
|
|
|
|
frame fr = thread->last_frame();
|
|
|
|
assert(fr.is_interpreted_frame(), "must come from interpreter");
|
|
|
|
methodHandle method(thread, fr.interpreter_frame_method());
|
2010-09-03 17:51:07 -07:00
|
|
|
const int branch_bci = branch_bcp != NULL ? method->bci_from(branch_bcp) : InvocationEntryBci;
|
|
|
|
const int bci = branch_bcp != NULL ? method->bci_from(fr.interpreter_frame_bcp()) : InvocationEntryBci;
|
|
|
|
|
2012-01-26 12:15:24 -08:00
|
|
|
assert(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending");
|
2011-07-01 10:37:37 -07:00
|
|
|
nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
|
2012-01-26 12:15:24 -08:00
|
|
|
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
|
2010-09-03 17:51:07 -07:00
|
|
|
|
|
|
|
if (osr_nm != NULL) {
|
|
|
|
// We may need to do on-stack replacement which requires that no
|
|
|
|
// monitors in the activation are biased because their
|
|
|
|
// BasicObjectLocks will need to migrate during OSR. Force
|
|
|
|
// unbiasing of all monitors in the activation now (even though
|
|
|
|
// the OSR nmethod might be invalidated) because we don't have a
|
|
|
|
// safepoint opportunity later once the migration begins.
|
|
|
|
if (UseBiasedLocking) {
|
|
|
|
ResourceMark rm;
|
|
|
|
GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
|
|
|
|
for( BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
|
|
|
|
kptr < fr.interpreter_frame_monitor_begin();
|
|
|
|
kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
|
|
|
|
if( kptr->obj() != NULL ) {
|
|
|
|
objects_to_revoke->append(Handle(THREAD, kptr->obj()));
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-03 17:51:07 -07:00
|
|
|
BiasedLocking::revoke(objects_to_revoke);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
2010-09-03 17:51:07 -07:00
|
|
|
return osr_nm;
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_END
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp))
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(ProfileInterpreter, "must be profiling interpreter");
|
|
|
|
int bci = method->bci_from(cur_bcp);
|
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
2012-09-01 13:25:18 -04:00
|
|
|
MethodData* mdo = method->method_data();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (mdo == NULL) return 0;
|
|
|
|
return mdo->bci_to_di(bci);
|
|
|
|
IRT_END
|
|
|
|
|
2011-01-10 18:46:29 -08:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
|
2007-12-01 00:00:00 +00:00
|
|
|
// use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
|
|
|
|
// flag, in case this method triggers classloading which will call into Java.
|
|
|
|
UnlockFlagSaver fs(thread);
|
|
|
|
|
|
|
|
assert(ProfileInterpreter, "must be profiling interpreter");
|
|
|
|
frame fr = thread->last_frame();
|
|
|
|
assert(fr.is_interpreted_frame(), "must come from interpreter");
|
|
|
|
methodHandle method(thread, fr.interpreter_frame_method());
|
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
2012-09-01 13:25:18 -04:00
|
|
|
Method::build_interpreter_method_data(method, THREAD);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
// and fall through...
|
|
|
|
}
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ASSERT
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_LEAF(void, InterpreterRuntime::verify_mdp(Method* method, address bcp, address mdp))
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(ProfileInterpreter, "must be profiling interpreter");
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
MethodData* mdo = method->method_data();
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(mdo != NULL, "must not be null");
|
|
|
|
|
|
|
|
int bci = method->bci_from(bcp);
|
|
|
|
|
|
|
|
address mdp2 = mdo->bci_to_dp(bci);
|
|
|
|
if (mdp != mdp2) {
|
|
|
|
ResourceMark rm;
|
|
|
|
ResetNoHandleMark rnm; // In a LEAF entry.
|
|
|
|
HandleMark hm;
|
|
|
|
tty->print_cr("FAILED verify : actual mdp %p expected mdp %p @ bci %d", mdp, mdp2, bci);
|
|
|
|
int current_di = mdo->dp_to_di(mdp);
|
|
|
|
int expected_di = mdo->dp_to_di(mdp2);
|
|
|
|
tty->print_cr(" actual di %d expected di %d", current_di, expected_di);
|
|
|
|
int expected_approx_bci = mdo->data_at(expected_di)->bci();
|
|
|
|
int approx_bci = -1;
|
|
|
|
if (current_di >= 0) {
|
|
|
|
approx_bci = mdo->data_at(current_di)->bci();
|
|
|
|
}
|
|
|
|
tty->print_cr(" actual bci is %d expected bci %d", approx_bci, expected_approx_bci);
|
|
|
|
mdo->print_on(tty);
|
|
|
|
method->print_codes();
|
|
|
|
}
|
|
|
|
assert(mdp == mdp2, "wrong mdp");
|
|
|
|
IRT_END
|
|
|
|
#endif // ASSERT
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::update_mdp_for_ret(JavaThread* thread, int return_bci))
|
|
|
|
assert(ProfileInterpreter, "must be profiling interpreter");
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
HandleMark hm(thread);
|
|
|
|
frame fr = thread->last_frame();
|
|
|
|
assert(fr.is_interpreted_frame(), "must come from interpreter");
|
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
2012-09-01 13:25:18 -04:00
|
|
|
MethodData* h_mdo = fr.interpreter_frame_method()->method_data();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Grab a lock to ensure atomic access to setting the return bci and
|
|
|
|
// the displacement. This can block and GC, invalidating all naked oops.
|
|
|
|
MutexLocker ml(RetData_lock);
|
|
|
|
|
|
|
|
// ProfileData is essentially a wrapper around a derived oop, so we
|
|
|
|
// need to take the lock before making any ProfileData structures.
|
|
|
|
ProfileData* data = h_mdo->data_at(h_mdo->dp_to_di(fr.interpreter_frame_mdp()));
|
|
|
|
RetData* rdata = data->as_RetData();
|
|
|
|
address new_mdp = rdata->fixup_ret(return_bci, h_mdo);
|
|
|
|
fr.interpreter_frame_set_mdp(new_mdp);
|
|
|
|
IRT_END
|
|
|
|
|
2013-04-09 17:17:41 -04:00
|
|
|
IRT_ENTRY(MethodCounters*, InterpreterRuntime::build_method_counters(JavaThread* thread, Method* m))
|
|
|
|
MethodCounters* mcs = Method::build_method_counters(m, thread);
|
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
}
|
|
|
|
return mcs;
|
|
|
|
IRT_END
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::at_safepoint(JavaThread* thread))
|
|
|
|
// We used to need an explict preserve_arguments here for invoke bytecodes. However,
|
|
|
|
// stack traversal automatically takes care of preserving arguments for invoke, so
|
|
|
|
// this is no longer needed.
|
|
|
|
|
|
|
|
// IRT_END does an implicit safepoint check, hence we are guaranteed to block
|
|
|
|
// if this is called during a safepoint
|
|
|
|
|
|
|
|
if (JvmtiExport::should_post_single_step()) {
|
|
|
|
// We are called during regular safepoints and when the VM is
|
|
|
|
// single stepping. If any thread is marked for single stepping,
|
|
|
|
// then we may have JVMTI work to do.
|
|
|
|
JvmtiExport::at_single_stepping_point(thread, method(thread), bcp(thread));
|
|
|
|
}
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
|
|
|
|
ConstantPoolCacheEntry *cp_entry))
|
|
|
|
|
|
|
|
// check the access_flags for the field in the klass
|
2011-03-18 16:00:34 -07:00
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
|
2007-12-01 00:00:00 +00:00
|
|
|
int index = cp_entry->field_index();
|
2011-09-10 17:29:02 -07:00
|
|
|
if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
bool is_static = (obj == NULL);
|
|
|
|
HandleMark hm(thread);
|
|
|
|
|
|
|
|
Handle h_obj;
|
|
|
|
if (!is_static) {
|
|
|
|
// non-static field accessors have an object, but we need a handle
|
|
|
|
h_obj = Handle(thread, obj);
|
|
|
|
}
|
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
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass());
|
2012-07-24 10:51:00 -07:00
|
|
|
jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static);
|
2007-12-01 00:00:00 +00:00
|
|
|
JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
|
|
|
|
oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
Klass* k = (Klass*)cp_entry->f1_as_klass();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// check the access_flags for the field in the klass
|
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
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass* ik = InstanceKlass::cast(k);
|
2007-12-01 00:00:00 +00:00
|
|
|
int index = cp_entry->field_index();
|
|
|
|
// bail out if field modifications are not watched
|
2011-09-10 17:29:02 -07:00
|
|
|
if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
char sig_type = '\0';
|
|
|
|
|
|
|
|
switch(cp_entry->flag_state()) {
|
2015-10-13 18:13:34 -04:00
|
|
|
case btos: sig_type = 'B'; break;
|
|
|
|
case ztos: sig_type = 'Z'; break;
|
2007-12-01 00:00:00 +00:00
|
|
|
case ctos: sig_type = 'C'; break;
|
|
|
|
case stos: sig_type = 'S'; break;
|
|
|
|
case itos: sig_type = 'I'; break;
|
|
|
|
case ftos: sig_type = 'F'; break;
|
|
|
|
case atos: sig_type = 'L'; break;
|
|
|
|
case ltos: sig_type = 'J'; break;
|
|
|
|
case dtos: sig_type = 'D'; break;
|
|
|
|
default: ShouldNotReachHere(); return;
|
|
|
|
}
|
|
|
|
bool is_static = (obj == NULL);
|
|
|
|
|
|
|
|
HandleMark hm(thread);
|
|
|
|
instanceKlassHandle h_klass(thread, k);
|
2012-07-24 10:51:00 -07:00
|
|
|
jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_klass, cp_entry->f2_as_index(), is_static);
|
2007-12-01 00:00:00 +00:00
|
|
|
jvalue fvalue;
|
|
|
|
#ifdef _LP64
|
|
|
|
fvalue = *value;
|
|
|
|
#else
|
|
|
|
// Long/double values are stored unaligned and also noncontiguously with
|
|
|
|
// tagged stacks. We can't just do a simple assignment even in the non-
|
|
|
|
// J/D cases because a C++ compiler is allowed to assume that a jvalue is
|
|
|
|
// 8-byte aligned, and interpreter stack slots are only 4-byte aligned.
|
|
|
|
// We assume that the two halves of longs/doubles are stored in interpreter
|
|
|
|
// stack slots in platform-endian order.
|
|
|
|
jlong_accessor u;
|
|
|
|
jint* newval = (jint*)value;
|
|
|
|
u.words[0] = newval[0];
|
2010-04-30 08:37:24 -07:00
|
|
|
u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag
|
2007-12-01 00:00:00 +00:00
|
|
|
fvalue.j = u.long_value;
|
|
|
|
#endif // _LP64
|
|
|
|
|
|
|
|
Handle h_obj;
|
|
|
|
if (!is_static) {
|
|
|
|
// non-static field accessors have an object, but we need a handle
|
|
|
|
h_obj = Handle(thread, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
JvmtiExport::post_raw_field_modification(thread, method(thread), bcp(thread), h_klass, h_obj,
|
|
|
|
fid, sig_type, &fvalue);
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::post_method_entry(JavaThread *thread))
|
|
|
|
JvmtiExport::post_method_entry(thread, InterpreterRuntime::method(thread), InterpreterRuntime::last_frame(thread));
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::post_method_exit(JavaThread *thread))
|
|
|
|
JvmtiExport::post_method_exit(thread, InterpreterRuntime::method(thread), InterpreterRuntime::last_frame(thread));
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
IRT_LEAF(int, InterpreterRuntime::interpreter_contains(address pc))
|
|
|
|
{
|
|
|
|
return (Interpreter::contains(pc) ? 1 : 0);
|
|
|
|
}
|
|
|
|
IRT_END
|
|
|
|
|
|
|
|
|
|
|
|
// Implementation of SignatureHandlerLibrary
|
|
|
|
|
2015-06-23 17:48:34 +02:00
|
|
|
#ifndef SHARING_FAST_NATIVE_FINGERPRINTS
|
|
|
|
// Dummy definition (else normalization method is defined in CPU
|
|
|
|
// dependant code)
|
|
|
|
uint64_t InterpreterRuntime::normalize_fast_native_fingerprint(uint64_t fingerprint) {
|
|
|
|
return fingerprint;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
address SignatureHandlerLibrary::set_handler_blob() {
|
|
|
|
BufferBlob* handler_blob = BufferBlob::create("native signature handlers", blob_size);
|
|
|
|
if (handler_blob == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-08-25 05:27:54 -07:00
|
|
|
address handler = handler_blob->code_begin();
|
2007-12-01 00:00:00 +00:00
|
|
|
_handler_blob = handler_blob;
|
|
|
|
_handler = handler;
|
|
|
|
return handler;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SignatureHandlerLibrary::initialize() {
|
|
|
|
if (_fingerprints != NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (set_handler_blob() == NULL) {
|
2013-04-30 11:56:52 -07:00
|
|
|
vm_exit_out_of_memory(blob_size, OOM_MALLOC_ERROR, "native signature handlers");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer",
|
|
|
|
SignatureHandlerLibrary::buffer_size);
|
2010-08-25 05:27:54 -07:00
|
|
|
_buffer = bb->code_begin();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-06-28 17:03:16 -04:00
|
|
|
_fingerprints = new(ResourceObj::C_HEAP, mtCode)GrowableArray<uint64_t>(32, true);
|
|
|
|
_handlers = new(ResourceObj::C_HEAP, mtCode)GrowableArray<address>(32, true);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
address SignatureHandlerLibrary::set_handler(CodeBuffer* buffer) {
|
|
|
|
address handler = _handler;
|
2010-08-25 05:27:54 -07:00
|
|
|
int insts_size = buffer->pure_insts_size();
|
|
|
|
if (handler + insts_size > _handler_blob->code_end()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// get a new handler blob
|
|
|
|
handler = set_handler_blob();
|
|
|
|
}
|
|
|
|
if (handler != NULL) {
|
2010-08-25 05:27:54 -07:00
|
|
|
memcpy(handler, buffer->insts_begin(), insts_size);
|
2007-12-01 00:00:00 +00:00
|
|
|
pd_set_handler(handler);
|
2010-08-25 05:27:54 -07:00
|
|
|
ICache::invalidate_range(handler, insts_size);
|
|
|
|
_handler = handler + insts_size;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2015-07-01 10:53:26 +02:00
|
|
|
CodeCacheExtensions::handle_generated_handler(handler, buffer->name(), _handler);
|
2007-12-01 00:00:00 +00:00
|
|
|
return handler;
|
|
|
|
}
|
|
|
|
|
2015-10-23 16:48:38 -04:00
|
|
|
void SignatureHandlerLibrary::add(const methodHandle& method) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (method->signature_handler() == NULL) {
|
|
|
|
// use slow signature handler if we can't do better
|
|
|
|
int handler_index = -1;
|
|
|
|
// check if we can use customized (fast) signature handler
|
2015-07-01 10:53:26 +02:00
|
|
|
if (UseFastSignatureHandlers && CodeCacheExtensions::support_fast_signature_handlers() && method->size_of_parameters() <= Fingerprinter::max_size_of_parameters) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// use customized signature handler
|
|
|
|
MutexLocker mu(SignatureHandlerLibrary_lock);
|
|
|
|
// make sure data structure is initialized
|
|
|
|
initialize();
|
|
|
|
// lookup method signature's fingerprint
|
|
|
|
uint64_t fingerprint = Fingerprinter(method).fingerprint();
|
2015-06-23 17:48:34 +02:00
|
|
|
// allow CPU dependant code to optimize the fingerprints for the fast handler
|
|
|
|
fingerprint = InterpreterRuntime::normalize_fast_native_fingerprint(fingerprint);
|
2007-12-01 00:00:00 +00:00
|
|
|
handler_index = _fingerprints->find(fingerprint);
|
|
|
|
// create handler if necessary
|
|
|
|
if (handler_index < 0) {
|
|
|
|
ResourceMark rm;
|
|
|
|
ptrdiff_t align_offset = (address)
|
|
|
|
round_to((intptr_t)_buffer, CodeEntryAlignment) - (address)_buffer;
|
|
|
|
CodeBuffer buffer((address)(_buffer + align_offset),
|
|
|
|
SignatureHandlerLibrary::buffer_size - align_offset);
|
2015-07-01 10:53:26 +02:00
|
|
|
if (!CodeCacheExtensions::support_dynamic_code()) {
|
|
|
|
// we need a name for the signature (for lookups or saving)
|
|
|
|
const int SYMBOL_SIZE = 50;
|
|
|
|
char *symbolName = NEW_RESOURCE_ARRAY(char, SYMBOL_SIZE);
|
|
|
|
// support for named signatures
|
|
|
|
jio_snprintf(symbolName, SYMBOL_SIZE,
|
|
|
|
"native_" UINT64_FORMAT, fingerprint);
|
|
|
|
buffer.set_name(symbolName);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
InterpreterRuntime::SignatureHandlerGenerator(method, &buffer).generate(fingerprint);
|
|
|
|
// copy into code heap
|
|
|
|
address handler = set_handler(&buffer);
|
|
|
|
if (handler == NULL) {
|
2015-07-01 10:53:26 +02:00
|
|
|
// use slow signature handler (without memorizing it in the fingerprints)
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
// debugging suppport
|
2015-07-01 10:53:26 +02:00
|
|
|
if (PrintSignatureHandlers && (handler != Interpreter::slow_signature_handler())) {
|
2015-12-18 20:23:26 +03:00
|
|
|
ttyLocker ttyl;
|
2007-12-01 00:00:00 +00:00
|
|
|
tty->cr();
|
|
|
|
tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)",
|
|
|
|
_handlers->length(),
|
|
|
|
(method->is_static() ? "static" : "receiver"),
|
|
|
|
method->name_and_sig_as_C_string(),
|
|
|
|
fingerprint,
|
2010-08-25 05:27:54 -07:00
|
|
|
buffer.insts_size());
|
2015-07-01 10:53:26 +02:00
|
|
|
if (buffer.insts_size() > 0) {
|
|
|
|
// buffer may be empty for pregenerated handlers
|
|
|
|
Disassembler::decode(handler, handler + buffer.insts_size());
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
address rh_begin = Interpreter::result_handler(method()->result_type());
|
2015-06-23 17:48:34 +02:00
|
|
|
if (CodeCache::contains(rh_begin)) {
|
|
|
|
// else it might be special platform dependent values
|
|
|
|
tty->print_cr(" --- associated result handler ---");
|
|
|
|
address rh_end = rh_begin;
|
|
|
|
while (*(int*)rh_end != 0) {
|
|
|
|
rh_end += sizeof(int);
|
|
|
|
}
|
|
|
|
Disassembler::decode(rh_begin, rh_end);
|
|
|
|
} else {
|
|
|
|
tty->print_cr(" associated result handler: " PTR_FORMAT, p2i(rh_begin));
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
// add handler to library
|
|
|
|
_fingerprints->append(fingerprint);
|
|
|
|
_handlers->append(handler);
|
|
|
|
// set handler index
|
|
|
|
assert(_fingerprints->length() == _handlers->length(), "sanity check");
|
|
|
|
handler_index = _fingerprints->length() - 1;
|
|
|
|
}
|
|
|
|
}
|
2011-02-02 18:38:40 -05:00
|
|
|
// Set handler under SignatureHandlerLibrary_lock
|
2015-06-23 17:48:34 +02:00
|
|
|
if (handler_index < 0) {
|
|
|
|
// use generic signature handler
|
|
|
|
method->set_signature_handler(Interpreter::slow_signature_handler());
|
|
|
|
} else {
|
|
|
|
// set handler
|
|
|
|
method->set_signature_handler(_handlers->at(handler_index));
|
|
|
|
}
|
2011-02-02 18:38:40 -05:00
|
|
|
} else {
|
|
|
|
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
|
|
|
|
// use generic signature handler
|
|
|
|
method->set_signature_handler(Interpreter::slow_signature_handler());
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2010-12-04 00:09:05 -05:00
|
|
|
#ifdef ASSERT
|
2011-02-02 18:38:40 -05:00
|
|
|
int handler_index = -1;
|
|
|
|
int fingerprint_index = -2;
|
2010-12-04 00:09:05 -05:00
|
|
|
{
|
|
|
|
// '_handlers' and '_fingerprints' are 'GrowableArray's and are NOT synchronized
|
|
|
|
// in any way if accessed from multiple threads. To avoid races with another
|
|
|
|
// thread which may change the arrays in the above, mutex protected block, we
|
|
|
|
// have to protect this read access here with the same mutex as well!
|
|
|
|
MutexLocker mu(SignatureHandlerLibrary_lock);
|
2011-02-02 18:38:40 -05:00
|
|
|
if (_handlers != NULL) {
|
2015-06-23 17:48:34 +02:00
|
|
|
handler_index = _handlers->find(method->signature_handler());
|
|
|
|
uint64_t fingerprint = Fingerprinter(method).fingerprint();
|
|
|
|
fingerprint = InterpreterRuntime::normalize_fast_native_fingerprint(fingerprint);
|
|
|
|
fingerprint_index = _fingerprints->find(fingerprint);
|
|
|
|
}
|
2011-02-02 18:38:40 -05:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(method->signature_handler() == Interpreter::slow_signature_handler() ||
|
2010-12-04 00:09:05 -05:00
|
|
|
handler_index == fingerprint_index, "sanity check");
|
2011-02-02 18:38:40 -05:00
|
|
|
#endif // ASSERT
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2015-07-01 10:53:26 +02:00
|
|
|
void SignatureHandlerLibrary::add(uint64_t fingerprint, address handler) {
|
|
|
|
int handler_index = -1;
|
|
|
|
// use customized signature handler
|
|
|
|
MutexLocker mu(SignatureHandlerLibrary_lock);
|
|
|
|
// make sure data structure is initialized
|
|
|
|
initialize();
|
|
|
|
fingerprint = InterpreterRuntime::normalize_fast_native_fingerprint(fingerprint);
|
|
|
|
handler_index = _fingerprints->find(fingerprint);
|
|
|
|
// create handler if necessary
|
|
|
|
if (handler_index < 0) {
|
|
|
|
if (PrintSignatureHandlers && (handler != Interpreter::slow_signature_handler())) {
|
|
|
|
tty->cr();
|
2015-08-04 06:52:46 -07:00
|
|
|
tty->print_cr("argument handler #%d at " PTR_FORMAT " for fingerprint " UINT64_FORMAT,
|
2015-07-01 10:53:26 +02:00
|
|
|
_handlers->length(),
|
2015-10-09 09:42:33 +02:00
|
|
|
p2i(handler),
|
2015-07-01 10:53:26 +02:00
|
|
|
fingerprint);
|
|
|
|
}
|
|
|
|
_fingerprints->append(fingerprint);
|
|
|
|
_handlers->append(handler);
|
|
|
|
} else {
|
|
|
|
if (PrintSignatureHandlers) {
|
|
|
|
tty->cr();
|
2015-08-04 06:52:46 -07:00
|
|
|
tty->print_cr("duplicate argument handler #%d for fingerprint " UINT64_FORMAT "(old: " PTR_FORMAT ", new : " PTR_FORMAT ")",
|
2015-07-01 10:53:26 +02:00
|
|
|
_handlers->length(),
|
|
|
|
fingerprint,
|
2015-10-09 09:42:33 +02:00
|
|
|
p2i(_handlers->at(handler_index)),
|
|
|
|
p2i(handler));
|
2015-07-01 10:53:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
BufferBlob* SignatureHandlerLibrary::_handler_blob = NULL;
|
|
|
|
address SignatureHandlerLibrary::_handler = NULL;
|
|
|
|
GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
|
|
|
|
GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL;
|
|
|
|
address SignatureHandlerLibrary::_buffer = NULL;
|
|
|
|
|
|
|
|
|
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
2012-09-01 13:25:18 -04:00
|
|
|
IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Method* method))
|
2007-12-01 00:00:00 +00:00
|
|
|
methodHandle m(thread, method);
|
|
|
|
assert(m->is_native(), "sanity check");
|
|
|
|
// lookup native function entry point if it doesn't exist
|
|
|
|
bool in_base_library;
|
|
|
|
if (!m->has_native_function()) {
|
|
|
|
NativeLookup::lookup(m, in_base_library, CHECK);
|
|
|
|
}
|
|
|
|
// make sure signature handler is installed
|
|
|
|
SignatureHandlerLibrary::add(m);
|
|
|
|
// The interpreter entry point checks the signature handler first,
|
|
|
|
// before trying to fetch the native entry point and klass mirror.
|
|
|
|
// We must set the signature handler last, so that multiple processors
|
|
|
|
// preparing the same method will be sure to see non-null entry & mirror.
|
|
|
|
IRT_END
|
|
|
|
|
2011-09-07 14:15:07 +02:00
|
|
|
#if defined(IA32) || defined(AMD64) || defined(ARM)
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address))
|
|
|
|
if (src_address == dest_address) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ResetNoHandleMark rnm; // In a LEAF entry.
|
|
|
|
HandleMark hm;
|
|
|
|
ResourceMark rm;
|
|
|
|
frame fr = thread->last_frame();
|
|
|
|
assert(fr.is_interpreted_frame(), "");
|
|
|
|
jint bci = fr.interpreter_frame_bci();
|
|
|
|
methodHandle mh(thread, fr.interpreter_frame_method());
|
2011-01-13 22:15:41 -08:00
|
|
|
Bytecode_invoke invoke(mh, bci);
|
|
|
|
ArgumentSizeComputer asc(invoke.signature());
|
|
|
|
int size_of_arguments = (asc.size() + (invoke.has_receiver() ? 1 : 0)); // receiver
|
2010-06-10 13:04:20 -07:00
|
|
|
Copy::conjoint_jbytes(src_address, dest_address,
|
2010-04-30 08:37:24 -07:00
|
|
|
size_of_arguments * Interpreter::stackElementSize);
|
2007-12-01 00:00:00 +00:00
|
|
|
IRT_END
|
|
|
|
#endif
|
2013-08-06 16:33:59 -07:00
|
|
|
|
|
|
|
#if INCLUDE_JVMTI
|
|
|
|
// This is a support of the JVMTI PopFrame interface.
|
|
|
|
// Make sure it is an invokestatic of a polymorphic intrinsic that has a member_name argument
|
|
|
|
// and return it as a vm_result so that it can be reloaded in the list of invokestatic parameters.
|
2014-05-29 09:41:07 +00:00
|
|
|
// The member_name argument is a saved reference (in local#0) to the member_name.
|
|
|
|
// For backward compatibility with some JDK versions (7, 8) it can also be a direct method handle.
|
|
|
|
// FIXME: remove DMH case after j.l.i.InvokerBytecodeGenerator code shape is updated.
|
|
|
|
IRT_ENTRY(void, InterpreterRuntime::member_name_arg_or_null(JavaThread* thread, address member_name,
|
2013-08-06 16:33:59 -07:00
|
|
|
Method* method, address bcp))
|
|
|
|
Bytecodes::Code code = Bytecodes::code_at(method, bcp);
|
|
|
|
if (code != Bytecodes::_invokestatic) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ConstantPool* cpool = method->constants();
|
|
|
|
int cp_index = Bytes::get_native_u2(bcp + 1) + ConstantPool::CPCACHE_INDEX_TAG;
|
|
|
|
Symbol* cname = cpool->klass_name_at(cpool->klass_ref_index_at(cp_index));
|
|
|
|
Symbol* mname = cpool->name_ref_at(cp_index);
|
|
|
|
|
|
|
|
if (MethodHandles::has_member_arg(cname, mname)) {
|
2014-05-29 09:41:07 +00:00
|
|
|
oop member_name_oop = (oop) member_name;
|
|
|
|
if (java_lang_invoke_DirectMethodHandle::is_instance(member_name_oop)) {
|
|
|
|
// FIXME: remove after j.l.i.InvokerBytecodeGenerator code shape is updated.
|
|
|
|
member_name_oop = java_lang_invoke_DirectMethodHandle::member(member_name_oop);
|
|
|
|
}
|
|
|
|
thread->set_vm_result(member_name_oop);
|
2015-04-29 17:14:40 -07:00
|
|
|
} else {
|
|
|
|
thread->set_vm_result(NULL);
|
2013-08-06 16:33:59 -07:00
|
|
|
}
|
|
|
|
IRT_END
|
|
|
|
#endif // INCLUDE_JVMTI
|
2016-03-18 15:14:22 -04:00
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
// This must be a IRT_LEAF function because the interpreter must save registers on x86 to
|
|
|
|
// call this, which changes rsp and makes the interpreter's expression stack not walkable.
|
|
|
|
// The generated code still uses call_VM because that will set up the frame pointer for
|
|
|
|
// bcp and method.
|
|
|
|
IRT_LEAF(intptr_t, InterpreterRuntime::trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2))
|
|
|
|
const frame f = thread->last_frame();
|
|
|
|
assert(f.is_interpreted_frame(), "must be an interpreted frame");
|
|
|
|
methodHandle mh(thread, f.interpreter_frame_method());
|
|
|
|
BytecodeTracer::trace(mh, f.interpreter_frame_bcp(), tos, tos2);
|
|
|
|
return preserve_this_value;
|
|
|
|
IRT_END
|
|
|
|
#endif // !PRODUCT
|