This commit is contained in:
Coleen Phillimore 2015-12-19 02:32:27 +01:00
commit f3f72fe573
7 changed files with 61 additions and 54 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ void StackMapFrame::initialize_object(
}
VerificationType StackMapFrame::set_locals_from_arg(
const methodHandle m, VerificationType thisKlass, TRAPS) {
const methodHandle& m, VerificationType thisKlass, TRAPS) {
SignatureStream ss(m->signature());
int init_local_num = 0;
if (!m->is_static()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -152,7 +152,7 @@ class StackMapFrame : public ResourceObj {
// Set local variable type array based on m's signature.
VerificationType set_locals_from_arg(
const methodHandle m, VerificationType thisKlass, TRAPS);
const methodHandle& m, VerificationType thisKlass, TRAPS);
// Search local variable type array and stack type array.
// Set every element with type of old_object to new_object.

View File

@ -1745,7 +1745,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
#undef bad_type_message
char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) {
char* ClassVerifier::generate_code_data(const methodHandle& m, u4 code_length, TRAPS) {
char* code_data = NEW_RESOURCE_ARRAY(char, code_length);
memset(code_data, 0, sizeof(char) * code_length);
RawBytecodeStream bcs(m);
@ -1814,9 +1814,9 @@ void ClassVerifier::verify_exception_handler_table(u4 code_length, char* code_da
}
void ClassVerifier::verify_local_variable_table(u4 code_length, char* code_data, TRAPS) {
int localvariable_table_length = _method()->localvariable_table_length();
int localvariable_table_length = _method->localvariable_table_length();
if (localvariable_table_length > 0) {
LocalVariableTableElement* table = _method()->localvariable_table_start();
LocalVariableTableElement* table = _method->localvariable_table_start();
for (int i = 0; i < localvariable_table_length; i++) {
u2 start_bci = table[i].start_bci;
u2 length = table[i].length;

View File

@ -264,7 +264,7 @@ class ClassVerifier : public StackObj {
ErrorContext _error_context; // contains information about an error
void verify_method(const methodHandle& method, TRAPS);
char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
char* generate_code_data(const methodHandle& m, u4 code_length, TRAPS);
void verify_exception_handler_table(u4 code_length, char* code_data,
int& min, int& max, TRAPS);
void verify_local_variable_table(u4 code_length, char* code_data, TRAPS);
@ -378,7 +378,7 @@ class ClassVerifier : public StackObj {
~ClassVerifier();
Thread* thread() { return _thread; }
methodHandle method() { return _method; }
const methodHandle& method() { return _method; }
instanceKlassHandle current_class() const { return _klass; }
VerificationType current_type() const { return _this_type; }

View File

@ -86,7 +86,7 @@ class BaseBytecodeStream: StackObj {
bool is_raw() const { return _is_raw; }
// Stream attributes
methodHandle method() const { return _method; }
const methodHandle& method() const { return _method; }
int bci() const { return _bci; }
int next_bci() const { return _next_bci; }

View File

@ -46,9 +46,58 @@ Handle::Handle(Thread* thread, oop obj) {
_handle = thread->handle_area()->allocate_handle(obj);
}
}
#endif
// Copy constructors and destructors for metadata handles
// These do too much to inline.
#define DEF_METADATA_HANDLE_FN_NOINLINE(name, type) \
name##Handle::name##Handle(const name##Handle &h) { \
_value = h._value; \
if (_value != NULL) { \
assert(_value->is_valid(), "obj is valid"); \
if (h._thread != NULL) { \
assert(h._thread == Thread::current(), "thread must be current");\
_thread = h._thread; \
} else { \
_thread = Thread::current(); \
} \
assert (_thread->is_in_stack((address)this), "not on stack?"); \
_thread->metadata_handles()->push((Metadata*)_value); \
} else { \
_thread = NULL; \
} \
} \
name##Handle& name##Handle::operator=(const name##Handle &s) { \
remove(); \
_value = s._value; \
if (_value != NULL) { \
assert(_value->is_valid(), "obj is valid"); \
if (s._thread != NULL) { \
assert(s._thread == Thread::current(), "thread must be current");\
_thread = s._thread; \
} else { \
_thread = Thread::current(); \
} \
assert (_thread->is_in_stack((address)this), "not on stack?"); \
_thread->metadata_handles()->push((Metadata*)_value); \
} else { \
_thread = NULL; \
} \
return *this; \
} \
inline void name##Handle::remove() { \
if (_value != NULL) { \
int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
assert(i!=-1, "not in metadata_handles list"); \
_thread->metadata_handles()->remove_at(i); \
} \
} \
name##Handle::~name##Handle () { remove(); } \
DEF_METADATA_HANDLE_FN_NOINLINE(method, Method)
DEF_METADATA_HANDLE_FN_NOINLINE(constantPool, ConstantPool)
static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
oop* bottom = (oop*) chunk->bottom();
oop* top = (oop*) chunk_top;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -69,48 +69,6 @@ inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thr
_thread->metadata_handles()->push((Metadata*)obj); \
} \
} \
inline name##Handle::name##Handle(const name##Handle &h) { \
_value = h._value; \
if (_value != NULL) { \
assert(_value->is_valid(), "obj is valid"); \
if (h._thread != NULL) { \
assert(h._thread == Thread::current(), "thread must be current");\
_thread = h._thread; \
} else { \
_thread = Thread::current(); \
} \
assert (_thread->is_in_stack((address)this), "not on stack?"); \
_thread->metadata_handles()->push((Metadata*)_value); \
} else { \
_thread = NULL; \
} \
} \
inline name##Handle& name##Handle::operator=(const name##Handle &s) { \
remove(); \
_value = s._value; \
if (_value != NULL) { \
assert(_value->is_valid(), "obj is valid"); \
if (s._thread != NULL) { \
assert(s._thread == Thread::current(), "thread must be current");\
_thread = s._thread; \
} else { \
_thread = Thread::current(); \
} \
assert (_thread->is_in_stack((address)this), "not on stack?"); \
_thread->metadata_handles()->push((Metadata*)_value); \
} else { \
_thread = NULL; \
} \
return *this; \
} \
inline void name##Handle::remove() { \
if (_value != NULL) { \
int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
assert(i!=-1, "not in metadata_handles list"); \
_thread->metadata_handles()->remove_at(i); \
} \
} \
inline name##Handle::~name##Handle () { remove(); } \
DEF_METADATA_HANDLE_FN(method, Method)
DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)