< prev index next >

src/share/vm/oops/array.hpp

Print this page




 118   // sort the array.
 119   bool contains(const T& x) const      { return index_of(x) >= 0; }
 120 
 121   T    at(int i) const                 { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return _data[i]; }
 122   void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); _data[i] = x; }
 123   T*   adr_at(const int i)             { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; }
 124   int  find(const T& x)                { return index_of(x); }
 125 
 126   T at_acquire(const int which)              { return OrderAccess::load_acquire(adr_at(which)); }
 127   void release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
 128 
 129   static int size(int length) {
 130     size_t bytes = align_up(byte_sizeof(length), BytesPerWord);
 131     size_t words = bytes / BytesPerWord;
 132 
 133     assert(words <= INT_MAX, "Overflow: " SIZE_FORMAT, words);
 134 
 135     return (int)words;
 136   }
 137   static int size(int length, int elm_byte_size) {
 138     return align_size_up(byte_sizeof(length, elm_byte_size), BytesPerWord) / BytesPerWord; // FIXME
 139   }
 140 
 141   int size() {
 142     return size(_length);
 143   }
 144 
 145   static int length_offset_in_bytes() { return (int) (offset_of(Array<T>, _length)); }
 146   // Note, this offset don't have to be wordSize aligned.
 147   static int base_offset_in_bytes() { return (int) (offset_of(Array<T>, _data)); };
 148 
 149   // FIXME: How to handle this?
 150   void print_value_on(outputStream* st) const {
 151     st->print("Array<T>(" INTPTR_FORMAT ")", p2i(this));
 152   }
 153 
 154 #ifndef PRODUCT
 155   void print(outputStream* st) {
 156      for (int i = 0; i< _length; i++) {
 157        st->print_cr("%d: " INTPTR_FORMAT, i, (intptr_t)at(i));
 158      }


 118   // sort the array.
 119   bool contains(const T& x) const      { return index_of(x) >= 0; }
 120 
 121   T    at(int i) const                 { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return _data[i]; }
 122   void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); _data[i] = x; }
 123   T*   adr_at(const int i)             { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; }
 124   int  find(const T& x)                { return index_of(x); }
 125 
 126   T at_acquire(const int which)              { return OrderAccess::load_acquire(adr_at(which)); }
 127   void release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); }
 128 
 129   static int size(int length) {
 130     size_t bytes = align_up(byte_sizeof(length), BytesPerWord);
 131     size_t words = bytes / BytesPerWord;
 132 
 133     assert(words <= INT_MAX, "Overflow: " SIZE_FORMAT, words);
 134 
 135     return (int)words;
 136   }
 137   static int size(int length, int elm_byte_size) {
 138     return align_up(byte_sizeof(length, elm_byte_size), BytesPerWord) / BytesPerWord;
 139   }
 140 
 141   int size() {
 142     return size(_length);
 143   }
 144 
 145   static int length_offset_in_bytes() { return (int) (offset_of(Array<T>, _length)); }
 146   // Note, this offset don't have to be wordSize aligned.
 147   static int base_offset_in_bytes() { return (int) (offset_of(Array<T>, _data)); };
 148 
 149   // FIXME: How to handle this?
 150   void print_value_on(outputStream* st) const {
 151     st->print("Array<T>(" INTPTR_FORMAT ")", p2i(this));
 152   }
 153 
 154 #ifndef PRODUCT
 155   void print(outputStream* st) {
 156      for (int i = 0; i< _length; i++) {
 157        st->print_cr("%d: " INTPTR_FORMAT, i, (intptr_t)at(i));
 158      }
< prev index next >