mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
Merge
This commit is contained in:
commit
bcb6a1586a
57 changed files with 886 additions and 191 deletions
|
@ -36,8 +36,7 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
|
|
||||||
extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result);
|
extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result);
|
||||||
extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result);
|
|
||||||
|
|
||||||
// Functions from the library we need (signatures should match those in picl.h)
|
// Functions from the library we need (signatures should match those in picl.h)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -130,60 +129,74 @@ class PICL {
|
||||||
bool is_inconsistent() { return _state == INCONSISTENT; }
|
bool is_inconsistent() { return _state == INCONSISTENT; }
|
||||||
void set_inconsistent() { _state = INCONSISTENT; }
|
void set_inconsistent() { _state = INCONSISTENT; }
|
||||||
|
|
||||||
static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) {
|
void visit(picl_nodehdl_t nodeh, const char* name) {
|
||||||
UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg);
|
assert(!is_inconsistent(), "Precondition");
|
||||||
PICL* picl = state->_picl;
|
|
||||||
assert(!state->is_inconsistent(), "Precondition");
|
|
||||||
int curr;
|
int curr;
|
||||||
if (picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) {
|
if (_picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) {
|
||||||
if (!state->is_assigned()) { // first iteration
|
if (!is_assigned()) { // first iteration
|
||||||
state->set_value(curr);
|
set_value(curr);
|
||||||
} else if (curr != state->value()) { // following iterations
|
} else if (curr != value()) { // following iterations
|
||||||
state->set_inconsistent();
|
set_inconsistent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state->is_inconsistent()) {
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CPUVisitor {
|
||||||
|
UniqueValueVisitor _l1_visitor;
|
||||||
|
UniqueValueVisitor _l2_visitor;
|
||||||
|
int _limit; // number of times visit() can be run
|
||||||
|
public:
|
||||||
|
CPUVisitor(PICL *picl, int limit) : _l1_visitor(picl), _l2_visitor(picl), _limit(limit) {}
|
||||||
|
static int visit(picl_nodehdl_t nodeh, void *arg) {
|
||||||
|
CPUVisitor *cpu_visitor = static_cast<CPUVisitor*>(arg);
|
||||||
|
UniqueValueVisitor* l1_visitor = cpu_visitor->l1_visitor();
|
||||||
|
UniqueValueVisitor* l2_visitor = cpu_visitor->l2_visitor();
|
||||||
|
if (!l1_visitor->is_inconsistent()) {
|
||||||
|
l1_visitor->visit(nodeh, "l1-dcache-line-size");
|
||||||
|
}
|
||||||
|
if (!l2_visitor->is_inconsistent()) {
|
||||||
|
l2_visitor->visit(nodeh, "l2-cache-line-size");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l1_visitor->is_inconsistent() && l2_visitor->is_inconsistent()) {
|
||||||
|
return PICL_WALK_TERMINATE;
|
||||||
|
}
|
||||||
|
cpu_visitor->_limit--;
|
||||||
|
if (cpu_visitor->_limit <= 0) {
|
||||||
return PICL_WALK_TERMINATE;
|
return PICL_WALK_TERMINATE;
|
||||||
}
|
}
|
||||||
return PICL_WALK_CONTINUE;
|
return PICL_WALK_CONTINUE;
|
||||||
}
|
}
|
||||||
|
UniqueValueVisitor* l1_visitor() { return &_l1_visitor; }
|
||||||
|
UniqueValueVisitor* l2_visitor() { return &_l2_visitor; }
|
||||||
};
|
};
|
||||||
|
|
||||||
int _L1_data_cache_line_size;
|
int _L1_data_cache_line_size;
|
||||||
int _L2_cache_line_size;
|
int _L2_cache_line_size;
|
||||||
public:
|
public:
|
||||||
static int get_l1_data_cache_line_size(picl_nodehdl_t nodeh, void *state) {
|
static int visit_cpu(picl_nodehdl_t nodeh, void *state) {
|
||||||
return UniqueValueVisitor::visit(nodeh, "l1-dcache-line-size", state);
|
return CPUVisitor::visit(nodeh, state);
|
||||||
}
|
|
||||||
static int get_l2_cache_line_size(picl_nodehdl_t nodeh, void *state) {
|
|
||||||
return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0), _dl_handle(NULL) {
|
PICL(bool is_fujitsu) : _L1_data_cache_line_size(0), _L2_cache_line_size(0), _dl_handle(NULL) {
|
||||||
if (!open_library()) {
|
if (!open_library()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_picl_initialize() == PICL_SUCCESS) {
|
if (_picl_initialize() == PICL_SUCCESS) {
|
||||||
picl_nodehdl_t rooth;
|
picl_nodehdl_t rooth;
|
||||||
if (_picl_get_root(&rooth) == PICL_SUCCESS) {
|
if (_picl_get_root(&rooth) == PICL_SUCCESS) {
|
||||||
UniqueValueVisitor L1_state(this);
|
const char* cpu_class = "cpu";
|
||||||
// Visit all "cpu" class instances
|
// If it's a Fujitsu machine, it's a "core"
|
||||||
_picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper);
|
if (is_fujitsu) {
|
||||||
if (L1_state.is_initial()) { // Still initial, iteration found no values
|
cpu_class = "core";
|
||||||
// Try walk all "core" class instances, it might be a Fujitsu machine
|
|
||||||
_picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper);
|
|
||||||
}
|
}
|
||||||
if (L1_state.is_assigned()) { // Is there a value?
|
CPUVisitor cpu_visitor(this, os::processor_count());
|
||||||
_L1_data_cache_line_size = L1_state.value();
|
_picl_walk_tree_by_class(rooth, cpu_class, &cpu_visitor, PICL_visit_cpu_helper);
|
||||||
|
if (cpu_visitor.l1_visitor()->is_assigned()) { // Is there a value?
|
||||||
|
_L1_data_cache_line_size = cpu_visitor.l1_visitor()->value();
|
||||||
}
|
}
|
||||||
|
if (cpu_visitor.l2_visitor()->is_assigned()) {
|
||||||
UniqueValueVisitor L2_state(this);
|
_L2_cache_line_size = cpu_visitor.l2_visitor()->value();
|
||||||
_picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper);
|
|
||||||
if (L2_state.is_initial()) {
|
|
||||||
_picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper);
|
|
||||||
}
|
|
||||||
if (L2_state.is_assigned()) {
|
|
||||||
_L2_cache_line_size = L2_state.value();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_picl_shutdown();
|
_picl_shutdown();
|
||||||
|
@ -195,11 +208,9 @@ public:
|
||||||
unsigned int L2_cache_line_size() const { return _L2_cache_line_size; }
|
unsigned int L2_cache_line_size() const { return _L2_cache_line_size; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) {
|
|
||||||
return PICL::get_l1_data_cache_line_size(nodeh, result);
|
extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result) {
|
||||||
}
|
return PICL::visit_cpu(nodeh, result);
|
||||||
extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) {
|
|
||||||
return PICL::get_l2_cache_line_size(nodeh, result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FuncType>
|
template<typename FuncType>
|
||||||
|
@ -418,7 +429,7 @@ int VM_Version::platform_features(int features) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out cache line sizes using PICL
|
// Figure out cache line sizes using PICL
|
||||||
PICL picl;
|
PICL picl((features & sparc64_family_m) != 0);
|
||||||
_L1_data_cache_line_size = picl.L1_data_cache_line_size();
|
_L1_data_cache_line_size = picl.L1_data_cache_line_size();
|
||||||
_L2_cache_line_size = picl.L2_cache_line_size();
|
_L2_cache_line_size = picl.L2_cache_line_size();
|
||||||
|
|
||||||
|
|
|
@ -455,6 +455,7 @@
|
||||||
template(object_void_signature, "(Ljava/lang/Object;)V") \
|
template(object_void_signature, "(Ljava/lang/Object;)V") \
|
||||||
template(object_int_signature, "(Ljava/lang/Object;)I") \
|
template(object_int_signature, "(Ljava/lang/Object;)I") \
|
||||||
template(object_boolean_signature, "(Ljava/lang/Object;)Z") \
|
template(object_boolean_signature, "(Ljava/lang/Object;)Z") \
|
||||||
|
template(object_object_signature, "(Ljava/lang/Object;)Ljava/lang/Object;") \
|
||||||
template(string_void_signature, "(Ljava/lang/String;)V") \
|
template(string_void_signature, "(Ljava/lang/String;)V") \
|
||||||
template(string_int_signature, "(Ljava/lang/String;)I") \
|
template(string_int_signature, "(Ljava/lang/String;)I") \
|
||||||
template(throwable_void_signature, "(Ljava/lang/Throwable;)V") \
|
template(throwable_void_signature, "(Ljava/lang/Throwable;)V") \
|
||||||
|
@ -746,6 +747,8 @@
|
||||||
do_name( isPrimitive_name, "isPrimitive") \
|
do_name( isPrimitive_name, "isPrimitive") \
|
||||||
do_intrinsic(_getSuperclass, java_lang_Class, getSuperclass_name, void_class_signature, F_RN) \
|
do_intrinsic(_getSuperclass, java_lang_Class, getSuperclass_name, void_class_signature, F_RN) \
|
||||||
do_name( getSuperclass_name, "getSuperclass") \
|
do_name( getSuperclass_name, "getSuperclass") \
|
||||||
|
do_intrinsic(_Class_cast, java_lang_Class, Class_cast_name, object_object_signature, F_R) \
|
||||||
|
do_name( Class_cast_name, "cast") \
|
||||||
\
|
\
|
||||||
do_intrinsic(_getClassAccessFlags, sun_reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN) \
|
do_intrinsic(_getClassAccessFlags, sun_reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN) \
|
||||||
do_name( getClassAccessFlags_name, "getClassAccessFlags") \
|
do_name( getClassAccessFlags_name, "getClassAccessFlags") \
|
||||||
|
|
|
@ -1318,6 +1318,10 @@ void Method::init_intrinsic_id() {
|
||||||
vmIntrinsics::ID id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags);
|
vmIntrinsics::ID id = vmIntrinsics::find_id(klass_id, name_id, sig_id, flags);
|
||||||
if (id != vmIntrinsics::_none) {
|
if (id != vmIntrinsics::_none) {
|
||||||
set_intrinsic_id(id);
|
set_intrinsic_id(id);
|
||||||
|
if (id == vmIntrinsics::_Class_cast) {
|
||||||
|
// Even if the intrinsic is rejected, we want to inline this simple method.
|
||||||
|
set_force_inline(true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,9 +464,7 @@ Node* PhaseCFG::select(Block* block, Node_List &worklist, GrowableArray<int> &re
|
||||||
iop == Op_CreateEx || // Create-exception must start block
|
iop == Op_CreateEx || // Create-exception must start block
|
||||||
iop == Op_CheckCastPP
|
iop == Op_CheckCastPP
|
||||||
) {
|
) {
|
||||||
// select the node n
|
worklist.map(i,worklist.pop());
|
||||||
// remove n from worklist and retain the order of remaining nodes
|
|
||||||
worklist.remove((uint)i);
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,9 +550,7 @@ Node* PhaseCFG::select(Block* block, Node_List &worklist, GrowableArray<int> &re
|
||||||
assert(idx >= 0, "index should be set");
|
assert(idx >= 0, "index should be set");
|
||||||
Node *n = worklist[(uint)idx]; // Get the winner
|
Node *n = worklist[(uint)idx]; // Get the winner
|
||||||
|
|
||||||
// select the node n
|
worklist.map((uint)idx, worklist.pop()); // Compress worklist
|
||||||
// remove n from worklist and retain the order of remaining nodes
|
|
||||||
worklist.remove((uint)idx);
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,7 @@ class LibraryCallKit : public GraphKit {
|
||||||
bool inline_fp_conversions(vmIntrinsics::ID id);
|
bool inline_fp_conversions(vmIntrinsics::ID id);
|
||||||
bool inline_number_methods(vmIntrinsics::ID id);
|
bool inline_number_methods(vmIntrinsics::ID id);
|
||||||
bool inline_reference_get();
|
bool inline_reference_get();
|
||||||
|
bool inline_Class_cast();
|
||||||
bool inline_aescrypt_Block(vmIntrinsics::ID id);
|
bool inline_aescrypt_Block(vmIntrinsics::ID id);
|
||||||
bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
|
bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
|
||||||
Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
|
Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
|
||||||
|
@ -869,6 +870,8 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||||
|
|
||||||
case vmIntrinsics::_Reference_get: return inline_reference_get();
|
case vmIntrinsics::_Reference_get: return inline_reference_get();
|
||||||
|
|
||||||
|
case vmIntrinsics::_Class_cast: return inline_Class_cast();
|
||||||
|
|
||||||
case vmIntrinsics::_aescrypt_encryptBlock:
|
case vmIntrinsics::_aescrypt_encryptBlock:
|
||||||
case vmIntrinsics::_aescrypt_decryptBlock: return inline_aescrypt_Block(intrinsic_id());
|
case vmIntrinsics::_aescrypt_decryptBlock: return inline_aescrypt_Block(intrinsic_id());
|
||||||
|
|
||||||
|
@ -3546,6 +3549,89 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------inline_Class_cast-------------------
|
||||||
|
bool LibraryCallKit::inline_Class_cast() {
|
||||||
|
Node* mirror = argument(0); // Class
|
||||||
|
Node* obj = argument(1);
|
||||||
|
const TypeInstPtr* mirror_con = _gvn.type(mirror)->isa_instptr();
|
||||||
|
if (mirror_con == NULL) {
|
||||||
|
return false; // dead path (mirror->is_top()).
|
||||||
|
}
|
||||||
|
if (obj == NULL || obj->is_top()) {
|
||||||
|
return false; // dead path
|
||||||
|
}
|
||||||
|
const TypeOopPtr* tp = _gvn.type(obj)->isa_oopptr();
|
||||||
|
|
||||||
|
// First, see if Class.cast() can be folded statically.
|
||||||
|
// java_mirror_type() returns non-null for compile-time Class constants.
|
||||||
|
ciType* tm = mirror_con->java_mirror_type();
|
||||||
|
if (tm != NULL && tm->is_klass() &&
|
||||||
|
tp != NULL && tp->klass() != NULL) {
|
||||||
|
if (!tp->klass()->is_loaded()) {
|
||||||
|
// Don't use intrinsic when class is not loaded.
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
int static_res = C->static_subtype_check(tm->as_klass(), tp->klass());
|
||||||
|
if (static_res == Compile::SSC_always_true) {
|
||||||
|
// isInstance() is true - fold the code.
|
||||||
|
set_result(obj);
|
||||||
|
return true;
|
||||||
|
} else if (static_res == Compile::SSC_always_false) {
|
||||||
|
// Don't use intrinsic, have to throw ClassCastException.
|
||||||
|
// If the reference is null, the non-intrinsic bytecode will
|
||||||
|
// be optimized appropriately.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bailout intrinsic and do normal inlining if exception path is frequent.
|
||||||
|
if (too_many_traps(Deoptimization::Reason_intrinsic)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate dynamic checks.
|
||||||
|
// Class.cast() is java implementation of _checkcast bytecode.
|
||||||
|
// Do checkcast (Parse::do_checkcast()) optimizations here.
|
||||||
|
|
||||||
|
mirror = null_check(mirror);
|
||||||
|
// If mirror is dead, only null-path is taken.
|
||||||
|
if (stopped()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not-subtype or the mirror's klass ptr is NULL (in case it is a primitive).
|
||||||
|
enum { _bad_type_path = 1, _prim_path = 2, PATH_LIMIT };
|
||||||
|
RegionNode* region = new RegionNode(PATH_LIMIT);
|
||||||
|
record_for_igvn(region);
|
||||||
|
|
||||||
|
// Now load the mirror's klass metaobject, and null-check it.
|
||||||
|
// If kls is null, we have a primitive mirror and
|
||||||
|
// nothing is an instance of a primitive type.
|
||||||
|
Node* kls = load_klass_from_mirror(mirror, false, region, _prim_path);
|
||||||
|
|
||||||
|
Node* res = top();
|
||||||
|
if (!stopped()) {
|
||||||
|
Node* bad_type_ctrl = top();
|
||||||
|
// Do checkcast optimizations.
|
||||||
|
res = gen_checkcast(obj, kls, &bad_type_ctrl);
|
||||||
|
region->init_req(_bad_type_path, bad_type_ctrl);
|
||||||
|
}
|
||||||
|
if (region->in(_prim_path) != top() ||
|
||||||
|
region->in(_bad_type_path) != top()) {
|
||||||
|
// Let Interpreter throw ClassCastException.
|
||||||
|
PreserveJVMState pjvms(this);
|
||||||
|
set_control(_gvn.transform(region));
|
||||||
|
uncommon_trap(Deoptimization::Reason_intrinsic,
|
||||||
|
Deoptimization::Action_maybe_recompile);
|
||||||
|
}
|
||||||
|
if (!stopped()) {
|
||||||
|
set_result(res);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------inline_native_subtype_check------------------------
|
//--------------------------inline_native_subtype_check------------------------
|
||||||
// This intrinsic takes the JNI calls out of the heart of
|
// This intrinsic takes the JNI calls out of the heart of
|
||||||
// UnsafeFieldAccessorImpl.set, which improves Field.set, readObject, etc.
|
// UnsafeFieldAccessorImpl.set, which improves Field.set, readObject, etc.
|
||||||
|
@ -4611,6 +4697,10 @@ bool LibraryCallKit::inline_arraycopy() {
|
||||||
Node* dest_offset = argument(3); // type: int
|
Node* dest_offset = argument(3); // type: int
|
||||||
Node* length = argument(4); // type: int
|
Node* length = argument(4); // type: int
|
||||||
|
|
||||||
|
// Check for allocation before we add nodes that would confuse
|
||||||
|
// tightly_coupled_allocation()
|
||||||
|
AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
|
||||||
|
|
||||||
// The following tests must be performed
|
// The following tests must be performed
|
||||||
// (1) src and dest are arrays.
|
// (1) src and dest are arrays.
|
||||||
// (2) src and dest arrays must have elements of the same BasicType
|
// (2) src and dest arrays must have elements of the same BasicType
|
||||||
|
@ -4784,7 +4874,6 @@ bool LibraryCallKit::inline_arraycopy() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
|
|
||||||
ArrayCopyNode* ac = ArrayCopyNode::make(this, true, src, src_offset, dest, dest_offset, length, alloc != NULL,
|
ArrayCopyNode* ac = ArrayCopyNode::make(this, true, src, src_offset, dest, dest_offset, length, alloc != NULL,
|
||||||
// Create LoadRange and LoadKlass nodes for use during macro expansion here
|
// Create LoadRange and LoadKlass nodes for use during macro expansion here
|
||||||
// so the compiler has a chance to eliminate them: during macro expansion,
|
// so the compiler has a chance to eliminate them: during macro expansion,
|
||||||
|
|
|
@ -506,16 +506,6 @@ class AlwaysFalseClosure : public BoolObjectClosure {
|
||||||
|
|
||||||
static AlwaysFalseClosure always_false;
|
static AlwaysFalseClosure always_false;
|
||||||
|
|
||||||
class VM_WhiteBoxCleanMethodData : public VM_WhiteBoxOperation {
|
|
||||||
public:
|
|
||||||
VM_WhiteBoxCleanMethodData(MethodData* mdo) : _mdo(mdo) { }
|
|
||||||
void doit() {
|
|
||||||
_mdo->clean_method_data(&always_false);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
MethodData* _mdo;
|
|
||||||
};
|
|
||||||
|
|
||||||
WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||||
CHECK_JNI_EXCEPTION(env);
|
CHECK_JNI_EXCEPTION(env);
|
||||||
|
@ -531,8 +521,8 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||||
for (int i = 0; i < arg_count; i++) {
|
for (int i = 0; i < arg_count; i++) {
|
||||||
mdo->set_arg_modified(i, 0);
|
mdo->set_arg_modified(i, 0);
|
||||||
}
|
}
|
||||||
VM_WhiteBoxCleanMethodData op(mdo);
|
MutexLockerEx mu(mdo->extra_data_lock());
|
||||||
VMThread::execute(&op);
|
mdo->clean_method_data(&always_false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mh->clear_not_c1_compilable();
|
mh->clear_not_c1_compilable();
|
||||||
|
@ -800,20 +790,24 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo
|
||||||
ThreadToNativeFromVM ttn(thread);
|
ThreadToNativeFromVM ttn(thread);
|
||||||
jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
|
jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
|
||||||
CHECK_JNI_EXCEPTION_(env, NULL);
|
CHECK_JNI_EXCEPTION_(env, NULL);
|
||||||
result = env->NewObjectArray(2, clazz, NULL);
|
result = env->NewObjectArray(3, clazz, NULL);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
jobject obj = integerBox(thread, env, code->comp_level());
|
jobject level = integerBox(thread, env, code->comp_level());
|
||||||
CHECK_JNI_EXCEPTION_(env, NULL);
|
CHECK_JNI_EXCEPTION_(env, NULL);
|
||||||
env->SetObjectArrayElement(result, 0, obj);
|
env->SetObjectArrayElement(result, 0, level);
|
||||||
|
|
||||||
jbyteArray insts = env->NewByteArray(insts_size);
|
jbyteArray insts = env->NewByteArray(insts_size);
|
||||||
CHECK_JNI_EXCEPTION_(env, NULL);
|
CHECK_JNI_EXCEPTION_(env, NULL);
|
||||||
env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
|
env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
|
||||||
env->SetObjectArrayElement(result, 1, insts);
|
env->SetObjectArrayElement(result, 1, insts);
|
||||||
|
|
||||||
|
jobject id = integerBox(thread, env, code->compile_id());
|
||||||
|
CHECK_JNI_EXCEPTION_(env, NULL);
|
||||||
|
env->SetObjectArrayElement(result, 2, id);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
|
|
@ -187,19 +187,22 @@ void InterfaceSupport::zap_dead_locals_old() {
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// invocation counter for InterfaceSupport::deoptimizeAll/zombieAll functions
|
||||||
int deoptimizeAllCounter = 0;
|
int deoptimizeAllCounter = 0;
|
||||||
int zombieAllCounter = 0;
|
int zombieAllCounter = 0;
|
||||||
|
|
||||||
|
|
||||||
void InterfaceSupport::zombieAll() {
|
void InterfaceSupport::zombieAll() {
|
||||||
if (is_init_completed() && zombieAllCounter > ZombieALotInterval) {
|
// This method is called by all threads when a thread make
|
||||||
|
// transition to VM state (for example, runtime calls).
|
||||||
|
// Divide number of calls by number of threads to avoid
|
||||||
|
// dependence of ZombieAll events frequency on number of threads.
|
||||||
|
int value = zombieAllCounter / Threads::number_of_threads();
|
||||||
|
if (is_init_completed() && value > ZombieALotInterval) {
|
||||||
zombieAllCounter = 0;
|
zombieAllCounter = 0;
|
||||||
VM_ZombieAll op;
|
VM_ZombieAll op;
|
||||||
VMThread::execute(&op);
|
VMThread::execute(&op);
|
||||||
} else {
|
|
||||||
zombieAllCounter++;
|
|
||||||
}
|
}
|
||||||
|
zombieAllCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterfaceSupport::unlinkSymbols() {
|
void InterfaceSupport::unlinkSymbols() {
|
||||||
|
@ -208,12 +211,17 @@ void InterfaceSupport::unlinkSymbols() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterfaceSupport::deoptimizeAll() {
|
void InterfaceSupport::deoptimizeAll() {
|
||||||
if (is_init_completed() ) {
|
// This method is called by all threads when a thread make
|
||||||
if (DeoptimizeALot && deoptimizeAllCounter > DeoptimizeALotInterval) {
|
// transition to VM state (for example, runtime calls).
|
||||||
|
// Divide number of calls by number of threads to avoid
|
||||||
|
// dependence of DeoptimizeAll events frequency on number of threads.
|
||||||
|
int value = deoptimizeAllCounter / Threads::number_of_threads();
|
||||||
|
if (is_init_completed()) {
|
||||||
|
if (DeoptimizeALot && value > DeoptimizeALotInterval) {
|
||||||
deoptimizeAllCounter = 0;
|
deoptimizeAllCounter = 0;
|
||||||
VM_DeoptimizeAll op;
|
VM_DeoptimizeAll op;
|
||||||
VMThread::execute(&op);
|
VMThread::execute(&op);
|
||||||
} else if (DeoptimizeRandom && (deoptimizeAllCounter & 0x1f) == (os::random() & 0x1f)) {
|
} else if (DeoptimizeRandom && (value & 0x1F) == (os::random() & 0x1F)) {
|
||||||
VM_DeoptimizeAll op;
|
VM_DeoptimizeAll op;
|
||||||
VMThread::execute(&op);
|
VMThread::execute(&op);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,6 @@ nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
|
||||||
// Don't trigger other compiles in testing mode
|
// Don't trigger other compiles in testing mode
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nmethod *osr_nm = NULL;
|
|
||||||
|
|
||||||
handle_counter_overflow(method());
|
handle_counter_overflow(method());
|
||||||
if (method() != inlinee()) {
|
if (method() != inlinee()) {
|
||||||
|
@ -210,14 +209,16 @@ nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
|
||||||
if (bci == InvocationEntryBci) {
|
if (bci == InvocationEntryBci) {
|
||||||
method_invocation_event(method, inlinee, comp_level, nm, thread);
|
method_invocation_event(method, inlinee, comp_level, nm, thread);
|
||||||
} else {
|
} else {
|
||||||
method_back_branch_event(method, inlinee, bci, comp_level, nm, thread);
|
|
||||||
// method == inlinee if the event originated in the main method
|
// method == inlinee if the event originated in the main method
|
||||||
int highest_level = inlinee->highest_osr_comp_level();
|
method_back_branch_event(method, inlinee, bci, comp_level, nm, thread);
|
||||||
if (highest_level > comp_level) {
|
// Check if event led to a higher level OSR compilation
|
||||||
osr_nm = inlinee->lookup_osr_nmethod_for(bci, highest_level, false);
|
nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false);
|
||||||
}
|
if (osr_nm != NULL && osr_nm->comp_level() > comp_level) {
|
||||||
}
|
// Perform OSR with new nmethod
|
||||||
return osr_nm;
|
return osr_nm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the method can be compiled, change level if necessary
|
// Check if the method can be compiled, change level if necessary
|
||||||
|
|
|
@ -478,6 +478,7 @@ hotspot_compiler_3 = \
|
||||||
compiler/intrinsics/mathexact/SubExactILoopDependentTest.java \
|
compiler/intrinsics/mathexact/SubExactILoopDependentTest.java \
|
||||||
compiler/intrinsics/stringequals/TestStringEqualsBadLength.java \
|
compiler/intrinsics/stringequals/TestStringEqualsBadLength.java \
|
||||||
compiler/intrinsics/unsafe/UnsafeGetAddressTest.java \
|
compiler/intrinsics/unsafe/UnsafeGetAddressTest.java \
|
||||||
|
compiler/intrinsics/classcast/NullCheckDroppingsTest.java \
|
||||||
compiler/jsr292/ConcurrentClassLoadingTest.java \
|
compiler/jsr292/ConcurrentClassLoadingTest.java \
|
||||||
compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java \
|
compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java \
|
||||||
compiler/loopopts/TestLogSum.java \
|
compiler/loopopts/TestLogSum.java \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,13 +25,20 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 6896617
|
* @bug 6896617
|
||||||
* @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86
|
* @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86
|
||||||
|
* @library /testlibrary
|
||||||
* @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617
|
* @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
import java.nio.*;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.*;
|
import java.nio.CharBuffer;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.CharsetDecoder;
|
||||||
|
import java.nio.charset.CharsetEncoder;
|
||||||
|
import java.nio.charset.CodingErrorAction;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Test6896617 {
|
public class Test6896617 {
|
||||||
final static int SIZE = 256;
|
final static int SIZE = 256;
|
||||||
|
@ -54,7 +61,7 @@ public class Test6896617 {
|
||||||
sun.nio.cs.ArrayDecoder arrdec = (sun.nio.cs.ArrayDecoder)dec;
|
sun.nio.cs.ArrayDecoder arrdec = (sun.nio.cs.ArrayDecoder)dec;
|
||||||
|
|
||||||
// Populate char[] with chars which can be encoded by ISO_8859_1 (<= 0xFF)
|
// Populate char[] with chars which can be encoded by ISO_8859_1 (<= 0xFF)
|
||||||
Random rnd = new Random(0);
|
Random rnd = Utils.getRandomInstance();
|
||||||
int maxchar = 0xFF;
|
int maxchar = 0xFF;
|
||||||
char[] a = new char[SIZE];
|
char[] a = new char[SIZE];
|
||||||
byte[] b = new byte[SIZE];
|
byte[] b = new byte[SIZE];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,11 +26,13 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 7100757
|
* @bug 7100757
|
||||||
* @summary The BitSet.nextSetBit() produces incorrect result in 32bit VM on Sparc
|
* @summary The BitSet.nextSetBit() produces incorrect result in 32bit VM on Sparc
|
||||||
*
|
* @library /testlibrary
|
||||||
* @run main/timeout=300 Test7100757
|
* @run main/timeout=300 Test7100757
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Test7100757 {
|
public class Test7100757 {
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ public class Test7100757 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
BitSet bs = new BitSet(NBITS);
|
BitSet bs = new BitSet(NBITS);
|
||||||
Random rnd = new Random();
|
Random rnd = Utils.getRandomInstance();
|
||||||
long[] ra = new long[(NBITS+63)/64];
|
long[] ra = new long[(NBITS+63)/64];
|
||||||
|
|
||||||
for(int l=0; l < 5000000; l++) {
|
for(int l=0; l < 5000000; l++) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,13 +26,14 @@
|
||||||
* Micro-benchmark for Math.pow() and Math.exp()
|
* Micro-benchmark for Math.pow() and Math.exp()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Test7177917 {
|
public class Test7177917 {
|
||||||
|
|
||||||
static double d;
|
static double d;
|
||||||
|
|
||||||
static Random r = new Random(0);
|
static final Random R = Utils.getRandomInstance();
|
||||||
|
|
||||||
static long m_pow(double[][] values) {
|
static long m_pow(double[][] values) {
|
||||||
double res = 0;
|
double res = 0;
|
||||||
|
@ -59,10 +60,10 @@ public class Test7177917 {
|
||||||
static double[][] pow_values(int nb) {
|
static double[][] pow_values(int nb) {
|
||||||
double[][] res = new double[nb][2];
|
double[][] res = new double[nb][2];
|
||||||
for (int i = 0; i < nb; i++) {
|
for (int i = 0; i < nb; i++) {
|
||||||
double ylogx = (1 + (r.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin
|
double ylogx = (1 + (R.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin
|
||||||
double x = Math.abs(Double.longBitsToDouble(r.nextLong()));
|
double x = Math.abs(Double.longBitsToDouble(R.nextLong()));
|
||||||
while (x != x) {
|
while (x != x) {
|
||||||
x = Math.abs(Double.longBitsToDouble(r.nextLong()));
|
x = Math.abs(Double.longBitsToDouble(R.nextLong()));
|
||||||
}
|
}
|
||||||
double logx = Math.log(x) / Math.log(2);
|
double logx = Math.log(x) / Math.log(2);
|
||||||
double y = ylogx / logx;
|
double y = ylogx / logx;
|
||||||
|
@ -76,7 +77,7 @@ public class Test7177917 {
|
||||||
static double[] exp_values(int nb) {
|
static double[] exp_values(int nb) {
|
||||||
double[] res = new double[nb];
|
double[] res = new double[nb];
|
||||||
for (int i = 0; i < nb; i++) {
|
for (int i = 0; i < nb; i++) {
|
||||||
double ylogx = (1 + (r.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin
|
double ylogx = (1 + (R.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin
|
||||||
double x = Math.E;
|
double x = Math.E;
|
||||||
double logx = Math.log(x) / Math.log(2);
|
double logx = Math.log(x) / Math.log(2);
|
||||||
double y = ylogx / logx;
|
double y = ylogx / logx;
|
||||||
|
|
|
@ -26,15 +26,13 @@
|
||||||
* @author Tom Deneau
|
* @author Tom Deneau
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.security.AlgorithmParameters;
|
||||||
|
import java.util.Random;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.KeyGenerator;
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.security.AlgorithmParameters;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
abstract public class TestAESBase {
|
abstract public class TestAESBase {
|
||||||
int msgSize = Integer.getInteger("msgSize", 646);
|
int msgSize = Integer.getInteger("msgSize", 646);
|
||||||
|
@ -59,7 +57,7 @@ abstract public class TestAESBase {
|
||||||
byte[] expectedEncode;
|
byte[] expectedEncode;
|
||||||
byte[] decode;
|
byte[] decode;
|
||||||
byte[] expectedDecode;
|
byte[] expectedDecode;
|
||||||
Random random = new Random(0);
|
final Random random = Utils.getRandomInstance();
|
||||||
Cipher cipher;
|
Cipher cipher;
|
||||||
Cipher dCipher;
|
Cipher dCipher;
|
||||||
AlgorithmParameters algParams;
|
AlgorithmParameters algParams;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 7184394
|
* @bug 7184394
|
||||||
* @summary add intrinsics to use AES instructions
|
* @summary add intrinsics to use AES instructions
|
||||||
|
* @library /testlibrary
|
||||||
*
|
*
|
||||||
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
|
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
|
||||||
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
|
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
//package com.polytechnik.utils;
|
|
||||||
/*
|
/*
|
||||||
* (C) Vladislav Malyshkin 2010
|
* (C) Vladislav Malyshkin 2010
|
||||||
* This file is under GPL version 3.
|
* This file is under GPL version 3.
|
||||||
|
@ -14,10 +13,14 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8005956
|
* @bug 8005956
|
||||||
* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
|
* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
|
||||||
*
|
* @library /testlibrary
|
||||||
* @run main/timeout=300 PolynomialRoot
|
* @run main/timeout=300 PolynomialRoot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class PolynomialRoot {
|
public class PolynomialRoot {
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +60,7 @@ private static final boolean PRINT_DEBUG=false;
|
||||||
|
|
||||||
public static int root4(final double [] p,final double [] re_root,final double [] im_root)
|
public static int root4(final double [] p,final double [] re_root,final double [] im_root)
|
||||||
{
|
{
|
||||||
if(PRINT_DEBUG) System.err.println("=====================root4:p="+java.util.Arrays.toString(p));
|
if (PRINT_DEBUG) { System.err.println("=====================root4:p=" + Arrays.toString(p)); }
|
||||||
final double vs=p[4];
|
final double vs=p[4];
|
||||||
if(PRINT_DEBUG) System.err.println("p[4]="+p[4]);
|
if(PRINT_DEBUG) System.err.println("p[4]="+p[4]);
|
||||||
if(!(Math.abs(vs)>EPS))
|
if(!(Math.abs(vs)>EPS))
|
||||||
|
@ -367,7 +370,7 @@ public static int root4(final double [] p,final double [] re_root,final double [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void setRandomP(final double [] p,final int n,java.util.Random r)
|
static void setRandomP(final double [] p, final int n, Random r)
|
||||||
{
|
{
|
||||||
if(r.nextDouble()<0.1)
|
if(r.nextDouble()<0.1)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +468,7 @@ public static int root4(final double [] p,final double [] re_root,final double [
|
||||||
|
|
||||||
static void testRoots(final int n,
|
static void testRoots(final int n,
|
||||||
final int n_tests,
|
final int n_tests,
|
||||||
final java.util.Random rn,
|
final Random rn,
|
||||||
final double eps)
|
final double eps)
|
||||||
{
|
{
|
||||||
final double [] p=new double [n+1];
|
final double [] p=new double [n+1];
|
||||||
|
@ -763,7 +766,7 @@ public static int root4(final double [] p,final double [] re_root,final double [
|
||||||
final long t0=System.currentTimeMillis();
|
final long t0=System.currentTimeMillis();
|
||||||
final double eps=1e-6;
|
final double eps=1e-6;
|
||||||
//checkRoots();
|
//checkRoots();
|
||||||
final java.util.Random r=new java.util.Random(-1381923);
|
final Random r = Utils.getRandomInstance();
|
||||||
printSpecialValues();
|
printSpecialValues();
|
||||||
|
|
||||||
final int n_tests=100000;
|
final int n_tests=100000;
|
||||||
|
|
|
@ -22,13 +22,17 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import com.oracle.java.testlibrary.Asserts;
|
||||||
|
import com.oracle.java.testlibrary.OutputAnalyzer;
|
||||||
|
import com.oracle.java.testlibrary.ProcessTools;
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
import com.oracle.java.testlibrary.*;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test runner that invokes all methods implemented by particular Expr
|
* Test runner that invokes all methods implemented by particular Expr
|
||||||
|
@ -69,7 +73,7 @@ public class BMITestRunner {
|
||||||
String... additionalVMOpts)
|
String... additionalVMOpts)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
|
|
||||||
int seed = new Random().nextInt();
|
int seed = Utils.getRandomInstance().nextInt();
|
||||||
int iterations = DEFAULT_ITERATIONS_COUNT;
|
int iterations = DEFAULT_ITERATIONS_COUNT;
|
||||||
|
|
||||||
for (String testOption : testOpts) {
|
for (String testOption : testOpts) {
|
||||||
|
@ -81,8 +85,6 @@ public class BMITestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Running test with seed: " + seed);
|
|
||||||
|
|
||||||
OutputAnalyzer intOutput = runTest(expr, VMMode.INT,
|
OutputAnalyzer intOutput = runTest(expr, VMMode.INT,
|
||||||
additionalVMOpts,
|
additionalVMOpts,
|
||||||
seed, iterations);
|
seed, iterations);
|
||||||
|
@ -139,9 +141,9 @@ public class BMITestRunner {
|
||||||
|
|
||||||
Collections.addAll(vmOpts, new String[] {
|
Collections.addAll(vmOpts, new String[] {
|
||||||
"-XX:+DisplayVMOutputToStderr",
|
"-XX:+DisplayVMOutputToStderr",
|
||||||
|
"-D" + Utils.SEED_PROPERTY_NAME + "=" + seed,
|
||||||
Executor.class.getName(),
|
Executor.class.getName(),
|
||||||
expr.getName(),
|
expr.getName(),
|
||||||
new Integer(seed).toString(),
|
|
||||||
new Integer(iterations).toString()
|
new Integer(iterations).toString()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -179,16 +181,15 @@ public class BMITestRunner {
|
||||||
public static class Executor {
|
public static class Executor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage: BMITestRunner$Executor <ExprClassName> <seed> <iterations>
|
* Usage: BMITestRunner$Executor <ExprClassName> <iterations>
|
||||||
*/
|
*/
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends Expr> exprClass =
|
Class<? extends Expr> exprClass =
|
||||||
(Class<? extends Expr>)Class.forName(args[0]);
|
(Class<? extends Expr>)Class.forName(args[0]);
|
||||||
Expr expr = exprClass.getConstructor().newInstance();
|
Expr expr = exprClass.getConstructor().newInstance();
|
||||||
Random rng = new Random(Integer.valueOf(args[1]));
|
int iterations = Integer.valueOf(args[1]);
|
||||||
int iterations = Integer.valueOf(args[2]);
|
runTests(expr, iterations, Utils.getRandomInstance());
|
||||||
runTests(expr, iterations, rng);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,346 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test NullCheckDroppingsTest
|
||||||
|
* @bug 8054492
|
||||||
|
* @summary "Casting can result in redundant null checks in generated code"
|
||||||
|
* @library /testlibrary /testlibrary/whitebox /testlibrary/com/oracle/java/testlibrary
|
||||||
|
* @build NullCheckDroppingsTest
|
||||||
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
|
* @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
|
||||||
|
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
|
||||||
|
* -Xmixed -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:CompileThreshold=1000
|
||||||
|
* -XX:CompileCommand=exclude,NullCheckDroppingsTest::runTest NullCheckDroppingsTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import sun.hotspot.WhiteBox;
|
||||||
|
import sun.hotspot.code.NMethod;
|
||||||
|
import com.oracle.java.testlibrary.Platform;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
|
public class NullCheckDroppingsTest {
|
||||||
|
|
||||||
|
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
|
||||||
|
|
||||||
|
static final BiFunction<Class, Object, Object> fCast = (c, o) -> c.cast(o);
|
||||||
|
|
||||||
|
static final MethodHandle SET_SSINK;
|
||||||
|
static final MethodHandle MH_CAST;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
SET_SSINK = MethodHandles.lookup().findSetter(NullCheckDroppingsTest.class, "ssink", String.class);
|
||||||
|
MH_CAST = MethodHandles.lookup().findVirtual(Class.class,
|
||||||
|
"cast",
|
||||||
|
MethodType.methodType(Object.class, Object.class));
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static volatile String svalue = "A";
|
||||||
|
static volatile String snull = null;
|
||||||
|
static volatile Integer iobj = new Integer(0);
|
||||||
|
static volatile int[] arr = new int[2];
|
||||||
|
static volatile Class objClass = String.class;
|
||||||
|
static volatile Class nullClass = null;
|
||||||
|
|
||||||
|
String ssink;
|
||||||
|
Integer isink;
|
||||||
|
int[] asink;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
// Only test C2 in Server VM
|
||||||
|
if (!Platform.isServer()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Make sure background compilation is disabled
|
||||||
|
if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {
|
||||||
|
throw new AssertionError("Background compilation enabled");
|
||||||
|
}
|
||||||
|
// Make sure Tiered compilation is disabled
|
||||||
|
if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) {
|
||||||
|
throw new AssertionError("Tiered compilation enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
Method methodClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class);
|
||||||
|
Method methodMHCast = NullCheckDroppingsTest.class.getDeclaredMethod("testMHCast", String.class);
|
||||||
|
Method methodMHSetter = NullCheckDroppingsTest.class.getDeclaredMethod("testMHSetter", String.class);
|
||||||
|
Method methodFunction = NullCheckDroppingsTest.class.getDeclaredMethod("testFunction", String.class);
|
||||||
|
|
||||||
|
NullCheckDroppingsTest t = new NullCheckDroppingsTest();
|
||||||
|
t.runTest(methodClassCast, false);
|
||||||
|
t.runTest(methodMHCast, false);
|
||||||
|
t.runTest(methodMHSetter, false);
|
||||||
|
t.runTest(methodFunction, false);
|
||||||
|
|
||||||
|
// Edge cases
|
||||||
|
Method methodClassCastNull = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastNull", String.class);
|
||||||
|
Method methodNullClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testNullClassCast", String.class);
|
||||||
|
Method methodClassCastObj = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastObj", Object.class);
|
||||||
|
Method methodObjClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testObjClassCast", String.class);
|
||||||
|
Method methodVarClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testVarClassCast", String.class);
|
||||||
|
Method methodClassCastInt = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastInt", Object.class);
|
||||||
|
Method methodIntClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testIntClassCast", Object.class);
|
||||||
|
Method methodClassCastint = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastint", Object.class);
|
||||||
|
Method methodintClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testintClassCast", Object.class);
|
||||||
|
Method methodClassCastPrim = NullCheckDroppingsTest.class.getDeclaredMethod("testClassCastPrim", Object.class);
|
||||||
|
Method methodPrimClassCast = NullCheckDroppingsTest.class.getDeclaredMethod("testPrimClassCast", Object.class);
|
||||||
|
|
||||||
|
t.runTest(methodClassCastNull, false);
|
||||||
|
t.runTest(methodNullClassCast, false);
|
||||||
|
t.runTest(methodClassCastObj, false);
|
||||||
|
t.runTest(methodObjClassCast, true);
|
||||||
|
t.runTest(methodVarClassCast, true);
|
||||||
|
t.runTest(methodClassCastInt, false);
|
||||||
|
t.runTest(methodIntClassCast, true);
|
||||||
|
t.runTest(methodClassCastint, false);
|
||||||
|
t.runTest(methodintClassCast, false);
|
||||||
|
t.runTest(methodClassCastPrim, false);
|
||||||
|
t.runTest(methodPrimClassCast, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCast(String s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCastNull(String s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(null);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testNullClassCast(String s) {
|
||||||
|
try {
|
||||||
|
ssink = (String)nullClass.cast(s);
|
||||||
|
throw new AssertionError("NullPointerException is not thrown");
|
||||||
|
} catch (NullPointerException t) {
|
||||||
|
// Ignore NullPointerException
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCastObj(Object s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testObjClassCast(String s) {
|
||||||
|
try {
|
||||||
|
ssink = (String)objClass.cast(s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testVarClassCast(String s) {
|
||||||
|
Class cl = (s == null) ? null : String.class;
|
||||||
|
try {
|
||||||
|
ssink = (String)cl.cast(svalue);
|
||||||
|
if (s == null) {
|
||||||
|
throw new AssertionError("NullPointerException is not thrown");
|
||||||
|
}
|
||||||
|
} catch (NullPointerException t) {
|
||||||
|
// Ignore NullPointerException
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCastInt(Object s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(iobj);
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast java.lang.Integer to java.lang.String
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testIntClassCast(Object s) {
|
||||||
|
try {
|
||||||
|
isink = Integer.class.cast(s);
|
||||||
|
if (s != null) {
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
}
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast java.lang.String to java.lang.Integer
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCastint(Object s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(45);
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast java.lang.Integer to java.lang.String
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testintClassCast(Object s) {
|
||||||
|
try {
|
||||||
|
isink = int.class.cast(s);
|
||||||
|
if (s != null) {
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
}
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast java.lang.String to java.lang.Integer
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testClassCastPrim(Object s) {
|
||||||
|
try {
|
||||||
|
ssink = String.class.cast(arr);
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast [I to java.lang.String
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testPrimClassCast(Object s) {
|
||||||
|
try {
|
||||||
|
asink = int[].class.cast(s);
|
||||||
|
if (s != null) {
|
||||||
|
throw new AssertionError("ClassCastException is not thrown");
|
||||||
|
}
|
||||||
|
} catch (ClassCastException t) {
|
||||||
|
// Ignore ClassCastException: Cannot cast java.lang.String to [I
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testMHCast(String s) {
|
||||||
|
try {
|
||||||
|
ssink = (String) (Object) MH_CAST.invokeExact(String.class, (Object) s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testMHSetter(String s) {
|
||||||
|
try {
|
||||||
|
SET_SSINK.invokeExact(this, s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFunction(String s) {
|
||||||
|
try {
|
||||||
|
ssink = (String) fCast.apply(String.class, s);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void runTest(Method method, boolean deopt) {
|
||||||
|
if (method == null) {
|
||||||
|
throw new AssertionError("method was not found");
|
||||||
|
}
|
||||||
|
// Ensure method is compiled
|
||||||
|
WHITE_BOX.testSetDontInlineMethod(method, true);
|
||||||
|
for (int i = 0; i < 3000; i++) {
|
||||||
|
try {
|
||||||
|
method.invoke(this, svalue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Error("Unexpected exception: ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NMethod nm = getNMethod(method);
|
||||||
|
|
||||||
|
// Passing null should cause a de-optimization
|
||||||
|
// if method is compiled with a null-check.
|
||||||
|
try {
|
||||||
|
method.invoke(this, snull);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Error("Unexpected exception: ", e);
|
||||||
|
}
|
||||||
|
checkDeoptimization(method, nm, deopt);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NMethod getNMethod(Method test) {
|
||||||
|
// Because background compilation is disabled, method should now be compiled
|
||||||
|
if (!WHITE_BOX.isMethodCompiled(test)) {
|
||||||
|
throw new AssertionError(test + " not compiled");
|
||||||
|
}
|
||||||
|
|
||||||
|
NMethod nm = NMethod.get(test, false); // not OSR nmethod
|
||||||
|
if (nm == null) {
|
||||||
|
throw new AssertionError(test + " missing nmethod?");
|
||||||
|
}
|
||||||
|
if (nm.comp_level != 4) {
|
||||||
|
throw new AssertionError(test + " compiled by not C2: " + nm);
|
||||||
|
}
|
||||||
|
return nm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkDeoptimization(Method method, NMethod nmOrig, boolean deopt) {
|
||||||
|
// Check deoptimization event (intrinsic Class.cast() works).
|
||||||
|
if (WHITE_BOX.isMethodCompiled(method) == deopt) {
|
||||||
|
throw new AssertionError(method + " was" + (deopt ? " not" : "") + " deoptimized");
|
||||||
|
}
|
||||||
|
if (deopt) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ensure no recompilation when no deoptimization is expected.
|
||||||
|
NMethod nm = NMethod.get(method, false); // not OSR nmethod
|
||||||
|
if (nm == null) {
|
||||||
|
throw new AssertionError(method + " missing nmethod?");
|
||||||
|
}
|
||||||
|
if (nm.comp_level != 4) {
|
||||||
|
throw new AssertionError(method + " compiled by not C2: " + nm);
|
||||||
|
}
|
||||||
|
if (nm.compile_id != nmOrig.compile_id) {
|
||||||
|
throw new AssertionError(method + " was recompiled: old nmethod=" + nmOrig + ", new nmethod=" + nm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8024924
|
* @bug 8024924
|
||||||
* @summary Test constant addExact
|
* @summary Test constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactIConstantTest.java Verify.java
|
* @compile AddExactIConstantTest.java Verify.java
|
||||||
* @run main AddExactIConstantTest
|
* @run main AddExactIConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8024924
|
* @bug 8024924
|
||||||
* @summary Test non constant addExact
|
* @summary Test non constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactILoadTest.java Verify.java
|
* @compile AddExactILoadTest.java Verify.java
|
||||||
* @run main AddExactILoadTest
|
* @run main AddExactILoadTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8024924
|
* @bug 8024924
|
||||||
* @summary Test non constant addExact
|
* @summary Test non constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactILoopDependentTest.java Verify.java
|
* @compile AddExactILoopDependentTest.java Verify.java
|
||||||
* @run main AddExactILoopDependentTest
|
* @run main AddExactILoopDependentTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8024924
|
* @bug 8024924
|
||||||
* @summary Test non constant addExact
|
* @summary Test non constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactINonConstantTest.java Verify.java
|
* @compile AddExactINonConstantTest.java Verify.java
|
||||||
* @run main AddExactINonConstantTest
|
* @run main AddExactINonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,11 +25,15 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8025657
|
* @bug 8025657
|
||||||
* @summary Test repeating addExact
|
* @summary Test repeating addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactIRepeatTest.java Verify.java
|
* @compile AddExactIRepeatTest.java Verify.java
|
||||||
* @run main AddExactIRepeatTest
|
* @run main AddExactIRepeatTest
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AddExactIRepeatTest {
|
public class AddExactIRepeatTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
runTest(new Verify.AddExactI());
|
runTest(new Verify.AddExactI());
|
||||||
|
@ -44,7 +48,7 @@ public class AddExactIRepeatTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTest(Verify.BinaryMethod method) {
|
public static void runTest(Verify.BinaryMethod method) {
|
||||||
java.util.Random rnd = new java.util.Random();
|
Random rnd = Utils.getRandomInstance();
|
||||||
for (int i = 0; i < 50000; ++i) {
|
for (int i = 0; i < 50000; ++i) {
|
||||||
int x = Integer.MAX_VALUE - 10;
|
int x = Integer.MAX_VALUE - 10;
|
||||||
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant addExact
|
* @summary Test constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactLConstantTest.java Verify.java
|
* @compile AddExactLConstantTest.java Verify.java
|
||||||
* @run main AddExactLConstantTest
|
* @run main AddExactLConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant addExact
|
* @summary Test non constant addExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile AddExactLNonConstantTest.java Verify.java
|
* @compile AddExactLNonConstantTest.java Verify.java
|
||||||
* @run main AddExactLNonConstantTest
|
* @run main AddExactLNonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test decrementExact
|
* @summary Test decrementExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile DecExactITest.java Verify.java
|
* @compile DecExactITest.java Verify.java
|
||||||
* @run main DecExactITest
|
* @run main DecExactITest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test decrementExact
|
* @summary Test decrementExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile DecExactLTest.java Verify.java
|
* @compile DecExactLTest.java Verify.java
|
||||||
* @run main DecExactLTest
|
* @run main DecExactLTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test incrementExact
|
* @summary Test incrementExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile IncExactITest.java Verify.java
|
* @compile IncExactITest.java Verify.java
|
||||||
* @run main IncExactITest
|
* @run main IncExactITest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test incrementExact
|
* @summary Test incrementExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile IncExactLTest.java Verify.java
|
* @compile IncExactLTest.java Verify.java
|
||||||
* @run main IncExactLTest
|
* @run main IncExactLTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant multiplyExact
|
* @summary Test constant multiplyExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactIConstantTest.java Verify.java
|
* @compile MulExactIConstantTest.java Verify.java
|
||||||
* @run main MulExactIConstantTest
|
* @run main MulExactIConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test multiplyExact
|
* @summary Test multiplyExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactILoadTest.java Verify.java
|
* @compile MulExactILoadTest.java Verify.java
|
||||||
* @run main MulExactILoadTest
|
* @run main MulExactILoadTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test loop dependent multiplyExact
|
* @summary Test loop dependent multiplyExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactILoopDependentTest.java Verify.java
|
* @compile MulExactILoopDependentTest.java Verify.java
|
||||||
* @run main MulExactILoopDependentTest
|
* @run main MulExactILoopDependentTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant multiplyExact
|
* @summary Test non constant multiplyExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactINonConstantTest.java Verify.java
|
* @compile MulExactINonConstantTest.java Verify.java
|
||||||
* @run main MulExactINonConstantTest
|
* @run main MulExactINonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,11 +25,15 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test repeating multiplyExact
|
* @summary Test repeating multiplyExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactIRepeatTest.java Verify.java
|
* @compile MulExactIRepeatTest.java Verify.java
|
||||||
* @run main MulExactIRepeatTest
|
* @run main MulExactIRepeatTest
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MulExactIRepeatTest {
|
public class MulExactIRepeatTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
runTest(new Verify.MulExactI());
|
runTest(new Verify.MulExactI());
|
||||||
|
@ -44,7 +48,7 @@ public class MulExactIRepeatTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTest(Verify.BinaryMethod method) {
|
public static void runTest(Verify.BinaryMethod method) {
|
||||||
java.util.Random rnd = new java.util.Random();
|
Random rnd = Utils.getRandomInstance();
|
||||||
for (int i = 0; i < 50000; ++i) {
|
for (int i = 0; i < 50000; ++i) {
|
||||||
int x = Integer.MAX_VALUE - 10;
|
int x = Integer.MAX_VALUE - 10;
|
||||||
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant mulExact
|
* @summary Test constant mulExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactLConstantTest.java Verify.java
|
* @compile MulExactLConstantTest.java Verify.java
|
||||||
* @run main MulExactLConstantTest
|
* @run main MulExactLConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant mulExact
|
* @summary Test non constant mulExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile MulExactLNonConstantTest.java Verify.java
|
* @compile MulExactLNonConstantTest.java Verify.java
|
||||||
* @run main MulExactLNonConstantTest
|
* @run main MulExactLNonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant negExact
|
* @summary Test constant negExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactIConstantTest.java Verify.java
|
* @compile NegExactIConstantTest.java Verify.java
|
||||||
* @run main NegExactIConstantTest
|
* @run main NegExactIConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test negExact
|
* @summary Test negExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactILoadTest.java Verify.java
|
* @compile NegExactILoadTest.java Verify.java
|
||||||
* @run main NegExactILoadTest
|
* @run main NegExactILoadTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test negExact loop dependent
|
* @summary Test negExact loop dependent
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactILoopDependentTest.java Verify.java
|
* @compile NegExactILoopDependentTest.java Verify.java
|
||||||
* @run main NegExactILoopDependentTest
|
* @run main NegExactILoopDependentTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant negExact
|
* @summary Test non constant negExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactINonConstantTest.java Verify.java
|
* @compile NegExactINonConstantTest.java Verify.java
|
||||||
* @run main NegExactINonConstantTest
|
* @run main NegExactINonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant negExact
|
* @summary Test constant negExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactLConstantTest.java Verify.java
|
* @compile NegExactLConstantTest.java Verify.java
|
||||||
* @run main NegExactLConstantTest
|
* @run main NegExactLConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant negExact
|
* @summary Test constant negExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile NegExactLNonConstantTest.java Verify.java
|
* @compile NegExactLNonConstantTest.java Verify.java
|
||||||
* @run main NegExactLNonConstantTest
|
* @run main NegExactLNonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test subtractExact as condition
|
* @summary Test subtractExact as condition
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactICondTest.java Verify.java
|
* @compile SubExactICondTest.java Verify.java
|
||||||
* @run main SubExactICondTest
|
* @run main SubExactICondTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test constant subtractExact
|
* @summary Test constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactIConstantTest.java Verify.java
|
* @compile SubExactIConstantTest.java Verify.java
|
||||||
* @run main SubExactIConstantTest
|
* @run main SubExactIConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant subtractExact
|
* @summary Test non constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactILoadTest.java Verify.java
|
* @compile SubExactILoadTest.java Verify.java
|
||||||
* @run main SubExactILoadTest
|
* @run main SubExactILoadTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant subtractExact
|
* @summary Test non constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactILoopDependentTest.java Verify.java
|
* @compile SubExactILoopDependentTest.java Verify.java
|
||||||
* @run main SubExactILoopDependentTest
|
* @run main SubExactILoopDependentTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test non constant subtractExact
|
* @summary Test non constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactINonConstantTest.java Verify.java
|
* @compile SubExactINonConstantTest.java Verify.java
|
||||||
* @run main SubExactINonConstantTest
|
* @run main SubExactINonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,12 +25,14 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @summary Test repeating subtractExact
|
* @summary Test repeating subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactIRepeatTest.java Verify.java
|
* @compile SubExactIRepeatTest.java Verify.java
|
||||||
* @run main SubExactIRepeatTest
|
* @run main SubExactIRepeatTest
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.ArithmeticException;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class SubExactIRepeatTest {
|
public class SubExactIRepeatTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -46,7 +48,7 @@ public class SubExactIRepeatTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTest(Verify.BinaryMethod method) {
|
public static void runTest(Verify.BinaryMethod method) {
|
||||||
java.util.Random rnd = new java.util.Random();
|
Random rnd = Utils.getRandomInstance();
|
||||||
for (int i = 0; i < 50000; ++i) {
|
for (int i = 0; i < 50000; ++i) {
|
||||||
int x = Integer.MIN_VALUE + 10;
|
int x = Integer.MIN_VALUE + 10;
|
||||||
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @bug 8027353
|
* @bug 8027353
|
||||||
* @summary Test constant subtractExact
|
* @summary Test constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactLConstantTest.java Verify.java
|
* @compile SubExactLConstantTest.java Verify.java
|
||||||
* @run main SubExactLConstantTest
|
* @run main SubExactLConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
* @bug 8026844
|
* @bug 8026844
|
||||||
* @bug 8027353
|
* @bug 8027353
|
||||||
* @summary Test non constant subtractExact
|
* @summary Test non constant subtractExact
|
||||||
|
* @library /testlibrary
|
||||||
* @compile SubExactLNonConstantTest.java Verify.java
|
* @compile SubExactLNonConstantTest.java Verify.java
|
||||||
* @run main SubExactLNonConstantTest
|
* @run main SubExactLNonConstantTest
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,6 +21,13 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class depends on Utils class from testlibrary package.
|
||||||
|
* It uses factory method that obtains random generator.
|
||||||
|
*/
|
||||||
public class Verify {
|
public class Verify {
|
||||||
public static String throwWord(boolean threw) {
|
public static String throwWord(boolean threw) {
|
||||||
return (threw ? "threw" : "didn't throw");
|
return (threw ? "threw" : "didn't throw");
|
||||||
|
@ -134,7 +141,7 @@ public class Verify {
|
||||||
|
|
||||||
|
|
||||||
public static class LoadTest {
|
public static class LoadTest {
|
||||||
public static java.util.Random rnd = new java.util.Random();
|
public static Random rnd = Utils.getRandomInstance();
|
||||||
public static int[] values = new int[256];
|
public static int[] values = new int[256];
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
@ -159,7 +166,7 @@ public class Verify {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NonConstantTest {
|
public static class NonConstantTest {
|
||||||
public static java.util.Random rnd = new java.util.Random();
|
public static Random rnd = Utils.getRandomInstance();
|
||||||
public static int[] values = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
|
public static int[] values = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
|
||||||
|
|
||||||
public static void verify(BinaryMethod method) {
|
public static void verify(BinaryMethod method) {
|
||||||
|
@ -180,7 +187,7 @@ public class Verify {
|
||||||
|
|
||||||
public static class NonConstantLongTest {
|
public static class NonConstantLongTest {
|
||||||
public static long[] values = { Long.MIN_VALUE, Long.MAX_VALUE, 0, Long.MAX_VALUE - 1831 };
|
public static long[] values = { Long.MIN_VALUE, Long.MAX_VALUE, 0, Long.MAX_VALUE - 1831 };
|
||||||
public static java.util.Random rnd = new java.util.Random();
|
public static Random rnd = Utils.getRandomInstance();
|
||||||
|
|
||||||
public static void verify(BinaryLongMethod method) {
|
public static void verify(BinaryLongMethod method) {
|
||||||
for (int i = 0; i < 50000; ++i) {
|
for (int i = 0; i < 50000; ++i) {
|
||||||
|
@ -199,7 +206,7 @@ public class Verify {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LoopDependentTest {
|
public static class LoopDependentTest {
|
||||||
public static java.util.Random rnd = new java.util.Random();
|
public static Random rnd = Utils.getRandomInstance();
|
||||||
|
|
||||||
public static void verify(BinaryMethod method) {
|
public static void verify(BinaryMethod method) {
|
||||||
int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
|
int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,18 +25,21 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8022595
|
* @bug 8022595
|
||||||
* @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives
|
* @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives
|
||||||
*
|
* @library /testlibrary
|
||||||
* @run main/othervm ConcurrentClassLoadingTest
|
* @run main/othervm ConcurrentClassLoadingTest
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.concurrent.BrokenBarrierException;
|
import java.util.concurrent.BrokenBarrierException;
|
||||||
import java.util.concurrent.CyclicBarrier;
|
import java.util.concurrent.CyclicBarrier;
|
||||||
|
|
||||||
public class ConcurrentClassLoadingTest {
|
public class ConcurrentClassLoadingTest {
|
||||||
int numThreads = 0;
|
int numThreads = 0;
|
||||||
long seed = 0;
|
|
||||||
CyclicBarrier l;
|
CyclicBarrier l;
|
||||||
Random rand;
|
private static final Random rand = Utils.getRandomInstance();
|
||||||
|
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
ConcurrentClassLoadingTest test = new ConcurrentClassLoadingTest();
|
ConcurrentClassLoadingTest test = new ConcurrentClassLoadingTest();
|
||||||
|
@ -49,9 +52,6 @@ public class ConcurrentClassLoadingTest {
|
||||||
while (i < args.length) {
|
while (i < args.length) {
|
||||||
String flag = args[i];
|
String flag = args[i];
|
||||||
switch(flag) {
|
switch(flag) {
|
||||||
case "-seed":
|
|
||||||
seed = Long.parseLong(args[++i]);
|
|
||||||
break;
|
|
||||||
case "-numThreads":
|
case "-numThreads":
|
||||||
numThreads = Integer.parseInt(args[++i]);
|
numThreads = Integer.parseInt(args[++i]);
|
||||||
break;
|
break;
|
||||||
|
@ -67,15 +67,9 @@ public class ConcurrentClassLoadingTest {
|
||||||
numThreads = Runtime.getRuntime().availableProcessors();
|
numThreads = Runtime.getRuntime().availableProcessors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seed == 0) {
|
|
||||||
seed = (new Random()).nextLong();
|
|
||||||
}
|
|
||||||
rand = new Random(seed);
|
|
||||||
|
|
||||||
l = new CyclicBarrier(numThreads + 1);
|
l = new CyclicBarrier(numThreads + 1);
|
||||||
|
|
||||||
System.out.printf("Threads: %d\n", numThreads);
|
System.out.printf("Threads: %d\n", numThreads);
|
||||||
System.out.printf("Seed: %d\n", seed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Loader> loaders = new ArrayList<>();
|
final List<Loader> loaders = new ArrayList<>();
|
||||||
|
@ -90,7 +84,9 @@ public class ConcurrentClassLoadingTest {
|
||||||
|
|
||||||
System.out.printf("Thread #%d:\n", t);
|
System.out.printf("Thread #%d:\n", t);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (c.size() == 0) break;
|
if (c.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int k = rand.nextInt(c.size());
|
int k = rand.nextInt(c.size());
|
||||||
String elem = c.remove(k);
|
String elem = c.remove(k);
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
|
|
||||||
import com.oracle.java.testlibrary.OutputAnalyzer;
|
import com.oracle.java.testlibrary.OutputAnalyzer;
|
||||||
import com.oracle.java.testlibrary.ProcessTools;
|
import com.oracle.java.testlibrary.ProcessTools;
|
||||||
import scenarios.ProfilingType;
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import scenarios.ProfilingType;
|
||||||
|
|
||||||
public class OffTest {
|
public class OffTest {
|
||||||
private static final String[] OPTIONS = {
|
private static final String[] OPTIONS = {
|
||||||
|
@ -63,14 +63,7 @@ public class OffTest {
|
||||||
private static final int PROFILING_TYPE_INDEX = OPTIONS.length - 1;
|
private static final int PROFILING_TYPE_INDEX = OPTIONS.length - 1;
|
||||||
private static final int TYPE_PROFILE_INDEX = OPTIONS.length - 4;
|
private static final int TYPE_PROFILE_INDEX = OPTIONS.length - 4;
|
||||||
private static final int USE_TYPE_SPECULATION_INDEX = OPTIONS.length - 3;
|
private static final int USE_TYPE_SPECULATION_INDEX = OPTIONS.length - 3;
|
||||||
private static final Random RNG;
|
private static final Random RNG = Utils.getRandomInstance();
|
||||||
|
|
||||||
static {
|
|
||||||
String str = System.getProperty("seed");
|
|
||||||
long seed = str != null ? Long.parseLong(str) : new Random().nextLong();
|
|
||||||
RNG = new Random(seed);
|
|
||||||
System.out.printf("-Dseed=%d%n", seed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
int count = DEFAULT_COUNT;
|
int count = DEFAULT_COUNT;
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class UnsafeRaw {
|
||||||
final int element_size = 4;
|
final int element_size = 4;
|
||||||
final int magic = 0x12345678;
|
final int magic = 0x12345678;
|
||||||
|
|
||||||
Random rnd = new Random();
|
Random rnd = Utils.getRandomInstance();
|
||||||
|
|
||||||
long array = unsafe.allocateMemory(array_size * element_size); // 128 ints
|
long array = unsafe.allocateMemory(array_size * element_size); // 128 ints
|
||||||
long addr = array + array_size * element_size / 2; // something in the middle to work with
|
long addr = array + array_size * element_size / 2; // something in the middle to work with
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.ThreadMXBean;
|
import java.lang.management.ThreadMXBean;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -30,6 +31,7 @@ import java.util.Random;
|
||||||
* @ignore 8061157
|
* @ignore 8061157
|
||||||
* @bug 8016304
|
* @bug 8016304
|
||||||
* @summary Make sure no deadlock is reported for this program which has no deadlocks.
|
* @summary Make sure no deadlock is reported for this program which has no deadlocks.
|
||||||
|
* @library /testlibrary
|
||||||
* @run main/othervm TestFalseDeadLock
|
* @run main/othervm TestFalseDeadLock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ public class TestFalseDeadLock {
|
||||||
|
|
||||||
public static class Test implements Runnable {
|
public static class Test implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
Random r = new Random();
|
Random r = Utils.getRandomInstance();
|
||||||
while (running) {
|
while (running) {
|
||||||
try {
|
try {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
|
@ -24,21 +24,21 @@
|
||||||
package com.oracle.java.testlibrary;
|
package com.oracle.java.testlibrary;
|
||||||
|
|
||||||
import static com.oracle.java.testlibrary.Asserts.assertTrue;
|
import static com.oracle.java.testlibrary.Asserts.assertTrue;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.regex.Pattern;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.lang.reflect.Field;
|
import java.util.regex.Pattern;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +63,21 @@ public final class Utils {
|
||||||
|
|
||||||
private static Unsafe unsafe = null;
|
private static Unsafe unsafe = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines property name for seed value.
|
||||||
|
*/
|
||||||
|
public static final String SEED_PROPERTY_NAME = "com.oracle.java.testlibrary.random.seed";
|
||||||
|
|
||||||
|
/* (non-javadoc)
|
||||||
|
* Random generator with (or without) predefined seed. Depends on
|
||||||
|
* "com.oracle.java.testlibrary.random.seed" property value.
|
||||||
|
*/
|
||||||
|
private static volatile Random RANDOM_GENERATOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the seed value used for {@link java.util.Random} creation.
|
||||||
|
*/
|
||||||
|
public static final long SEED = Long.getLong(SEED_PROPERTY_NAME, new Random().nextLong());
|
||||||
/**
|
/**
|
||||||
* Returns the value of 'test.timeout.factor' system property
|
* Returns the value of 'test.timeout.factor' system property
|
||||||
* converted to {@code double}.
|
* converted to {@code double}.
|
||||||
|
@ -332,4 +347,24 @@ public final class Utils {
|
||||||
}
|
}
|
||||||
return new String(hexView);
|
return new String(hexView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@link java.util.Random} generator initialized with particular seed.
|
||||||
|
* The seed could be provided via system property {@link Utils#SEED_PROPERTY_NAME}
|
||||||
|
* In case no seed is provided, the method uses a random number.
|
||||||
|
* The used seed printed to stdout.
|
||||||
|
* @return {@link java.util.Random} generator with particular seed.
|
||||||
|
*/
|
||||||
|
public static Random getRandomInstance() {
|
||||||
|
if (RANDOM_GENERATOR == null) {
|
||||||
|
synchronized (Utils.class) {
|
||||||
|
if (RANDOM_GENERATOR == null) {
|
||||||
|
RANDOM_GENERATOR = new Random(SEED);
|
||||||
|
System.out.printf("For random generator using seed: %d%n", SEED);
|
||||||
|
System.out.printf("To re-run test with same seed value please add \"-D%s=%d\" to command line.%n", SEED_PROPERTY_NAME, SEED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RANDOM_GENERATOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,18 +34,21 @@ public class NMethod {
|
||||||
return obj == null ? null : new NMethod(obj);
|
return obj == null ? null : new NMethod(obj);
|
||||||
}
|
}
|
||||||
private NMethod(Object[] obj) {
|
private NMethod(Object[] obj) {
|
||||||
assert obj.length == 2;
|
assert obj.length == 3;
|
||||||
comp_level = (Integer) obj[0];
|
comp_level = (Integer) obj[0];
|
||||||
insts = (byte[]) obj[1];
|
insts = (byte[]) obj[1];
|
||||||
|
compile_id = (Integer) obj[2];
|
||||||
}
|
}
|
||||||
public byte[] insts;
|
public byte[] insts;
|
||||||
public int comp_level;
|
public int comp_level;
|
||||||
|
public int compile_id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NMethod{" +
|
return "NMethod{" +
|
||||||
"insts=" + insts +
|
"insts=" + insts +
|
||||||
", comp_level=" + comp_level +
|
", comp_level=" + comp_level +
|
||||||
|
", compile_id=" + compile_id +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
154
hotspot/test/testlibrary_tests/RandomGeneratorTest.java
Normal file
154
hotspot/test/testlibrary_tests/RandomGeneratorTest.java
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @summary Verify correctnes of the random generator from Utility.java
|
||||||
|
* @library /testlibrary
|
||||||
|
* @run driver RandomGeneratorTest SAME_SEED
|
||||||
|
* @run driver RandomGeneratorTest NO_SEED
|
||||||
|
* @run driver RandomGeneratorTest DIFFERENT_SEED
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.ProcessTools;
|
||||||
|
import com.oracle.java.testlibrary.Utils;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The test verifies correctness of work {@link com.oracle.java.testlibrary.Utils#getRandomInstance()}.
|
||||||
|
* Test works in three modes: same seed provided, no seed provided and
|
||||||
|
* different seed provided. In the first case the test expects that all random numbers
|
||||||
|
* will be repeated in all next iterations. For other two modes test expects that
|
||||||
|
* randomly generated numbers differ from original.
|
||||||
|
*/
|
||||||
|
public class RandomGeneratorTest {
|
||||||
|
private static final String SEED_VM_OPTION = "-D" + Utils.SEED_PROPERTY_NAME + "=";
|
||||||
|
|
||||||
|
public static void main( String[] args) throws Throwable {
|
||||||
|
if (args.length == 0) {
|
||||||
|
throw new Error("TESTBUG: No test mode provided.");
|
||||||
|
}
|
||||||
|
SeedOption seedOpt = SeedOption.valueOf(args[0]);
|
||||||
|
List<String> jvmArgs = new ArrayList<String>();
|
||||||
|
String optStr = seedOpt.getSeedOption();
|
||||||
|
if (optStr != null) {
|
||||||
|
jvmArgs.add(optStr);
|
||||||
|
}
|
||||||
|
jvmArgs.add(RandomRunner.class.getName());
|
||||||
|
String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
|
||||||
|
String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getOutput().trim();
|
||||||
|
seedOpt.verify(etalon, cmdLineArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The utility enum helps to generate an appropriate string that should be passed
|
||||||
|
* to the command line depends on the testing mode. It is also responsible for the result
|
||||||
|
* validation.
|
||||||
|
*/
|
||||||
|
private enum SeedOption {
|
||||||
|
SAME_SEED {
|
||||||
|
@Override
|
||||||
|
public String getSeedOption() {
|
||||||
|
return SEED_VM_OPTION + Utils.SEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isOutputExpected(String orig, String output) {
|
||||||
|
return output.equals(orig);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DIFFERENT_SEED {
|
||||||
|
@Override
|
||||||
|
public String getSeedOption() {
|
||||||
|
return SEED_VM_OPTION + Utils.getRandomInstance().nextLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void verify(String orig, String[] cmdLine) {
|
||||||
|
cmdLine[0] = getSeedOption();
|
||||||
|
super.verify(orig, cmdLine);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
NO_SEED {
|
||||||
|
@Override
|
||||||
|
public String getSeedOption() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a string to be added as a command line argument.
|
||||||
|
* It contains "-D" prefix, system property name, '=' sign
|
||||||
|
* and seed value.
|
||||||
|
* @return command line argument
|
||||||
|
*/
|
||||||
|
public abstract String getSeedOption();
|
||||||
|
|
||||||
|
protected boolean isOutputExpected(String orig, String output) {
|
||||||
|
return !output.equals(orig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the original output meets expectations
|
||||||
|
* depending on the test mode. It compares the output of second execution
|
||||||
|
* to original one.
|
||||||
|
* @param orig original output
|
||||||
|
* @param cmdLine command line arguments
|
||||||
|
* @throws Throwable - Throws an exception in case test failure.
|
||||||
|
*/
|
||||||
|
public void verify(String orig, String[] cmdLine) {
|
||||||
|
String lastLineOrig = getLastLine(orig);
|
||||||
|
String lastLine;
|
||||||
|
try {
|
||||||
|
lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getOutput().trim());
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
|
||||||
|
}
|
||||||
|
if (!isOutputExpected(lastLineOrig, lastLine)) {
|
||||||
|
throw new AssertionError("Unexpected random number sequence for mode: " + this.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getLastLine(String output) {
|
||||||
|
return output.substring(output.lastIndexOf(Utils.NEW_LINE)).trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The helper class generates several random numbers
|
||||||
|
* and prints them out.
|
||||||
|
*/
|
||||||
|
public static class RandomRunner {
|
||||||
|
private static final int COUNT = 10;
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Random rng = Utils.getRandomInstance();
|
||||||
|
for (int i = 0; i < COUNT; i++) {
|
||||||
|
sb.append(rng.nextLong()).append(' ');
|
||||||
|
}
|
||||||
|
System.out.println(sb.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue