Restore callee save registers in JNI compiler.
The GC may update these if objects move.
Change-Id: Idb7df85c614081abf02f41ba9ee033b0fb7ba2b2
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index b6b15f9..1c9aed8 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -81,7 +81,6 @@
UniquePtr<JniCallingConvention> end_jni_conv(
JniCallingConvention::Create(is_static, is_synchronized, jni_end_shorty, instruction_set));
-
// Assembler that holds generated instructions
UniquePtr<Assembler> jni_asm(Assembler::Create(instruction_set));
@@ -354,9 +353,9 @@
// 15. Process pending exceptions from JNI call or monitor exit.
__ ExceptionPoll(main_jni_conv->InterproceduralScratchRegister(), 0);
- // 16. Remove activation - no need to restore callee save registers because we didn't clobber
+ // 16. Remove activation - need to restore callee save registers since the GC may have changed
// them.
- __ RemoveFrame(frame_size, std::vector<ManagedRegister>());
+ __ RemoveFrame(frame_size, callee_save_regs);
// 17. Finalize code generation
__ EmitSlowPaths();