提交 b885f6df 编写于 作者: P phh

8064811: Use THEAD instead of CHECK_NULL in return statements

Summary: Backport from JDK9
Reviewed-by: dholmes, coffeys
上级 29c0d447
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
......@@ -706,7 +706,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
return get_user_name_slow(vmid, CHECK_NULL);
return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
......
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, 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
......@@ -615,7 +615,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
return get_user_name_slow(vmid, CHECK_NULL);
return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
......
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, 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
......@@ -627,7 +627,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// return the name of the user that owns the JVM indicated by the given vmid.
//
static char* get_user_name(int vmid, TRAPS) {
return get_user_name_slow(vmid, CHECK_NULL);
return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
......
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, 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
......@@ -666,7 +666,7 @@ static char* get_user_name(int vmid, TRAPS) {
// since the structured procfs and old procfs interfaces can't be
// mixed, we attempt to find the file through a directory search.
return get_user_name_slow(vmid, CHECK_NULL);
return get_user_name_slow(vmid, THREAD);
}
// return the file name of the backing store file for the named
......
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
/*
* Copyright (c) 2013, 2018, 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
......@@ -329,7 +330,7 @@ class CompileReplay : public StackObj {
// Lookup a klass
Klass* resolve_klass(const char* klass, TRAPS) {
Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL);
return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL);
return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD);
}
// Parse the standard tuple of <klass> <name> <signature>
......
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
......@@ -488,7 +488,7 @@ void ClassLoaderData::free_deallocate_list() {
// These anonymous class loaders are to contain classes used for JSR292
ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
// Add a new class loader data to the graph.
return ClassLoaderDataGraph::add(loader, true, CHECK_NULL);
return ClassLoaderDataGraph::add(loader, true, THREAD);
}
const char* ClassLoaderData::loader_name() {
......
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
......@@ -493,7 +493,7 @@ class MethodFamily : public ResourceObj {
};
Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const {
return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL);
return SymbolTable::new_symbol("No qualifying defaults found", THREAD);
}
Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const {
......
......@@ -1961,7 +1961,7 @@ Handle java_lang_reflect_Method::create(TRAPS) {
// This class is eagerly initialized during VM initialization, since we keep a refence
// to one of the methods
assert(InstanceKlass::cast(klass)->is_initialized(), "must be initialized");
return InstanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH);
return InstanceKlass::cast(klass)->allocate_instance_handle(THREAD);
}
oop java_lang_reflect_Method::clazz(oop reflect) {
......
......@@ -121,7 +121,7 @@ void SystemDictionary::compute_java_system_loader(TRAPS) {
ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) {
if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data();
return ClassLoaderDataGraph::find_or_create(class_loader, CHECK_NULL);
return ClassLoaderDataGraph::find_or_create(class_loader, THREAD);
}
// ----------------------------------------------------------------------------
......
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
......@@ -289,7 +289,7 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
if (is_reference() && from.is_reference()) {
return is_reference_assignable_from(from, context,
from_field_is_protected,
CHECK_false);
THREAD);
} else {
return false;
}
......
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -66,8 +66,7 @@ void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
size_t word_size, bool read_only,
MetaspaceObj::Type type, TRAPS) throw() {
// Klass has it's own operator new
return Metaspace::allocate(loader_data, word_size, read_only,
type, CHECK_NULL);
return Metaspace::allocate(loader_data, word_size, read_only, type, THREAD);
}
bool MetaspaceObj::is_shared() const {
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -41,20 +41,20 @@ class vframeArray;
class oopFactory: AllStatic {
public:
// Basic type leaf array allocation
static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, CHECK_NULL); }
static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, CHECK_NULL); }
static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, CHECK_NULL); }
static typeArrayOop new_boolArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, THREAD); }
static typeArrayOop new_charArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, THREAD); }
static typeArrayOop new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, THREAD); }
static typeArrayOop new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, THREAD); }
static typeArrayOop new_byteArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, THREAD); }
static typeArrayOop new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, THREAD); }
static typeArrayOop new_intArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, THREAD); }
static typeArrayOop new_longArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, THREAD); }
// create java.lang.Object[]
static objArrayOop new_objectArray(int length, TRAPS) {
assert(Universe::objectArrayKlassObj() != NULL, "Too early?");
return ObjArrayKlass::
cast(Universe::objectArrayKlassObj())->allocate(length, CHECK_NULL);
cast(Universe::objectArrayKlassObj())->allocate(length, THREAD);
}
static typeArrayOop new_charArray (const char* utf8_str, TRAPS);
......
......@@ -530,7 +530,7 @@ int ConstantPool::signature_ref_index_at(int which_nt) {
Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
return klass_at(klass_ref_index_at(which), CHECK_NULL);
return klass_at(klass_ref_index_at(which), THREAD);
}
......
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -581,7 +581,7 @@ bool InstanceKlass::verify_code(
// 1) Verify the bytecodes
Verifier::Mode mode =
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
return Verifier::verify(this_oop, mode, this_oop->should_verify_class(), CHECK_false);
return Verifier::verify(this_oop, mode, this_oop->should_verify_class(), THREAD);
}
......@@ -1195,7 +1195,7 @@ Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_oop, bool or_nul
if (or_null) {
return oak->array_klass_or_null(n);
}
return oak->array_klass(n, CHECK_NULL);
return oak->array_klass(n, THREAD);
}
Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
......
......@@ -165,7 +165,7 @@ Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, OverpassL
void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
return Metaspace::allocate(loader_data, word_size, /*read_only*/false,
MetaspaceObj::ClassType, CHECK_NULL);
MetaspaceObj::ClassType, THREAD);
}
Klass::Klass() {
......
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
......@@ -681,7 +681,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, methodHandle meth
int size = MethodData::compute_allocation_size_in_words(method);
return new (loader_data, size, false, MetaspaceObj::MethodDataType, THREAD)
MethodData(method(), size, CHECK_NULL);
MethodData(method(), size, THREAD);
}
int MethodData::bytecode_cell_count(Bytecodes::Code code) {
......
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -189,7 +189,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
int size = objArrayOopDesc::object_size(length);
KlassHandle h_k(THREAD, this);
return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL);
return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, THREAD);
} else {
report_java_out_of_memory("Requested array size exceeds VM limit");
JvmtiExport::post_array_size_exhausted();
......@@ -362,11 +362,11 @@ Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
if (or_null) {
return ak->array_klass_or_null(n);
}
return ak->array_klass(n, CHECK_NULL);
return ak->array_klass(n, THREAD);
}
Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) {
return array_klass_impl(or_null, dimension() + 1, CHECK_NULL);
return array_klass_impl(or_null, dimension() + 1, THREAD);
}
bool ObjArrayKlass::can_be_primary_super_slow() const {
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -191,7 +191,7 @@ Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
if (or_null) {
return h_ak->array_klass_or_null(n);
}
return h_ak->array_klass(n, CHECK_NULL);
return h_ak->array_klass(n, THREAD);
}
Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) {
......
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, 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
......@@ -391,12 +391,12 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb
// convert the external string or reflective type to an internal signature
Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) {
if (java_lang_invoke_MethodType::is_instance(type_str)) {
return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, CHECK_NULL);
return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, THREAD);
} else if (java_lang_Class::is_instance(type_str)) {
return java_lang_Class::as_signature(type_str, false, CHECK_NULL);
return java_lang_Class::as_signature(type_str, false, THREAD);
} else if (java_lang_String::is_instance(type_str)) {
if (intern_if_not_found) {
return java_lang_String::as_symbol(type_str, CHECK_NULL);
return java_lang_String::as_symbol(type_str, THREAD);
} else {
return java_lang_String::as_symbol_or_null(type_str);
}
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -94,7 +94,7 @@ jdouble fieldDescriptor::double_initial_value() const {
}
oop fieldDescriptor::string_initial_value(TRAPS) const {
return constants()->uncached_string_at(initial_value_index(), CHECK_0);
return constants()->uncached_string_at(initial_value_index(), THREAD);
}
void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) {
......
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
......@@ -682,7 +682,7 @@ objArrayHandle Reflection::get_parameter_types(methodHandle method, int paramete
}
objArrayHandle Reflection::get_exception_types(methodHandle method, TRAPS) {
return method->resolved_checked_exceptions(CHECK_(objArrayHandle()));
return method->resolved_checked_exceptions(THREAD);
}
......
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, 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
......@@ -161,7 +161,7 @@ class ObjectLocker : public StackObj {
void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK);}
// complete_exit gives up lock completely, returning recursion count
// reenter reclaims lock with original recursion count
intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); }
void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
};
......
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, 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
......@@ -322,7 +322,7 @@ protected:
void* operator new(size_t size, ClassLoaderData* loader_data, int length, bool read_only, TRAPS) throw() {
size_t word_size = Array::size(length);
return (void*) Metaspace::allocate(loader_data, word_size, read_only,
MetaspaceObj::array_type(sizeof(T)), CHECK_NULL);
MetaspaceObj::array_type(sizeof(T)), THREAD);
}
static size_t byte_sizeof(int length) { return sizeof(Array<T>) + MAX2(length - 1, 0) * sizeof(T); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册