8196199: Remove miscellaneous oop comparison operators
Co-authored-by: Kim Barrett <kim.barrett@oracle.com> Reviewed-by: hseigel, lfoltan
This commit is contained in:
parent
2b3d492b43
commit
aa51ac19b3
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -172,9 +172,8 @@ void ObjectLookup::maybe_resort() {
|
||||
}
|
||||
|
||||
int ObjectLookup::sort_by_address(oop a, oop b) {
|
||||
if (b > a) return 1;
|
||||
if (a > b) return -1;
|
||||
return 0;
|
||||
// oopDesc::compare returns the opposite of what this function returned
|
||||
return -(oopDesc::compare(a, b));
|
||||
}
|
||||
|
||||
int ObjectLookup::sort_by_address(ObjectEntry* a, ObjectEntry* b) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -246,11 +246,11 @@ class CMSMarkStack: public CHeapObj<mtGC> {
|
||||
|
||||
// Compute the least valued stack element.
|
||||
oop least_value(HeapWord* low) {
|
||||
oop least = (oop)low;
|
||||
for (size_t i = 0; i < _index; i++) {
|
||||
least = MIN2(least, _base[i]);
|
||||
}
|
||||
return least;
|
||||
HeapWord* least = low;
|
||||
for (size_t i = 0; i < _index; i++) {
|
||||
least = MIN2(least, (HeapWord*)_base[i]);
|
||||
}
|
||||
return (oop)least;
|
||||
}
|
||||
|
||||
// Exposed here to allow stack expansion in || case.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -131,26 +131,28 @@ ParMarkBitMap::live_words_in_range_helper(HeapWord* beg_addr, oop end_obj) const
|
||||
}
|
||||
|
||||
size_t
|
||||
ParMarkBitMap::live_words_in_range_use_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_obj) const
|
||||
ParMarkBitMap::live_words_in_range_use_cache(ParCompactionManager* cm, HeapWord* beg_addr, oop end_oop) const
|
||||
{
|
||||
HeapWord* last_beg = cm->last_query_begin();
|
||||
oop last_obj = cm->last_query_object();
|
||||
HeapWord* last_obj = (HeapWord*)cm->last_query_object();
|
||||
HeapWord* end_obj = (HeapWord*)end_oop;
|
||||
|
||||
size_t last_ret = cm->last_query_return();
|
||||
if (end_obj > last_obj) {
|
||||
last_ret = last_ret + live_words_in_range_helper((HeapWord*)last_obj, end_obj);
|
||||
last_ret = last_ret + live_words_in_range_helper(last_obj, end_oop);
|
||||
last_obj = end_obj;
|
||||
} else if (end_obj < last_obj) {
|
||||
// The cached value is for an object that is to the left (lower address) of the current
|
||||
// end_obj. Calculate back from that cached value.
|
||||
if (pointer_delta((HeapWord*)end_obj, (HeapWord*)beg_addr) > pointer_delta((HeapWord*)last_obj, (HeapWord*)end_obj)) {
|
||||
last_ret = last_ret - live_words_in_range_helper((HeapWord*)end_obj, last_obj);
|
||||
if (pointer_delta(end_obj, beg_addr) > pointer_delta(last_obj, end_obj)) {
|
||||
last_ret = last_ret - live_words_in_range_helper(end_obj, (oop)last_obj);
|
||||
} else {
|
||||
last_ret = live_words_in_range_helper(beg_addr, end_obj);
|
||||
last_ret = live_words_in_range_helper(beg_addr, end_oop);
|
||||
}
|
||||
last_obj = end_obj;
|
||||
}
|
||||
|
||||
update_live_words_in_range_cache(cm, last_beg, last_obj, last_ret);
|
||||
update_live_words_in_range_cache(cm, last_beg, (oop)last_obj, last_ret);
|
||||
return last_ret;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -143,6 +143,21 @@ class oopDesc {
|
||||
inline static bool is_null(oop obj) { return obj == NULL; }
|
||||
inline static bool is_null(narrowOop obj) { return obj == 0; }
|
||||
|
||||
// Standard compare function returns negative value if o1 < o2
|
||||
// 0 if o1 == o2
|
||||
// positive value if o1 > o2
|
||||
inline static int compare(oop o1, oop o2) {
|
||||
void* o1_addr = (void*)o1;
|
||||
void* o2_addr = (void*)o2;
|
||||
if (o1_addr < o2_addr) {
|
||||
return -1;
|
||||
} else if (o1_addr > o2_addr) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Decode an oop pointer from a narrowOop if compressed.
|
||||
// These are overloaded for oop and narrowOop as are the other functions
|
||||
// below so that they can be called in template functions.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -106,12 +106,6 @@ public:
|
||||
bool operator!=(const volatile oop o) const { return obj() != o.obj(); }
|
||||
bool operator!=(void *p) const { return obj() != p; }
|
||||
|
||||
bool operator<(oop o) const { return obj() < o.obj(); }
|
||||
bool operator>(oop o) const { return obj() > o.obj(); }
|
||||
bool operator<=(oop o) const { return obj() <= o.obj(); }
|
||||
bool operator>=(oop o) const { return obj() >= o.obj(); }
|
||||
bool operator!() const { return !obj(); }
|
||||
|
||||
// Assignment
|
||||
oop& operator=(const oop& o) { _o = o.obj(); return *this; }
|
||||
volatile oop& operator=(const oop& o) volatile { _o = o.obj(); return *this; }
|
||||
|
@ -288,7 +288,7 @@ checkInstanceFieldID(JavaThread* thr, jfieldID fid, jobject obj, int ftype)
|
||||
/* validate the object being passed and then get its class */
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
oop oopObj = jniCheck::validate_object(thr, obj);
|
||||
if (!oopObj) {
|
||||
if (oopObj == NULL) {
|
||||
ReportJNIFatalError(thr, fatal_null_object);
|
||||
}
|
||||
Klass* k_oop = oopObj->klass();
|
||||
@ -318,7 +318,7 @@ checkString(JavaThread* thr, jstring js)
|
||||
{
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
oop s = jniCheck::validate_object(thr, js);
|
||||
if (!s || !java_lang_String::is_instance(s))
|
||||
if ((s == NULL) || !java_lang_String::is_instance(s))
|
||||
ReportJNIFatalError(thr, fatal_non_string);
|
||||
}
|
||||
|
||||
@ -461,14 +461,13 @@ Method* jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) {
|
||||
|
||||
|
||||
oop jniCheck::validate_object(JavaThread* thr, jobject obj) {
|
||||
if (!obj)
|
||||
return NULL;
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
oop oopObj = jniCheck::validate_handle(thr, obj);
|
||||
if (!oopObj) {
|
||||
ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
|
||||
}
|
||||
return oopObj;
|
||||
if (obj == NULL) return NULL;
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
oop oopObj = jniCheck::validate_handle(thr, obj);
|
||||
if (oopObj == NULL) {
|
||||
ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
|
||||
}
|
||||
return oopObj;
|
||||
}
|
||||
|
||||
// Warn if a class descriptor is in decorated form; class descriptors
|
||||
@ -492,7 +491,7 @@ void jniCheck::validate_class_descriptor(JavaThread* thr, const char* name) {
|
||||
Klass* jniCheck::validate_class(JavaThread* thr, jclass clazz, bool allow_primitive) {
|
||||
ASSERT_OOPS_ALLOWED;
|
||||
oop mirror = jniCheck::validate_handle(thr, clazz);
|
||||
if (!mirror) {
|
||||
if (mirror == NULL) {
|
||||
ReportJNIFatalError(thr, fatal_received_null_class);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -489,7 +489,7 @@ StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
|
||||
_locked_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<oop>(length, true);
|
||||
for (int i = 0; i < length; i++) {
|
||||
MonitorInfo* monitor = list->at(i);
|
||||
assert(monitor->owner(), "This monitor must have an owning object");
|
||||
assert(monitor->owner() != NULL, "This monitor must have an owning object");
|
||||
_locked_monitors->append(monitor->owner());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user