提交 1815187c 编写于 作者: R robm

Merge

......@@ -428,6 +428,7 @@ b5e7ebfe185cb4c2eeb8a919025fc6a26be2fcef jdk8-b131
e5561d89fe8bfc79cd6c8fcc36d270cc6a49ec6e jdk8u5-b02
2f9eb9fcab6c42c8c84ddb44170ea33235116d84 jdk8u5-b03
5ac720d47ab83f8eb2f5fe3641667823a0298f41 jdk8u5-b04
b90de55aca30678ab0fec05d6a61bb3468b783d2 jdk8u11-b00
b90de55aca30678ab0fec05d6a61bb3468b783d2 jdk8u5-b05
956c0e048ef29ee9a8026fb05858abe64b4e0ceb jdk8u5-b06
46fa2940e6861df18a107b6b83a2df85239e5ec7 jdk8u5-b07
......@@ -437,6 +438,20 @@ b90de55aca30678ab0fec05d6a61bb3468b783d2 jdk8u5-b05
17a75e692af397532e2b296b24f6b9b6c239c633 jdk8u5-b11
9b289963cb9a14636fbe8faaa2dd6d3678464a7b jdk8u5-b12
8a67179106085689906732013a282efeeb9bd5f4 jdk8u5-b13
5c7ef8e396835b82c0460b73f23cac86ba34846f jdk8u5-b31
f0d759a6a2309a1c149d530b29db24eda885f267 jdk8u11-b01
3c079aebb516765784dd8097887daadda5a76ac1 jdk8u11-b02
0037e964ce486c009984171f004259263628079f jdk8u11-b03
4c40343ecdb33fe046833fe4b8970fd29859c4ad jdk8u11-b04
a4d44dfb7d30eea54bc172e4429a655454ae0bbf jdk8u11-b05
b73ee2b9027c4183e520b2c0884d785ef9e539cf jdk8u11-b06
561045d225990b8423af11fd80d2d704954c89c2 jdk8u11-b07
af747c288b0f379448bebf56e2982f50caac6972 jdk8u11-b08
34de1e8eeabbcc6e690f92766fd619beb9f3f049 jdk8u11-b09
7e4ae023277bef5b82361fd985262f4009eb2fe8 jdk8u11-b10
e6b7384074325d5a4ede728d6928ecb7f1cc1326 jdk8u11-b11
78df957d46ebd98ba5bb68f4d9654c8bea3f1587 jdk8u11-b12
13f04650aa09df696d62a1912febe25fe4a64082 jdk8u11-b31
412d3b5fe90e54c0ff9d9ac7374b98607c561d5a hs25.20-b01
4638c4d7ff106db0f29ef7f18b128dd7e69bc470 hs25.20-b02
e56d11f8cc2158d4280f80e56d196193349c150a hs25.20-b03
......@@ -477,5 +492,10 @@ b685b4e870b159ea5731984199d275879d427038 hs25.20-b18
b15553cde967dfd7781a4a5c669e4cb7db734317 jdk8u20-b19
4f18dea0312d601d0515976bc0c643ea7acc829d hs25.20-b20
9e4d27da4ac04c6e19291087f7c68a5c5803c7ca jdk8u20-b20
4828415ebbf11e205dcc08e97ad5ae7dd03522f9 jdk8u20-b21
e4a6e7f1b90b85270aee1c54edaca3ef737082f1 hs25.20-b21
f7429096a202cab5c36a0f20dea33c554026010f jdk8u20-b22
7c56530b11496459e66cb9ea933035002311672c hs25.20-b22
f09d1f6a401e25a54dad44bb7bea482e47558af5 jdk8u20-b23
4828415ebbf11e205dcc08e97ad5ae7dd03522f9 jdk8u40-b00
d952af8cf67dd1e7ab5fec9a299c6c6dafd1863e hs25.40-b01
......@@ -1169,10 +1169,6 @@ void os::die() {
::abort();
}
// unused on bsd for now.
void os::set_error_file(const char *logfile) {}
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
......@@ -1827,6 +1823,7 @@ void os::jvm_path(char *buf, jint buflen) {
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
assert(len < buflen, "Ran out of buffer space");
jrelib_p = buf + len;
// Add the appropriate library subdir
......@@ -1860,7 +1857,7 @@ void os::jvm_path(char *buf, jint buflen) {
}
}
strcpy(saved_jvm_path, buf);
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
......
......@@ -1551,9 +1551,6 @@ void os::die() {
::abort();
}
// unused on linux for now.
void os::set_error_file(const char *logfile) {}
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
......@@ -2342,6 +2339,7 @@ void os::jvm_path(char *buf, jint buflen) {
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
assert(len < buflen, "Ran out of buffer room");
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
if (0 != access(buf, F_OK)) {
......@@ -2362,7 +2360,7 @@ void os::jvm_path(char *buf, jint buflen) {
}
}
strcpy(saved_jvm_path, buf);
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
......
......@@ -1711,9 +1711,6 @@ void os::die() {
::abort(); // dump core (for debugging)
}
// unused
void os::set_error_file(const char *logfile) {}
// DLL functions
const char* os::dll_file_extension() { return ".so"; }
......@@ -2357,6 +2354,7 @@ void os::jvm_path(char *buf, jint buflen) {
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
assert(len < buflen, "Ran out of buffer space");
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
if (0 != access(buf, F_OK)) {
......@@ -2375,7 +2373,7 @@ void os::jvm_path(char *buf, jint buflen) {
}
}
strcpy(saved_jvm_path, buf);
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -1820,7 +1820,8 @@ void os::jvm_path(char *buf, jint buflen) {
// libjvm.so is installed there (append a fake suffix
// hotspot/libjvm.so).
char* java_home_var = ::getenv("JAVA_HOME");
if (java_home_var != NULL && java_home_var[0] != 0) {
if (java_home_var != NULL && java_home_var[0] != 0 &&
strlen(java_home_var) < (size_t)buflen) {
strncpy(buf, java_home_var, buflen);
......@@ -1838,9 +1839,9 @@ void os::jvm_path(char *buf, jint buflen) {
}
if(buf[0] == '\0') {
GetModuleFileName(vm_lib_handle, buf, buflen);
GetModuleFileName(vm_lib_handle, buf, buflen);
}
strcpy(saved_jvm_path, buf);
strncpy(saved_jvm_path, buf, MAX_PATH);
}
......@@ -2291,19 +2292,8 @@ LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
}
*/
#endif //_WIN64
// Fatal error reporting is single threaded so we can make this a
// static and preallocated. If it's more than MAX_PATH silently ignore
// it.
static char saved_error_file[MAX_PATH] = {0};
#endif // _WIN64
void os::set_error_file(const char *logfile) {
if (strlen(logfile) <= MAX_PATH) {
strncpy(saved_error_file, logfile, MAX_PATH);
}
}
static inline void report_error(Thread* t, DWORD exception_code,
address addr, void* siginfo, void* context) {
......
......@@ -931,7 +931,7 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count,
"Wrong size %u for field's Signature attribute in class file %s",
attribute_length, CHECK);
}
generic_signature_index = cfs->get_u2(CHECK);
generic_signature_index = parse_generic_signature_attribute(CHECK);
} else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
runtime_visible_annotations_length = attribute_length;
runtime_visible_annotations = cfs->get_u1_buffer();
......@@ -2305,8 +2305,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
"Invalid Signature attribute length %u in class file %s",
method_attribute_length, CHECK_(nullHandle));
}
cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index
generic_signature_index = cfs->get_u2_fast();
generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle));
} else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
runtime_visible_annotations_length = method_attribute_length;
runtime_visible_annotations = cfs->get_u1_buffer();
......@@ -2616,6 +2615,17 @@ intArray* ClassFileParser::sort_methods(Array<Method*>* methods) {
return method_ordering;
}
// Parse generic_signature attribute for methods and fields
u2 ClassFileParser::parse_generic_signature_attribute(TRAPS) {
ClassFileStream* cfs = stream();
cfs->guarantee_more(2, CHECK_0); // generic_signature_index
u2 generic_signature_index = cfs->get_u2_fast();
check_property(
valid_symbol_at(generic_signature_index),
"Invalid Signature attribute at constant pool index %u in class file %s",
generic_signature_index, CHECK_0);
return generic_signature_index;
}
void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) {
ClassFileStream* cfs = stream();
......@@ -2770,7 +2780,13 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b
ClassFileStream* cfs = stream();
u1* current_start = cfs->current();
cfs->guarantee_more(2, CHECK); // length
guarantee_property(attribute_byte_length > sizeof(u2),
"Invalid BootstrapMethods attribute length %u in class file %s",
attribute_byte_length,
CHECK);
cfs->guarantee_more(attribute_byte_length, CHECK);
int attribute_array_length = cfs->get_u2_fast();
guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
......
......@@ -266,6 +266,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
u1* parse_stackmap_table(u4 code_attribute_length, TRAPS);
// Classfile attribute parsing
u2 parse_generic_signature_attribute(TRAPS);
void parse_classfile_sourcefile_attribute(TRAPS);
void parse_classfile_source_debug_extension_attribute(int length, TRAPS);
u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,
......
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, 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
......@@ -134,6 +134,7 @@ void StackMapTable::check_jump_target(
}
// check if uninitialized objects exist on backward branches
check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
frame->verifier()->update_furthest_jump(target);
}
void StackMapTable::check_new_object(
......
......@@ -633,6 +633,9 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
bool no_control_flow = false; // Set to true when there is no direct control
// flow from current instruction to the next
// instruction in sequence
set_furthest_jump(0);
Bytecodes::Code opcode;
while (!bcs.is_last_bytecode()) {
// Check for recursive re-verification before each bytecode.
......@@ -2248,6 +2251,29 @@ void ClassVerifier::verify_invoke_init(
"Bad <init> method call");
return;
}
// Make sure that this call is not jumped over.
if (bci < furthest_jump()) {
verify_error(ErrorContext::bad_code(bci),
"Bad <init> method call from inside of a branch");
return;
}
// Make sure that this call is not done from within a TRY block because
// that can result in returning an incomplete object. Simply checking
// (bci >= start_pc) also ensures that this call is not done after a TRY
// block. That is also illegal because this call must be the first Java
// statement in the constructor.
ExceptionTable exhandlers(_method());
int exlength = exhandlers.length();
for(int i = 0; i < exlength; i++) {
if (bci >= exhandlers.start_pc(i)) {
verify_error(ErrorContext::bad_code(bci),
"Bad <init> method call from after the start of a try block");
return;
}
}
current_frame->initialize_object(type, current_type());
*this_uninit = true;
} else if (type.is_uninitialized()) {
......@@ -2283,18 +2309,20 @@ void ClassVerifier::verify_invoke_init(
ref_class_type.name(), CHECK_VERIFY(this));
Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
vmSymbols::object_initializer_name(),
cp->signature_ref_at(bcs->get_index_u2()),
Klass::normal);
instanceKlassHandle mh(THREAD, m->method_holder());
if (m->is_protected() && !mh->is_same_class_package(_klass())) {
bool assignable = current_type().is_assignable_from(
objectref_type, this, CHECK_VERIFY(this));
if (!assignable) {
verify_error(ErrorContext::bad_type(bci,
TypeOrigin::cp(new_class_index, objectref_type),
TypeOrigin::implicit(current_type())),
"Bad access to protected <init> method");
return;
cp->signature_ref_at(bcs->get_index_u2()), Klass::normal);
// Do nothing if method is not found. Let resolution detect the error.
if (m != NULL) {
instanceKlassHandle mh(THREAD, m->method_holder());
if (m->is_protected() && !mh->is_same_class_package(_klass())) {
bool assignable = current_type().is_assignable_from(
objectref_type, this, CHECK_VERIFY(this));
if (!assignable) {
verify_error(ErrorContext::bad_type(bci,
TypeOrigin::cp(new_class_index, objectref_type),
TypeOrigin::implicit(current_type())),
"Bad access to protected <init> method");
return;
}
}
}
}
......
......@@ -258,6 +258,9 @@ class ClassVerifier : public StackObj {
ErrorContext _error_context; // contains information about an error
// Used to detect illegal jumps over calls to super() nd this() in ctors.
int32_t _furthest_jump;
void verify_method(methodHandle method, TRAPS);
char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
void verify_exception_handler_table(u4 code_length, char* code_data,
......@@ -403,6 +406,20 @@ class ClassVerifier : public StackObj {
Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
TypeOrigin ref_ctx(const char* str, TRAPS);
// Keep track of the furthest branch done in a method to make sure that
// there are no branches over calls to super() or this() from inside of
// a constructor.
int32_t furthest_jump() { return _furthest_jump; }
void set_furthest_jump(int32_t target) {
_furthest_jump = target;
}
void update_furthest_jump(int32_t target) {
if (target > _furthest_jump) _furthest_jump = target;
}
};
inline int ClassVerifier::change_sig_to_verificationType(
......
......@@ -2089,6 +2089,7 @@ void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method
ResourceMark rm;
char* method_name = method->name()->as_C_string();
strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
_last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated
char current_method[CompilerCounters::cmname_buffer_length];
size_t maxLen = CompilerCounters::cmname_buffer_length;
......
......@@ -251,6 +251,17 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
// For bytecodes not produced by javac together it is possible that a method does not override
// the superclass's method, but might indirectly override a super-super class's vtable entry
// If none found, return a null superk, else return the superk of the method this does override
// For public and protected methods: if they override a superclass, they will
// also be overridden themselves appropriately.
// Private methods do not override and are not overridden.
// Package Private methods are trickier:
// e.g. P1.A, pub m
// P2.B extends A, package private m
// P1.C extends B, public m
// P1.C.m needs to override P1.A.m and can not override P2.B.m
// Therefore: all package private methods need their own vtable entries for
// them to be the root of an inheritance overriding decision
// Package private methods may also override other vtable entries
InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
InstanceKlass* superk = initialsuper;
......@@ -398,8 +409,11 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
target_classname, THREAD))
!= (InstanceKlass*)NULL))))
{
// overriding, so no new entry
allocate_new = false;
// Package private methods always need a new entry to root their own
// overriding. They may also override other methods.
if (!target_method()->is_package_private()) {
allocate_new = false;
}
if (checkconstraints) {
// Override vtable entry if passes loader constraint check
......@@ -543,8 +557,9 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
AccessFlags class_flags,
TRAPS) {
if (class_flags.is_interface()) {
// Interfaces do not use vtables, so there is no point to assigning
// a vtable index to any of their methods. If we refrain from doing this,
// Interfaces do not use vtables, except for java.lang.Object methods,
// so there is no point to assigning
// a vtable index to any of their local methods. If we refrain from doing this,
// we can use Method::_vtable_index to hold the itable index
return false;
}
......@@ -582,6 +597,12 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
return true;
}
// Package private methods always need a new entry to root their own
// overriding. This allows transitive overriding to work.
if (target_method()->is_package_private()) {
return true;
}
// search through the super class hierarchy to see if we need
// a new entry
ResourceMark rm;
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -480,9 +480,6 @@ class os: AllStatic {
// run cmd in a separate process and return its exit code; or -1 on failures
static int fork_and_exec(char *cmd);
// Set file to send error reports.
static void set_error_file(const char *logfile);
// os::exit() is merged with vm_exit()
// static void exit(int num);
......
......@@ -988,7 +988,6 @@ void VMError::report_and_die() {
if (fd != -1) {
out.print_raw("# An error report file with more information is saved as:\n# ");
out.print_raw_cr(buffer);
os::set_error_file(buffer);
log.set_fd(fd);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册