8033566: [parfait] warning from b128 for hotspot/src/share/vm/runtime/frame.cpp: JNI primitive type mismatch
authorccheung
Mon, 24 Mar 2014 10:48:44 -0700
changeset 23482 40418dd505d1
parent 23481 181afce33fe9
child 23483 0130945560ee
8033566: [parfait] warning from b128 for hotspot/src/share/vm/runtime/frame.cpp: JNI primitive type mismatch Summary: added an assert for checking the return value is <= max_jint Reviewed-by: coleenp, minqi
hotspot/src/share/vm/runtime/frame.cpp
--- a/hotspot/src/share/vm/runtime/frame.cpp	Sun Mar 23 08:31:44 2014 -0700
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Mon Mar 24 10:48:44 2014 -0700
@@ -531,13 +531,16 @@
   // Number of elements on the interpreter expression stack
   // Callers should span by stackElementWords
   int element_size = Interpreter::stackElementWords;
+  size_t stack_size = 0;
   if (frame::interpreter_frame_expression_stack_direction() < 0) {
-    return (interpreter_frame_expression_stack() -
-            interpreter_frame_tos_address() + 1)/element_size;
+    stack_size = (interpreter_frame_expression_stack() -
+                  interpreter_frame_tos_address() + 1)/element_size;
   } else {
-    return (interpreter_frame_tos_address() -
-            interpreter_frame_expression_stack() + 1)/element_size;
+    stack_size = (interpreter_frame_tos_address() -
+                  interpreter_frame_expression_stack() + 1)/element_size;
   }
+  assert( stack_size <= (size_t)max_jint, "stack size too big");
+  return ((jint)stack_size);
 }