Skip to content

Commit 656a4ba

Browse files
Xiaohong GongJatin Bhateja
Xiaohong Gong
authored and
Jatin Bhateja
committedJul 12, 2023
8311610: [lworld+vector] Clean-up of vector allocation in class VectorSupport
Reviewed-by: jbhateja
1 parent bb13513 commit 656a4ba

File tree

5 files changed

+61
-329
lines changed

5 files changed

+61
-329
lines changed
 

‎src/hotspot/share/opto/callnode.cpp

+33-16
Original file line numberDiff line numberDiff line change
@@ -507,28 +507,45 @@ void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st)
507507
Node* init_node = mcall->in(first_ind++);
508508
if (!init_node->is_top()) {
509509
st->print(" [is_init");
510-
format_helper(regalloc, st, init_node, ":", -1, nullptr);
510+
format_helper(regalloc, st, init_node, ":", -2, nullptr);
511511
}
512+
513+
Node* larval_node = mcall->in(first_ind++);
514+
assert(larval_node != NULL && larval_node->is_Con(), "is_larval node not found");
515+
st->print(" [is_larval");
516+
format_helper(regalloc, st, larval_node, ":", -1, NULL);
512517
}
513-
Node* fld_node = mcall->in(first_ind);
518+
514519
ciField* cifield;
515-
if (iklass != nullptr) {
516-
st->print(" [");
517-
cifield = iklass->nonstatic_field_at(0);
518-
cifield->print_name_on(st);
519-
format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
520-
} else {
521-
format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
522-
}
523-
for (uint j = 1; j < nf; j++) {
524-
fld_node = mcall->in(first_ind+j);
525-
if (iklass != nullptr) {
526-
st->print(", [");
527-
cifield = iklass->nonstatic_field_at(j);
520+
uint sec_fields_count = 0;
521+
for (uint j = 0; j < nf; j++) {
522+
Node* fld_node = mcall->in(first_ind + j);
523+
if (iklass != NULL) {
524+
st->print(" [");
525+
cifield = iklass->nonstatic_field_at(j - sec_fields_count);
528526
cifield->print_name_on(st);
529527
format_helper(regalloc, st, fld_node, ":", j, &scobjs);
528+
sec_fields_count = 0;
529+
if (cifield->is_multifield_base() && !fld_node->bottom_type()->isa_vect()) {
530+
sec_fields_count = cifield->secondary_fields_count() - 1;
531+
for (uint f = 0; f < sec_fields_count; f++) {
532+
st->print(" [");
533+
fld_node = mcall->in(first_ind + j + f + 1);
534+
ciField* sec_field = static_cast<ciMultiField*>(cifield)->secondary_field_at(f);
535+
sec_field->print_name_on(st);
536+
format_helper(regalloc, st, fld_node, ":", j + f + 1, &scobjs);
537+
if (f < sec_fields_count - 1) {
538+
st->print(",");
539+
}
540+
}
541+
j += sec_fields_count;
542+
}
530543
} else {
531-
format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
544+
format_helper(regalloc, st, fld_node, " [", j, &scobjs);
545+
}
546+
547+
if (j < nf - 1) {
548+
st->print(",");
532549
}
533550
}
534551
}

‎src/hotspot/share/prims/vectorSupport.cpp

-248
Original file line numberDiff line numberDiff line change
@@ -77,259 +77,11 @@ bool VectorSupport::is_vector_payload_mf(Klass* klass) {
7777
return klass->is_subclass_of(vmClasses::vector_VectorPayloadMF_klass());
7878
}
7979

80-
bool VectorSupport::is_vector_mask(Klass* klass) {
81-
return klass->is_subclass_of(vmClasses::vector_VectorMask_klass());
82-
}
83-
8480
bool VectorSupport::skip_value_scalarization(Klass* klass) {
8581
return VectorSupport::is_vector(klass) ||
8682
VectorSupport::is_vector_payload_mf(klass);
8783
}
8884

89-
BasicType VectorSupport::klass2bt(InstanceKlass* ik) {
90-
assert(ik->is_subclass_of(vmClasses::vector_VectorPayload_klass()), "%s not a VectorPayload", ik->name()->as_C_string());
91-
fieldDescriptor fd; // find_field initializes fd if found
92-
// static final Class<?> ETYPE;
93-
Klass* holder = ik->find_field(vmSymbols::ETYPE_name(), vmSymbols::class_signature(), &fd);
94-
95-
assert(holder != nullptr, "sanity");
96-
assert(fd.is_static(), "");
97-
assert(fd.offset() > 0, "");
98-
99-
if (is_vector_mask(ik)) {
100-
return T_BOOLEAN;
101-
} else { // vector and mask
102-
oop value = ik->java_mirror()->obj_field(fd.offset());
103-
BasicType elem_bt = java_lang_Class::as_BasicType(value);
104-
return elem_bt;
105-
}
106-
}
107-
108-
jint VectorSupport::klass2length(InstanceKlass* ik) {
109-
fieldDescriptor fd; // find_field initializes fd if found
110-
// static final int VLENGTH;
111-
Klass* holder = ik->find_field(vmSymbols::VLENGTH_name(), vmSymbols::int_signature(), &fd);
112-
113-
assert(holder != nullptr, "sanity");
114-
assert(fd.is_static(), "");
115-
assert(fd.offset() > 0, "");
116-
117-
jint vlen = ik->java_mirror()->int_field(fd.offset());
118-
assert(vlen > 0, "");
119-
return vlen;
120-
}
121-
122-
#ifdef COMPILER2
123-
Handle VectorSupport::allocate_vector_payload_helper(InstanceKlass* ik, int num_elem, BasicType elem_bt, int larval, TRAPS) {
124-
assert(ik->is_inline_klass(), "");
125-
instanceOop obj = InlineKlass::cast(ik)->allocate_instance(THREAD);
126-
if (larval) obj->set_mark(obj->mark().enter_larval_state());
127-
128-
fieldDescriptor fd;
129-
Klass* def = ik->find_field(vmSymbols::mfield_name(), vmSymbols::type_signature(elem_bt), false, &fd);
130-
assert(fd.is_multifield_base() && fd.secondary_fields_count(fd.index()) == num_elem, "");
131-
return Handle(THREAD, obj);
132-
}
133-
134-
Symbol* VectorSupport::get_vector_payload_field_signature(BasicType elem_bt, int num_elem) {
135-
switch(elem_bt) {
136-
case T_BOOLEAN:
137-
switch(num_elem) {
138-
case 1: return vmSymbols::vector_VectorPayloadMF8Z_signature();
139-
case 2: return vmSymbols::vector_VectorPayloadMF16Z_signature();
140-
case 4: return vmSymbols::vector_VectorPayloadMF32Z_signature();
141-
case 8: return vmSymbols::vector_VectorPayloadMF64Z_signature();
142-
case 16: return vmSymbols::vector_VectorPayloadMF128Z_signature();
143-
case 32: return vmSymbols::vector_VectorPayloadMF256Z_signature();
144-
case 64: return vmSymbols::vector_VectorPayloadMF512Z_signature();
145-
default: ShouldNotReachHere();
146-
} break;
147-
case T_BYTE:
148-
switch(num_elem) {
149-
case 1: return vmSymbols::vector_VectorPayloadMF8B_signature();
150-
case 2: return vmSymbols::vector_VectorPayloadMF16B_signature();
151-
case 4: return vmSymbols::vector_VectorPayloadMF32B_signature();
152-
case 8: return vmSymbols::vector_VectorPayloadMF64B_signature();
153-
case 16: return vmSymbols::vector_VectorPayloadMF128B_signature();
154-
case 32: return vmSymbols::vector_VectorPayloadMF256B_signature();
155-
case 64: return vmSymbols::vector_VectorPayloadMF512B_signature();
156-
default: ShouldNotReachHere();
157-
} break;
158-
case T_SHORT:
159-
switch(num_elem) {
160-
case 4: return vmSymbols::vector_VectorPayloadMF64S_signature();
161-
case 8: return vmSymbols::vector_VectorPayloadMF128S_signature();
162-
case 16: return vmSymbols::vector_VectorPayloadMF256S_signature();
163-
case 32: return vmSymbols::vector_VectorPayloadMF512S_signature();
164-
default: ShouldNotReachHere();
165-
} break;
166-
case T_INT:
167-
switch(num_elem) {
168-
case 2: return vmSymbols::vector_VectorPayloadMF64I_signature();
169-
case 4: return vmSymbols::vector_VectorPayloadMF128I_signature();
170-
case 8: return vmSymbols::vector_VectorPayloadMF256I_signature();
171-
case 16: return vmSymbols::vector_VectorPayloadMF512I_signature();
172-
default: ShouldNotReachHere();
173-
} break;
174-
case T_LONG:
175-
switch(num_elem) {
176-
case 1: return vmSymbols::vector_VectorPayloadMF64L_signature();
177-
case 2: return vmSymbols::vector_VectorPayloadMF128L_signature();
178-
case 4: return vmSymbols::vector_VectorPayloadMF256L_signature();
179-
case 8: return vmSymbols::vector_VectorPayloadMF512L_signature();
180-
default: ShouldNotReachHere();
181-
} break;
182-
case T_FLOAT:
183-
switch(num_elem) {
184-
case 2: return vmSymbols::vector_VectorPayloadMF64F_signature();
185-
case 4: return vmSymbols::vector_VectorPayloadMF128F_signature();
186-
case 8: return vmSymbols::vector_VectorPayloadMF256F_signature();
187-
case 16: return vmSymbols::vector_VectorPayloadMF512F_signature();
188-
default: ShouldNotReachHere();
189-
} break;
190-
case T_DOUBLE:
191-
switch(num_elem) {
192-
case 1: return vmSymbols::vector_VectorPayloadMF64D_signature();
193-
case 2: return vmSymbols::vector_VectorPayloadMF128D_signature();
194-
case 4: return vmSymbols::vector_VectorPayloadMF256D_signature();
195-
case 8: return vmSymbols::vector_VectorPayloadMF512D_signature();
196-
default: ShouldNotReachHere();
197-
} break;
198-
default:
199-
ShouldNotReachHere();
200-
}
201-
return NULL;
202-
}
203-
204-
InstanceKlass* VectorSupport::get_vector_payload_klass(BasicType elem_bt, int num_elem) {
205-
switch(elem_bt) {
206-
case T_BOOLEAN:
207-
switch(num_elem) {
208-
case 1: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF8Z_klass));
209-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF16Z_klass));
210-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF32Z_klass));
211-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64Z_klass));
212-
case 16: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128Z_klass));
213-
case 32: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256Z_klass));
214-
case 64: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512Z_klass));
215-
default: ShouldNotReachHere();
216-
} break;
217-
case T_BYTE:
218-
switch(num_elem) {
219-
case 1: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF8B_klass));
220-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF16B_klass));
221-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF32B_klass));
222-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64B_klass));
223-
case 16: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128B_klass));
224-
case 32: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256B_klass));
225-
case 64: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512B_klass));
226-
default: ShouldNotReachHere();
227-
} break;
228-
case T_SHORT:
229-
switch(num_elem) {
230-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64S_klass));
231-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128S_klass));
232-
case 16: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256S_klass));
233-
case 32: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512S_klass));
234-
default: ShouldNotReachHere();
235-
} break;
236-
case T_INT:
237-
switch(num_elem) {
238-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64I_klass));
239-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128I_klass));
240-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256I_klass));
241-
case 16: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512I_klass));
242-
default: ShouldNotReachHere();
243-
} break;
244-
case T_LONG:
245-
switch(num_elem) {
246-
case 1: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64L_klass));
247-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128L_klass));
248-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256L_klass));
249-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512L_klass));
250-
default: ShouldNotReachHere();
251-
} break;
252-
case T_FLOAT:
253-
switch(num_elem) {
254-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64F_klass));
255-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128F_klass));
256-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256F_klass));
257-
case 16: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512F_klass));
258-
default: ShouldNotReachHere();
259-
} break;
260-
case T_DOUBLE:
261-
switch(num_elem) {
262-
case 1: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF64D_klass));
263-
case 2: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF128D_klass));
264-
case 4: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF256D_klass));
265-
case 8: return vmClasses::klass_at(VM_CLASS_ID(vector_VectorPayloadMF512D_klass));
266-
default: ShouldNotReachHere();
267-
} break;
268-
default:
269-
ShouldNotReachHere();
270-
}
271-
return NULL;
272-
}
273-
274-
Handle VectorSupport::allocate_vector_payload(InstanceKlass* ik, int num_elem, BasicType elem_bt, frame* fr, RegisterMap* reg_map, ObjectValue* ov, TRAPS) {
275-
intptr_t is_larval = StackValue::create_stack_value(fr, reg_map, ov->is_larval())->get_int();
276-
jint larval = (jint)*((jint*)&is_larval);
277-
// Vector payload value in an aligned adjacent tuple (8, 16, 32 or 64 bytes).
278-
return allocate_vector_payload_helper(ik, num_elem, elem_bt, larval, THREAD); // safepoint
279-
}
280-
281-
instanceOop VectorSupport::allocate_vector_payload(InstanceKlass* ik, frame* fr, RegisterMap* reg_map, ObjectValue* ov, TRAPS) {
282-
assert(is_vector_payload_mf(ik), "%s not a vector payload", ik->name()->as_C_string());
283-
assert(ik->is_inline_klass(), "");
284-
285-
int num_elem = 0;
286-
BasicType elem_bt = T_ILLEGAL;
287-
for (JavaFieldStream fs(ik); !fs.done(); fs.next()) {
288-
fieldDescriptor& fd = fs.field_descriptor();
289-
if (fd.is_multifield_base()) {
290-
elem_bt = fd.field_type();
291-
num_elem = fd.secondary_fields_count(fd.index());
292-
break;
293-
}
294-
}
295-
assert(num_elem != 0, "");
296-
Handle payload_instance = VectorSupport::allocate_vector_payload(ik, num_elem, elem_bt, fr, reg_map, ov, CHECK_NULL);
297-
return (instanceOop)payload_instance();
298-
}
299-
300-
instanceOop VectorSupport::allocate_vector(InstanceKlass* ik, frame* fr, RegisterMap* reg_map, ObjectValue* ov, TRAPS) {
301-
assert(is_vector(ik), "%s not a vector", ik->name()->as_C_string());
302-
assert(ik->is_inline_klass(), "");
303-
304-
int num_elem = klass2length(ik);
305-
BasicType elem_bt = klass2bt(ik);
306-
307-
// On-heap vector values are represented as primitive class instances with a multi-field payload.
308-
InstanceKlass* payload_class = get_vector_payload_klass(elem_bt, num_elem);
309-
assert(payload_class->is_inline_klass(), "");
310-
311-
Handle payload_instance = VectorSupport::allocate_vector_payload(payload_class, num_elem, elem_bt, fr, reg_map, ov, CHECK_NULL);
312-
313-
Deoptimization::reassign_fields_by_klass(payload_class, fr, reg_map, ov, 0, payload_instance(), true, 0, CHECK_NULL);
314-
315-
instanceOop vbox = ik->allocate_instance(THREAD);
316-
Handle vbox_h = Handle(THREAD, vbox);
317-
318-
fieldDescriptor fd;
319-
Symbol* payload_sig = VectorSupport::get_vector_payload_field_signature(elem_bt, num_elem);
320-
Klass* def = ik->find_field(vmSymbols::payload_name(), payload_sig, false, &fd);
321-
assert(def != NULL, "");
322-
323-
if (fd.is_inlined()) {
324-
InlineKlass* field_ik = InlineKlass::cast(ik->get_inline_type_field_klass(fd.index()));
325-
field_ik->write_inlined_field(vbox_h(), fd.offset(), payload_instance(), THREAD);
326-
} else {
327-
vbox_h()->obj_field_put(fd.offset(), payload_instance());
328-
}
329-
return vbox;
330-
}
331-
#endif // COMPILER2
332-
33385
#ifdef COMPILER2
33486
int VectorSupport::vop2ideal(jint id, BasicType bt) {
33587
VectorOperation vop = (VectorOperation)id;

‎src/hotspot/share/prims/vectorSupport.hpp

-18
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ extern "C" {
3737
}
3838

3939
class VectorSupport : AllStatic {
40-
private:
41-
42-
#ifdef COMPILER2
43-
static Handle allocate_vector_payload_helper(InstanceKlass* ik, int num_elem, BasicType elem_bt, int larval, TRAPS);
44-
static Handle allocate_vector_payload(InstanceKlass* ik, int num_elem, BasicType elem_bt, frame* fr, RegisterMap* reg_map, ObjectValue* ov, TRAPS);
45-
static InstanceKlass* get_vector_payload_klass(BasicType elem_bt, int num_elem);
46-
static Symbol* get_vector_payload_field_signature(BasicType elem_bt, int num_elem);
47-
#endif // COMPILER2
48-
49-
static BasicType klass2bt(InstanceKlass* ik);
50-
static jint klass2length(InstanceKlass* ik);
5140

5241
public:
5342

@@ -146,15 +135,8 @@ class VectorSupport : AllStatic {
146135

147136
static int vop2ideal(jint vop, BasicType bt);
148137

149-
#ifdef COMPILER2
150-
static instanceOop allocate_vector(InstanceKlass* holder, frame* fr, RegisterMap* reg_map, ObjectValue* sv, TRAPS);
151-
static instanceOop allocate_vector_payload(InstanceKlass* ik, frame* fr, RegisterMap* reg_map, ObjectValue* sv, TRAPS);
152-
#endif // COMPILER2
153-
154138
static bool is_vector(Klass* klass);
155139
static bool is_vector_payload_mf(Klass* klass);
156-
static bool is_vector_mask(Klass* klass);
157-
static bool is_vector_shuffle(Klass* klass);
158140
static bool skip_value_scalarization(Klass* klass);
159141
};
160142
#endif // SHARE_PRIMS_VECTORSUPPORT_HPP

‎src/hotspot/share/runtime/deoptimization.cpp

+28-46
Original file line numberDiff line numberDiff line change
@@ -1275,17 +1275,7 @@ bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, RegisterMap*
12751275

12761276
InstanceKlass* ik = InstanceKlass::cast(k);
12771277
if (obj == nullptr && !cache_init_error) {
1278-
#ifdef COMPILER2
1279-
if (EnableVectorSupport && VectorSupport::is_vector(ik)) {
1280-
obj = VectorSupport::allocate_vector(ik, fr, reg_map, sv, THREAD);
1281-
} else if (EnableVectorSupport && VectorSupport::is_vector_payload_mf(ik)) {
1282-
obj = VectorSupport::allocate_vector_payload(ik, fr, reg_map, sv, THREAD);
1283-
} else {
1284-
obj = ik->allocate_instance(THREAD);
1285-
}
1286-
#else
12871278
obj = ik->allocate_instance(THREAD);
1288-
#endif // COMPILER2
12891279
}
12901280
} else if (k->is_flatArray_klass()) {
12911281
FlatArrayKlass* ak = FlatArrayKlass::cast(k);
@@ -1305,6 +1295,14 @@ bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, RegisterMap*
13051295
failures = true;
13061296
}
13071297

1298+
if (k->is_inline_klass()) {
1299+
intptr_t is_larval = StackValue::create_stack_value(fr, reg_map, sv->is_larval())->get_int();
1300+
jint larval = (jint)*((jint*)&is_larval);
1301+
if (larval == 1) {
1302+
obj->set_mark(obj->mark().enter_larval_state());
1303+
}
1304+
}
1305+
13081306
assert(sv->value().is_null(), "redundant reallocation");
13091307
assert(obj != nullptr || HAS_PENDING_EXCEPTION || cache_init_error, "allocation should succeed or we should get an exception");
13101308
CLEAR_PENDING_EXCEPTION;
@@ -1535,7 +1533,7 @@ static void init_multi_field(oop obj, int offset, BasicType elem_bt, address add
15351533
}
15361534
}
15371535

