@@ -26,7 +26,7 @@ VMVector::VMVector(vm_oop_t first, vm_oop_t last, VMArray* storage)
2626vm_oop_t VMVector::AWFYGetStorage (int64_t index) {
2727 // This is a method that is used by the AWFY tests, it does not handle
2828 // 1-0 indexing conversion
29- int64_t const first = INT_VAL (load_ptr (this ->first ));
29+ int64_t const first = SMALL_INT_VAL (load_ptr (this ->first ));
3030 VMArray* const storage = load_ptr (this ->storage );
3131
3232 if (index > storage->GetNumberOfIndexableFields ()) {
@@ -39,8 +39,8 @@ vm_oop_t VMVector::AWFYGetStorage(int64_t index) {
3939}
4040
4141vm_oop_t VMVector::GetStorage (int64_t index) {
42- int64_t const first = INT_VAL (load_ptr (this ->first ));
43- int64_t const last = INT_VAL (load_ptr (this ->last ));
42+ int64_t const first = SMALL_INT_VAL (load_ptr (this ->first ));
43+ int64_t const last = SMALL_INT_VAL (load_ptr (this ->last ));
4444 VMArray* const storage = load_ptr (this ->storage );
4545
4646 if (index < 1 || index > last - first) {
@@ -53,8 +53,8 @@ vm_oop_t VMVector::GetStorage(int64_t index) {
5353
5454/* Returns the value currently held at that location */
5555vm_oop_t VMVector::SetStorage (int64_t index, vm_oop_t value) {
56- int64_t const first = INT_VAL (load_ptr (this ->first ));
57- int64_t const last = INT_VAL (load_ptr (this ->last ));
56+ int64_t const first = SMALL_INT_VAL (load_ptr (this ->first ));
57+ int64_t const last = SMALL_INT_VAL (load_ptr (this ->last ));
5858 VMArray* const storage = load_ptr (this ->storage );
5959 if (index < 1 || index > first + last) {
6060 return IndexOutOfBounds (first + last - 1 , index);
@@ -66,8 +66,8 @@ vm_oop_t VMVector::SetStorage(int64_t index, vm_oop_t value) {
6666
6767/* AWFY Vector can expand on at:put: core-lib vector cannot*/
6868void VMVector::SetStorageAWFY (int64_t index, vm_oop_t value) {
69- int64_t const first = INT_VAL (load_ptr (this ->first ));
70- int64_t last = INT_VAL (load_ptr (this ->last ));
69+ int64_t const first = SMALL_INT_VAL (load_ptr (this ->first ));
70+ int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
7171 VMArray* storage = load_ptr (this ->storage );
7272
7373 if (index > storage->GetNumberOfIndexableFields ()) {
@@ -88,7 +88,7 @@ void VMVector::SetStorageAWFY(int64_t index, vm_oop_t value) {
8888}
8989
9090void VMVector::Append (vm_oop_t value) {
91- int64_t last = INT_VAL (load_ptr (this ->last ));
91+ int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
9292 VMArray* storage = load_ptr (this ->storage );
9393
9494 if (last >= storage->GetNumberOfIndexableFields ()) { // Expand the array
@@ -111,8 +111,8 @@ void VMVector::Append(vm_oop_t value) {
111111}
112112
113113vm_oop_t VMVector::RemoveLast () {
114- const int64_t last = INT_VAL (load_ptr (this ->last ));
115- const int64_t first = INT_VAL (load_ptr (this ->first ));
114+ const int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
115+ const int64_t first = SMALL_INT_VAL (load_ptr (this ->first ));
116116
117117 // Throw an error correctly (error: method in som)
118118 if (last == first) {
@@ -130,10 +130,10 @@ vm_oop_t VMVector::RemoveLast() {
130130
131131vm_oop_t VMVector::RemoveFirst () {
132132 // This method will just increment the first index
133- int64_t first = INT_VAL (load_ptr (this ->first ));
133+ int64_t first = SMALL_INT_VAL (load_ptr (this ->first ));
134134
135135 // Throw an error correctly (error: method in som)
136- if (first >= INT_VAL (load_ptr (this ->last ))) {
136+ if (first >= SMALL_INT_VAL (load_ptr (this ->last ))) {
137137 // VMSafe*Primitive::Invoke will push it right back to the same frame
138138 VMFrame* frame = Interpreter::GetFrame ();
139139 vm_oop_t errorMsg =
@@ -142,16 +142,17 @@ vm_oop_t VMVector::RemoveFirst() {
142142 this ->Send (" error:" , args, 1 );
143143 return frame->Pop ();
144144 }
145- vm_oop_t itemToRemove = GetStorage (
146- 1 ); // This is 1 because GetIndexableField handles 1 to 0 indexing
145+
146+ // This is 1 because GetIndexableField handles 1 to 0 indexing
147+ vm_oop_t itemToRemove = GetStorage (1 );
147148 first += 1 ; // Increment the first index
148149 this ->first = store_ptr (this ->first , NEW_INT (first));
149150 return itemToRemove;
150151}
151152
152153vm_oop_t VMVector::RemoveObj (vm_oop_t other) {
153- const int64_t first = INT_VAL (load_ptr (this ->first ));
154- const int64_t last = INT_VAL (load_ptr (this ->last ));
154+ const int64_t first = SMALL_INT_VAL (load_ptr (this ->first ));
155+ const int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
155156 VMArray* storage = load_ptr (this ->storage );
156157
157158 for (int64_t i = first - 1 ; i < last - 1 ; ++i) {
@@ -167,10 +168,10 @@ vm_oop_t VMVector::RemoveObj(vm_oop_t other) {
167168}
168169
169170vm_oop_t VMVector::Remove (vm_oop_t inx) {
170- const int64_t first = INT_VAL (load_ptr (this ->first ));
171- int64_t last = INT_VAL (load_ptr (this ->last ));
171+ const int64_t first = SMALL_INT_VAL (load_ptr (this ->first ));
172+ int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
172173 VMArray* storage = load_ptr (this ->storage );
173- int64_t const index = INT_VAL (inx);
174+ int64_t const index = SMALL_INT_VAL (inx);
174175
175176 if (index < 1 || index > last - first) {
176177 return IndexOutOfBounds (first + last - 1 , index);
@@ -200,8 +201,8 @@ void VMVector::RemoveAll() {
200201}
201202
202203vm_oop_t VMVector::copyStorageArray () {
203- const int64_t first = INT_VAL (load_ptr (this ->first ));
204- const int64_t last = INT_VAL (load_ptr (this ->last ));
204+ const int64_t first = SMALL_INT_VAL (load_ptr (this ->first ));
205+ const int64_t last = SMALL_INT_VAL (load_ptr (this ->last ));
205206 VMArray* storage = load_ptr (this ->storage );
206207
207208 VMArray* result = Universe::NewArray (last - first);
0 commit comments