@@ -87,45 +87,37 @@ public CoreLocation declaredLocation(Object value) {
87
87
88
88
@ Override
89
89
protected Location moveLocation (Location oldLocation ) {
90
- if (oldLocation instanceof LongLocation ) {
91
- return newLongLocation (oldLocation . isFinal (), (( LongLocation ) oldLocation ) .isImplicitCastIntToLong ());
90
+ if (oldLocation instanceof LongLocation longLocation ) {
91
+ return newLongLocation (longLocation .isImplicitCastIntToLong ());
92
92
} else if (oldLocation instanceof IntLocation ) {
93
- return newIntLocation (oldLocation . isFinal () );
94
- } else if (oldLocation instanceof DoubleLocation ) {
95
- return newDoubleLocation (oldLocation . isFinal (), (( DoubleLocation ) oldLocation ) .isImplicitCastIntToDouble ());
93
+ return newIntLocation ();
94
+ } else if (oldLocation instanceof DoubleLocation doubleLocation ) {
95
+ return newDoubleLocation (doubleLocation .isImplicitCastIntToDouble ());
96
96
} else if (oldLocation instanceof BooleanLocation ) {
97
- return newBooleanLocation (oldLocation . isFinal () );
97
+ return newBooleanLocation ();
98
98
} else if (oldLocation instanceof ObjectLocation ) {
99
- return newObjectLocation (oldLocation . isFinal (), (( ObjectLocation ) oldLocation ). isNonNull () );
99
+ return newObjectLocation ();
100
100
} else {
101
101
assert oldLocation instanceof CoreLocations .ValueLocation : oldLocation ;
102
102
return advance (oldLocation );
103
103
}
104
104
}
105
105
106
- @ Override
107
- public Location newObjectLocation (boolean useFinal , boolean nonNull ) {
106
+ private Location newObjectLocation () {
108
107
if (ObjectStorageOptions .InObjectFields ) {
109
108
int insertPos = objectFieldSize ;
110
109
if (insertPos + OBJECT_SLOT_SIZE <= getLayout ().getObjectFieldCount ()) {
111
110
return advance ((Location ) getLayout ().getObjectFieldLocation (insertPos ));
112
111
}
113
112
}
114
- return newObjectArrayLocation (useFinal , nonNull );
113
+ return newObjectArrayLocation ();
115
114
}
116
115
117
- @ SuppressWarnings ("unused" )
118
- private Location newObjectArrayLocation (boolean useFinal , boolean nonNull ) {
116
+ private Location newObjectArrayLocation () {
119
117
return advance (new ObjectArrayLocation (objectArraySize ));
120
118
}
121
119
122
- @ Override
123
- public Location newTypedObjectLocation (boolean useFinal , Class <?> type , boolean nonNull ) {
124
- return newObjectLocation (useFinal , nonNull );
125
- }
126
-
127
- @ Override
128
- protected Location newIntLocation (boolean useFinal ) {
120
+ private Location newIntLocation () {
129
121
if (ObjectStorageOptions .PrimitiveLocations && ObjectStorageOptions .IntegerLocations ) {
130
122
if (ObjectStorageOptions .InObjectFields && primitiveFieldSize + getLayout ().getLongFieldSize () <= getLayout ().getPrimitiveFieldCount ()) {
131
123
return advance (new IntLocationDecorator (getLayout ().getPrimitiveFieldLocation (primitiveFieldSize )));
@@ -134,15 +126,14 @@ protected Location newIntLocation(boolean useFinal) {
134
126
return advance (new IntLocationDecorator (new LongArrayLocation (alignedIndex )));
135
127
}
136
128
}
137
- return newObjectLocation (useFinal , true );
129
+ return newObjectLocation ();
138
130
}
139
131
140
- @ Override
141
- public Location newDoubleLocation (boolean useFinal ) {
142
- return newDoubleLocation (useFinal , getLayout ().isAllowedIntToDouble ());
132
+ private Location newDoubleLocation () {
133
+ return newDoubleLocation (getLayout ().isAllowedIntToDouble ());
143
134
}
144
135
145
- Location newDoubleLocation (boolean useFinal , boolean allowedIntToDouble ) {
136
+ Location newDoubleLocation (boolean allowedIntToDouble ) {
146
137
if (ObjectStorageOptions .PrimitiveLocations && ObjectStorageOptions .DoubleLocations ) {
147
138
if (ObjectStorageOptions .InObjectFields && primitiveFieldSize + getLayout ().getLongFieldSize () <= getLayout ().getPrimitiveFieldCount ()) {
148
139
return advance (new DoubleLocationDecorator (getLayout ().getPrimitiveFieldLocation (primitiveFieldSize ), allowedIntToDouble ));
@@ -151,15 +142,14 @@ Location newDoubleLocation(boolean useFinal, boolean allowedIntToDouble) {
151
142
return advance (new DoubleLocationDecorator (new LongArrayLocation (alignedIndex ), allowedIntToDouble ));
152
143
}
153
144
}
154
- return newObjectLocation (useFinal , true );
145
+ return newObjectLocation ();
155
146
}
156
147
157
- @ Override
158
- public Location newLongLocation (boolean useFinal ) {
159
- return newLongLocation (useFinal , getLayout ().isAllowedIntToLong ());
148
+ private Location newLongLocation () {
149
+ return newLongLocation (getLayout ().isAllowedIntToLong ());
160
150
}
161
151
162
- Location newLongLocation (boolean useFinal , boolean allowedIntToLong ) {
152
+ Location newLongLocation (boolean allowedIntToLong ) {
163
153
if (ObjectStorageOptions .PrimitiveLocations && ObjectStorageOptions .LongLocations ) {
164
154
if (ObjectStorageOptions .InObjectFields && primitiveFieldSize + getLayout ().getLongFieldSize () <= getLayout ().getPrimitiveFieldCount ()) {
165
155
return advance ((Location ) CoreLocations .createLongLocation (getLayout ().getPrimitiveFieldLocation (primitiveFieldSize ), allowedIntToLong ));
@@ -168,59 +158,53 @@ Location newLongLocation(boolean useFinal, boolean allowedIntToLong) {
168
158
return advance (new LongArrayLocation (alignedIndex , allowedIntToLong ));
169
159
}
170
160
}
171
- return newObjectLocation (useFinal , true );
161
+ return newObjectLocation ();
172
162
}
173
163
174
- @ Override
175
- public Location newBooleanLocation (boolean useFinal ) {
164
+ private Location newBooleanLocation () {
176
165
if (ObjectStorageOptions .PrimitiveLocations && ObjectStorageOptions .BooleanLocations ) {
177
166
if (primitiveFieldSize + getLayout ().getLongFieldSize () <= getLayout ().getPrimitiveFieldCount ()) {
178
167
return advance (new BooleanLocationDecorator (getLayout ().getPrimitiveFieldLocation (primitiveFieldSize )));
179
168
}
180
169
}
181
- return newObjectLocation (useFinal , true );
170
+ return newObjectLocation ();
182
171
}
183
172
184
173
@ Override
185
- protected Location locationForValue (Object value , boolean useFinal , boolean nonNull ) {
186
- return locationForValue (value , useFinal , nonNull , 0 );
174
+ public Location locationForValue (Object value ) {
175
+ return locationForValue (value , 0 );
187
176
}
188
177
189
- Location locationForValue (Object value , boolean useFinal , boolean nonNull , int putFlags ) {
178
+ Location locationForValue (Object value , int putFlags ) {
190
179
if (Flags .isConstant (putFlags )) {
191
180
return constantLocation (value );
192
181
} else if (Flags .isDeclaration (putFlags )) {
193
182
return declaredLocation (value );
194
183
}
195
184
if (value instanceof Integer ) {
196
- return newIntLocation (useFinal );
185
+ return newIntLocation ();
197
186
} else if (value instanceof Double ) {
198
- return newDoubleLocation (useFinal , Flags .isImplicitCastIntToDouble (putFlags ) || layout .isAllowedIntToDouble ());
187
+ return newDoubleLocation (Flags .isImplicitCastIntToDouble (putFlags ) || layout .isAllowedIntToDouble ());
199
188
} else if (value instanceof Long ) {
200
- return newLongLocation (useFinal , Flags .isImplicitCastIntToLong (putFlags ) || layout .isAllowedIntToLong ());
189
+ return newLongLocation (Flags .isImplicitCastIntToLong (putFlags ) || layout .isAllowedIntToLong ());
201
190
} else if (value instanceof Boolean ) {
202
- return newBooleanLocation (useFinal );
203
- } else if (ObjectStorageOptions .TypedObjectLocations && value != null ) {
204
- return newTypedObjectLocation (useFinal , value .getClass (), nonNull );
191
+ return newBooleanLocation ();
205
192
}
206
- return newObjectLocation (useFinal , nonNull && value != null );
193
+ return newObjectLocation ();
207
194
}
208
195
209
196
@ Override
210
- protected Location locationForType (Class <?> type , boolean useFinal , boolean nonNull ) {
197
+ public Location locationForType (Class <?> type ) {
211
198
if (type == int .class ) {
212
- return newIntLocation (useFinal );
199
+ return newIntLocation ();
213
200
} else if (type == double .class ) {
214
- return newDoubleLocation (useFinal );
201
+ return newDoubleLocation ();
215
202
} else if (type == long .class ) {
216
- return newLongLocation (useFinal );
203
+ return newLongLocation ();
217
204
} else if (type == boolean .class ) {
218
- return newBooleanLocation (useFinal );
219
- } else if (ObjectStorageOptions .TypedObjectLocations && type != null && type != Object .class ) {
220
- assert !type .isPrimitive () : "unsupported primitive type" ;
221
- return newTypedObjectLocation (useFinal , type , nonNull );
205
+ return newBooleanLocation ();
222
206
}
223
- return newObjectLocation (useFinal , nonNull );
207
+ return newObjectLocation ();
224
208
}
225
209
226
210
@ Override
@@ -230,7 +214,7 @@ protected Location locationForValueUpcast(Object value, Location oldLocation, in
230
214
if (oldLocation instanceof ConstantLocation && Flags .isConstant (putFlags )) {
231
215
return constantLocation (value );
232
216
} else if (oldLocation instanceof ValueLocation ) {
233
- return locationForValue (value , false , value != null );
217
+ return locationForValue (value , putFlags );
234
218
} else if (oldLocation instanceof TypedLocation && ((TypedLocation ) oldLocation ).getType ().isPrimitive ()) {
235
219
if (!shared && ((TypedLocation ) oldLocation ).getType () == int .class ) {
236
220
LongLocation primLocation = ((PrimitiveLocationDecorator ) oldLocation ).getInternalLongLocation ();
@@ -242,9 +226,9 @@ protected Location locationForValueUpcast(Object value, Location oldLocation, in
242
226
return new DoubleLocationDecorator (primLocation , true );
243
227
}
244
228
}
245
- return newObjectLocation (oldLocation . isFinal (), value != null );
229
+ return newObjectLocation ();
246
230
}
247
- return locationForValue (value , false , value != null );
231
+ return locationForValue (value , putFlags );
248
232
}
249
233
250
234
/**
0 commit comments