1538-
static void reassign_multi_fields(frame* fr, RegisterMap* reg_map, Location location, oop obj, int offset, BasicType elem_bt, int fields_count) {
1536+
static void reassign_vectorized_multi_fields(frame* fr, RegisterMap* reg_map, Location location, oop obj, int offset, BasicType elem_bt, int fields_count) {
15391537
int elem_size = type2aelembytes(elem_bt);
15401538
if (location.is_register()) {
15411539
// Value was in a callee-saved register.
@@ -1560,12 +1558,12 @@ static void reassign_multi_fields(frame* fr, RegisterMap* reg_map, Location loca
15601558

15611559
// Restore fields of an eliminated instance object using the same field order
15621560
// returned by HotSpotResolvedObjectTypeImpl.getInstanceFields(true)
1563-
int Deoptimization::reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap* reg_map, ObjectValue* sv, int svIndex, oop obj, bool skip_internal, int base_offset, TRAPS) {
1561+
static int reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap* reg_map, ObjectValue* sv, int svIndex, oop obj, bool skip_internal, int base_offset, TRAPS) {
15641562
GrowableArray<ReassignedField>* fields = new GrowableArray<ReassignedField>();
15651563
InstanceKlass* ik = klass;
15661564
while (ik != nullptr) {
15671565
for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
1568-
if (!fs.access_flags().is_static() && !fs.field_descriptor().is_multifield() && (!skip_internal || !fs.field_flags().is_injected())) {
1566+
if (!fs.access_flags().is_static() && !fs.is_multifield() && (!skip_internal || !fs.field_flags().is_injected())) {
15691567
ReassignedField field;
15701568
field._offset = fs.offset();
15711569
field._type = Signature::basic_type(fs.signature());
@@ -1597,29 +1595,28 @@ int Deoptimization::reassign_fields_by_klass(InstanceKlass* klass, frame* fr, Re
15971595
continue; // Continue because we don't need to increment svIndex
15981596
}
15991597

1600-
Location location;
1601-
if (sv->field_at(svIndex)->is_location()) {
1602-
location = sv->field_at(svIndex)->as_LocationValue()->location();
1603-
}
16041598
int secondary_fields_count = fields->at(i)._secondary_fields_count;
1605-
if (secondary_fields_count > 1 && location.type() == Location::vector) {
1606-
// Re-assign vectorized multi-fields
1607-
reassign_multi_fields(fr, reg_map, location, obj, offset, type, secondary_fields_count);
1608-
svIndex++;
1609-
continue;
1599+
if (sv->field_at(svIndex)->is_location()) {
1600+
Location location = sv->field_at(svIndex)->as_LocationValue()->location();
1601+
if (location.type() == Location::vector) {
1602+
// Re-assign vectorized multi-fields
1603+
reassign_vectorized_multi_fields(fr, reg_map, location, obj, offset, type, secondary_fields_count);
1604+
svIndex++;
1605+
continue;
1606+
}
16101607
}
16111608

16121609
assert(secondary_fields_count <= sv->field_size(), "");
16131610
for (int j = 0; j < secondary_fields_count; j++) {
16141611
intptr_t val;
16151612
ScopeValue* scope_field = sv->field_at(svIndex);
16161613
StackValue* value = StackValue::create_stack_value(fr, reg_map, scope_field);
1617-
offset += j * type2aelembytes(type);
1614+
int sec_offset = offset + j * type2aelembytes(type);
16181615
switch (type) {
16191616
case T_OBJECT:
16201617
case T_ARRAY:
16211618
assert(value->type() == T_OBJECT, "Agreement.");
1622-
obj->obj_field_put(offset, value->get_obj()());
1619+
obj->obj_field_put(sec_offset, value->get_obj()());
16231620
break;
16241621

16251622
// Have to cast to INT (32 bits) pointer to avoid little/big-endian problem.
@@ -1647,7 +1644,7 @@ int Deoptimization::reassign_fields_by_klass(InstanceKlass* klass, frame* fr, Re
16471644
assert(fields->at(i)._type == T_INT, "T_INT field needed");
16481645
} else {
16491646
val = value->get_int();
1650-
obj->int_field_put(offset, (jint)*((jint*)&val));
1647+
obj->int_field_put(sec_offset, (jint)*((jint*)&val));
16511648
break;
16521649
}
16531650
}
@@ -1661,32 +1658,32 @@ int Deoptimization::reassign_fields_by_klass(InstanceKlass* klass, frame* fr, Re
16611658
#else
16621659
jlong res = jlong_from((jint)value->get_int(), (jint)low->get_int());
16631660
#endif
1664-
obj->long_field_put(offset, res);
1661+
obj->long_field_put(sec_offset, res);
16651662
break;
16661663
}
16671664

16681665
case T_SHORT:
16691666
assert(value->type() == T_INT, "Agreement.");
16701667
val = value->get_int();
1671-
obj->short_field_put(offset, (jshort)*((jint*)&val));
1668+
obj->short_field_put(sec_offset, (jshort)*((jint*)&val));
16721669
break;
16731670

16741671
case T_CHAR:
16751672
assert(value->type() == T_INT, "Agreement.");
16761673
val = value->get_int();
1677-
obj->char_field_put(offset, (jchar)*((jint*)&val));
1674+
obj->char_field_put(sec_offset, (jchar)*((jint*)&val));
16781675
break;
16791676

16801677
case T_BYTE:
16811678
assert(value->type() == T_INT, "Agreement.");
16821679
val = value->get_int();
1683-
obj->byte_field_put(offset, (jbyte)*((jint*)&val));
1680+
obj->byte_field_put(sec_offset, (jbyte)*((jint*)&val));
16841681
break;
16851682

16861683
case T_BOOLEAN:
16871684
assert(value->type() == T_INT, "Agreement.");
16881685
val = value->get_int();
1689-
obj->bool_field_put(offset, (jboolean)*((jint*)&val));
1686+
obj->bool_field_put(sec_offset, (jboolean)*((jint*)&val));
16901687
break;
16911688

16921689
default:
@@ -1735,22 +1732,7 @@ void Deoptimization::reassign_fields(frame* fr, RegisterMap* reg_map, GrowableAr
17351732
continue;
17361733
}
17371734
#endif // INCLUDE_JVMCI
1738-
#ifdef COMPILER2
1739-
if (EnableVectorSupport && (VectorSupport::is_vector(k) || VectorSupport::is_vector_payload_mf(k))) {
1740-
#ifndef PRODUCT
1741-
if (PrintDeoptimizationDetails) {
1742-
tty->print_cr("skip field reassignment for this vector - it should be assigned already");
1743-
if (Verbose) {
1744-
Handle obj = sv->value();
1745-
k->oop_print_on(obj(), tty);
1746-
}
1747-
}
1748-
#endif // !PRODUCT
1749-
continue; // Such vector's value was already restored in VectorSupport::allocate_vector().
1750-
// Else fall-through to do assignment for scalar-replaced boxed vector representation
1751-
// which could be restored after vector object allocation.
1752-
}
1753-
#endif /* !COMPILER2 */
1735+
17541736
if (k->is_instance_klass()) {
17551737
InstanceKlass* ik = InstanceKlass::cast(k);
17561738
reassign_fields_by_klass(ik, fr, reg_map, sv, 0, obj(), skip_internal, 0, CHECK);

‎src/hotspot/share/runtime/deoptimization.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ class Deoptimization : AllStatic {
207207
static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj);
208208
static void reassign_flat_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, flatArrayOop obj, FlatArrayKlass* vak, bool skip_internal, TRAPS);
209209
static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal, TRAPS);
210-
static int reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap* reg_map, ObjectValue* sv, int svIndex, oop obj, bool skip_internal, int base_offset, TRAPS);
211210

212211
static bool relock_objects(JavaThread* thread, GrowableArray<MonitorInfo*>* monitors,
213212
JavaThread* deoptee_thread, frame& fr, int exec_mode, bool realloc_failures);

0 commit comments

Comments
 (0)
Please sign in to comment.