src/share/vm/oops/objArrayOop.hpp
Print this page
*** 24,33 ****
--- 24,34 ----
#ifndef SHARE_VM_OOPS_OBJARRAYOOP_HPP
#define SHARE_VM_OOPS_OBJARRAYOOP_HPP
#include "oops/arrayOop.hpp"
+ #include "utilities/quicksort.hpp"
// An objArrayOop is an array containing oops.
// Evaluating "String arg[10]" will create an objArrayOop.
class objArrayOopDesc : public arrayOopDesc {
*** 66,75 ****
--- 67,78 ----
int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord;
assert(res == old_res, "Inconsistency between old and new.");
return res;
}
+ void make_dirty();
+
public:
// Returns the offset of the first element.
static int base_offset_in_bytes() {
return arrayOopDesc::base_offset_in_bytes(T_OBJECT);
}
*** 106,115 ****
--- 109,128 ----
assert(osz >= asz, "no overflow");
assert((int)osz > 0, "no overflow");
return (int)osz;
}
+ template <class T, class C>
+ void sort(C comparer, bool idempotent) {
+ if (idempotent) {
+ quicksort::sort<T, C, true>((T*)base(), length(), comparer);
+ } else {
+ quicksort::sort<T, C, false>((T*)base(), length(), comparer);
+ }
+ make_dirty();
+ }
+
// special iterators for index ranges, returns size of object
#define ObjArrayOop_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
int oop_iterate_range(OopClosureType* blk, int start, int end);
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayOop_OOP_ITERATE_DECL)