changeset 2011:53dbe853fb3a

6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow") Summary: Check constant Tag type instead of calling get_constant(). Reviewed-by: never
author kvn
date Mon, 23 Aug 2010 09:09:36 -0700
parents 4b29a725c43c
children 3e8fbc61cee8
files src/share/vm/ci/bcEscapeAnalyzer.cpp
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Fri Aug 20 23:40:30 2010 -0700
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Mon Aug 23 09:09:36 2010 -0700
@@ -92,11 +92,11 @@
     empty_map.clear();
   }
 
-  ArgumentMap raw_pop()  { assert(_stack_height > 0, "stack underflow"); return _stack[--_stack_height]; }
+  ArgumentMap raw_pop()  { guarantee(_stack_height > 0, "stack underflow"); return _stack[--_stack_height]; }
   ArgumentMap  apop()    { return raw_pop(); }
   void spop()            { raw_pop(); }
   void lpop()            { spop(); spop(); }
-  void raw_push(ArgumentMap i)   { assert(_stack_height < _max_stack, "stack overflow"); _stack[_stack_height++] = i; }
+  void raw_push(ArgumentMap i)   { guarantee(_stack_height < _max_stack, "stack overflow"); _stack[_stack_height++] = i; }
   void apush(ArgumentMap i)      { raw_push(i); }
   void spush()           { raw_push(empty_map); }
   void lpush()           { spush(); spush(); }
@@ -365,12 +365,19 @@
       case Bytecodes::_ldc:
       case Bytecodes::_ldc_w:
       case Bytecodes::_ldc2_w:
-        if (type2size[s.get_constant().basic_type()] == 1) {
+      {
+        // Avoid calling get_constant() which will try to allocate
+        // unloaded constant. We need only constant's type.
+        int index = s.get_constant_pool_index();
+        constantTag tag = s.get_constant_pool_tag(index);
+        if (tag.is_long() || tag.is_double()) {
+          // Only longs and doubles use 2 stack slots.
+          state.lpush();
+        } else {
           state.spush();
-        } else {
-          state.lpush();
         }
         break;
+      }
       case Bytecodes::_aload:
         state.apush(state._vars[s.get_index()]);
         break;