8008328: [partfait] Null pointer defererence in hotspot/src/cpu/x86/vm/frame_x86.inline.hpp
authormorris
Sat, 16 Mar 2013 07:40:36 -0700
changeset 16363 d6b2cbb70886
parent 16362 7b5c4f403e90
child 16364 df8dee985901
8008328: [partfait] Null pointer defererence in hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Summary: add guarantee() to oop_result inlines Reviewed-by: kvn, twisti
hotspot/src/cpu/x86/vm/frame_x86.inline.hpp
--- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Sat Mar 16 07:39:57 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Sat Mar 16 07:40:36 2013 -0700
@@ -295,14 +295,18 @@
   return true;
 }
 
-
+inline oop frame::saved_oop_result(RegisterMap* map) const {
+  oop* result_adr = (oop *)map->location(rax->as_VMReg());
+  guarantee(result_adr != NULL, "bad register save location");
 
-inline oop frame::saved_oop_result(RegisterMap* map) const       {
-  return *((oop*) map->location(rax->as_VMReg()));
+  return (*result_adr);
 }
 
 inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
-  *((oop*) map->location(rax->as_VMReg())) = obj;
+  oop* result_adr = (oop *)map->location(rax->as_VMReg());
+  guarantee(result_adr != NULL, "bad register save location");
+
+  *result_adr = obj;
 }
 
 #endif // CPU_X86_VM_FRAME_X86_INLINE_HPP