00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class objArrayOopDesc: public memOopDesc {
00034 public:
00035
00036 friend objArrayOop as_objArrayOop(void* p) {
00037 return objArrayOop(as_memOop(p)); }
00038
00039 void bootstrap_object(bootstrap* st);
00040
00041
00042 objArrayOopDesc* addr() const {
00043 return (objArrayOopDesc*) memOopDesc::addr(); }
00044
00045 bool is_within_bounds(int index) const { return 1 <= index && index <= length(); }
00046
00047 oop* addr_as_oops() const { return (oop*) addr(); }
00048
00049 oop* objs(int which) const {
00050 return &length_addr()[which];
00051 }
00052
00053 oop* length_addr() const {
00054 return &addr_as_oops()[blueprint()->non_indexable_size()];
00055 }
00056
00057 smi length() const {
00058 oop len = *length_addr();
00059 assert(len->is_smi(), "length of indexable should be smi");
00060 return smiOop(len)->value();
00061 }
00062
00063 void set_length(smi len) {
00064 *length_addr() = as_smiOop(len);
00065 }
00066
00067 oop obj_at(int which) const {
00068 assert(which > 0 && which <= length(), "index out of bounds");
00069 return *objs(which);
00070 }
00071
00072 void obj_at_put(int which, oop contents, bool cs = true) {
00073 assert(which > 0 && which <= length(), "index out of bounds");
00074 assert(!is_symbol(), "shouldn't be modifying a canonical string");
00075 assert(contents->verify(), "check contents");
00076 if (cs) {
00077 STORE_OOP(objs(which), contents);
00078 } else {
00079 *objs(which) = contents;
00080 }
00081 }
00082
00083 objArrayOop growBy(int increment);
00084
00085
00086 bool verify();
00087
00088 objArrayOop copy_remove(int from, int number = 1);
00089
00090 objArrayOop copy();
00091 objArrayOop copy_add(oop a);
00092 objArrayOop copy_add_two(oop a, oop b);
00093
00094
00095 void replace_from_to(int from, int to, objArrayOop source, int start);
00096 void replace_and_fill(int from, int start, objArrayOop source);
00097
00098 friend objArrayKlass;
00099 private:
00100
00101 oop* begin_indexables() const { return objs(1); }
00102 oop* end_indexables() const { return begin_indexables() + length(); }
00103 };
00104
00105
00106 class weakArrayOopDesc: public objArrayOopDesc {
00107 public:
00108 friend weakArrayOop as_weakArrayOop(void* p) {
00109 return weakArrayOop(as_memOop(p)); }
00110
00111
00112 weakArrayOopDesc* addr() const {
00113 return (weakArrayOopDesc*) memOopDesc::addr(); }
00114
00115 void scavenge_contents_after_registration();
00116 void follow_contents_after_registration();
00117 };