862 assert(sv->value().is_null(), "redundant reallocation");
863 assert(obj != NULL || HAS_PENDING_EXCEPTION, "allocation should succeed or we should get an exception");
864 CLEAR_PENDING_EXCEPTION;
865 sv->set_value(obj);
866 }
867
868 if (failures) {
869 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), failures);
870 } else if (pending_exception.not_null()) {
871 thread->set_pending_exception(pending_exception(), exception_file, exception_line);
872 }
873
874 return failures;
875 }
876
877 // We're deoptimizing at the return of a call, value type fields are
878 // in registers. When we go back to the interpreter, it will expect a
879 // reference to a value type instance. Allocate and initialize it from
880 // the register values here.
881 bool Deoptimization::realloc_value_type_result(ValueKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS) {
882 VMRegPair* regs;
883 int nb_fields;
884 const GrowableArray<SigEntry>& sig_vk = vk->return_convention(regs, nb_fields);
885 regs++;
886 nb_fields--;
887 oop new_vt = vk->realloc_result(sig_vk, map, regs, return_oops, nb_fields, THREAD);
888 if (new_vt == NULL) {
889 CLEAR_PENDING_EXCEPTION;
890 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), true);
891 }
892 return_oops.clear();
893 return_oops.push(Handle(THREAD, new_vt));
894 return false;
895 }
896
897 // restore elements of an eliminated type array
898 void Deoptimization::reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type) {
899 int index = 0;
900 intptr_t val;
901
902 for (int i = 0; i < sv->field_size(); i++) {
903 StackValue* value = StackValue::create_stack_value(fr, reg_map, sv->field_at(i));
904 switch(type) {
905 case T_LONG: case T_DOUBLE: {
906 assert(value->type() == T_INT, "Agreement.");
907 StackValue* low =
|
862 assert(sv->value().is_null(), "redundant reallocation");
863 assert(obj != NULL || HAS_PENDING_EXCEPTION, "allocation should succeed or we should get an exception");
864 CLEAR_PENDING_EXCEPTION;
865 sv->set_value(obj);
866 }
867
868 if (failures) {
869 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), failures);
870 } else if (pending_exception.not_null()) {
871 thread->set_pending_exception(pending_exception(), exception_file, exception_line);
872 }
873
874 return failures;
875 }
876
877 // We're deoptimizing at the return of a call, value type fields are
878 // in registers. When we go back to the interpreter, it will expect a
879 // reference to a value type instance. Allocate and initialize it from
880 // the register values here.
881 bool Deoptimization::realloc_value_type_result(ValueKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS) {
882 oop new_vt = vk->realloc_result(map, return_oops, THREAD);
883 if (new_vt == NULL) {
884 CLEAR_PENDING_EXCEPTION;
885 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), true);
886 }
887 return_oops.clear();
888 return_oops.push(Handle(THREAD, new_vt));
889 return false;
890 }
891
892 // restore elements of an eliminated type array
893 void Deoptimization::reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type) {
894 int index = 0;
895 intptr_t val;
896
897 for (int i = 0; i < sv->field_size(); i++) {
898 StackValue* value = StackValue::create_stack_value(fr, reg_map, sv->field_at(i));
899 switch(type) {
900 case T_LONG: case T_DOUBLE: {
901 assert(value->type() == T_INT, "Agreement.");
902 StackValue* low =
|