846 assert(sv->value().is_null(), "redundant reallocation");
847 assert(obj != NULL || HAS_PENDING_EXCEPTION, "allocation should succeed or we should get an exception");
848 CLEAR_PENDING_EXCEPTION;
849 sv->set_value(obj);
850 }
851
852 if (failures) {
853 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), failures);
854 } else if (pending_exception.not_null()) {
855 thread->set_pending_exception(pending_exception(), exception_file, exception_line);
856 }
857
858 return failures;
859 }
860
861 // We're deoptimizing at the return of a call, value type fields are
862 // in registers. When we go back to the interpreter, it will expect a
863 // reference to a value type instance. Allocate and initialize it from
864 // the register values here.
865 bool Deoptimization::realloc_value_type_result(ValueKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS) {
866 oop new_vt = vk->realloc_result(map, return_oops, false, THREAD);
867 if (new_vt == NULL) {
868 CLEAR_PENDING_EXCEPTION;
869 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), true);
870 }
871 return_oops.clear();
872 return_oops.push(Handle(THREAD, new_vt));
873 return false;
874 }
875
876 // restore elements of an eliminated type array
877 void Deoptimization::reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type) {
878 int index = 0;
879 intptr_t val;
880
881 for (int i = 0; i < sv->field_size(); i++) {
882 StackValue* value = StackValue::create_stack_value(fr, reg_map, sv->field_at(i));
883 switch(type) {
884 case T_LONG: case T_DOUBLE: {
885 assert(value->type() == T_INT, "Agreement.");
886 StackValue* low =
|
846 assert(sv->value().is_null(), "redundant reallocation");
847 assert(obj != NULL || HAS_PENDING_EXCEPTION, "allocation should succeed or we should get an exception");
848 CLEAR_PENDING_EXCEPTION;
849 sv->set_value(obj);
850 }
851
852 if (failures) {
853 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), failures);
854 } else if (pending_exception.not_null()) {
855 thread->set_pending_exception(pending_exception(), exception_file, exception_line);
856 }
857
858 return failures;
859 }
860
861 // We're deoptimizing at the return of a call, value type fields are
862 // in registers. When we go back to the interpreter, it will expect a
863 // reference to a value type instance. Allocate and initialize it from
864 // the register values here.
865 bool Deoptimization::realloc_value_type_result(ValueKlass* vk, const RegisterMap& map, GrowableArray<Handle>& return_oops, TRAPS) {
866 oop new_vt = vk->realloc_result(map, return_oops, THREAD);
867 if (new_vt == NULL) {
868 CLEAR_PENDING_EXCEPTION;
869 THROW_OOP_(Universe::out_of_memory_error_realloc_objects(), true);
870 }
871 return_oops.clear();
872 return_oops.push(Handle(THREAD, new_vt));
873 return false;
874 }
875
876 // restore elements of an eliminated type array
877 void Deoptimization::reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type) {
878 int index = 0;
879 intptr_t val;
880
881 for (int i = 0; i < sv->field_size(); i++) {
882 StackValue* value = StackValue::create_stack_value(fr, reg_map, sv->field_at(i));
883 switch(type) {
884 case T_LONG: case T_DOUBLE: {
885 assert(value->type() == T_INT, "Agreement.");
886 StackValue* low =
|