diff src/share/vm/c1/c1_IR.cpp @ 1819:f02a8bbe6ed4

6986046: C1 valuestack cleanup Summary: fixes an historical oddity in C1 with inlining where all of the expression stacks are kept in the topmost ValueStack instead of being in their respective ValueStacks. Reviewed-by: never Contributed-by: Christian Wimmer <cwimmer@uci.edu>
author roland
date Tue, 29 Dec 2009 19:08:54 +0100
parents d5d065957597
children 42a10fc37986
line wrap: on
line diff
--- a/src/share/vm/c1/c1_IR.cpp	Wed Sep 22 23:51:03 2010 -0700
+++ b/src/share/vm/c1/c1_IR.cpp	Tue Dec 29 19:08:54 2009 +0100
@@ -116,24 +116,6 @@
 
 
 // Implementation of IRScope
-
-BlockBegin* IRScope::header_block(BlockBegin* entry, BlockBegin::Flag f, ValueStack* state) {
-  if (entry == NULL) return NULL;
-  assert(entry->is_set(f), "entry/flag mismatch");
-  // create header block
-  BlockBegin* h = new BlockBegin(entry->bci());
-  BlockEnd* g = new Goto(entry, false);
-  h->set_next(g, entry->bci());
-  h->set_end(g);
-  h->set(f);
-  // setup header block end state
-  ValueStack* s = state->copy(); // can use copy since stack is empty (=> no phis)
-  assert(s->stack_is_empty(), "must have empty stack at entry point");
-  g->set_state(s);
-  return h;
-}
-
-
 BlockBegin* IRScope::build_graph(Compilation* compilation, int osr_bci) {
   GraphBuilder gm(compilation, this);
   NOT_PRODUCT(if (PrintValueNumbering && Verbose) gm.print_stats());
@@ -145,12 +127,9 @@
 IRScope::IRScope(Compilation* compilation, IRScope* caller, int caller_bci, ciMethod* method, int osr_bci, bool create_graph)
 : _callees(2)
 , _compilation(compilation)
-, _lock_stack_size(-1)
 , _requires_phi_function(method->max_locals())
 {
   _caller             = caller;
-  _caller_bci         = caller == NULL ? -1 : caller_bci;
-  _caller_state       = NULL; // Must be set later if needed
   _level              = caller == NULL ?  0 : caller->level() + 1;
   _method             = method;
   _xhandlers          = new XHandlers(method);
@@ -182,32 +161,6 @@
 }
 
 
-void IRScope::compute_lock_stack_size() {
-  if (!InlineMethodsWithExceptionHandlers) {
-    _lock_stack_size = 0;
-    return;
-  }
-
-  // Figure out whether we have to preserve expression stack elements
-  // for parent scopes, and if so, how many
-  IRScope* cur_scope = this;
-  while (cur_scope != NULL && !cur_scope->xhandlers()->has_handlers()) {
-    cur_scope = cur_scope->caller();
-  }
-  _lock_stack_size = (cur_scope == NULL ? 0 :
-                      (cur_scope->caller_state() == NULL ? 0 :
-                       cur_scope->caller_state()->stack_size()));
-}
-
-int IRScope::top_scope_bci() const {
-  assert(!is_top_scope(), "no correct answer for top scope possible");
-  const IRScope* scope = this;
-  while (!scope->caller()->is_top_scope()) {
-    scope = scope->caller();
-  }
-  return scope->caller_bci();
-}
-
 bool IRScopeDebugInfo::should_reexecute() {
   ciMethod* cur_method = scope()->method();
   int       cur_bci    = bci();
@@ -222,37 +175,24 @@
 // Implementation of CodeEmitInfo
 
 // Stack must be NON-null
-CodeEmitInfo::CodeEmitInfo(int bci, ValueStack* stack, XHandlers* exception_handlers)
+CodeEmitInfo::CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers)
   : _scope(stack->scope())
-  , _bci(bci)
   , _scope_debug_info(NULL)
   , _oop_map(NULL)
   , _stack(stack)
   , _exception_handlers(exception_handlers)
-  , _next(NULL)
-  , _id(-1)
   , _is_method_handle_invoke(false) {
   assert(_stack != NULL, "must be non null");
-  assert(_bci == SynchronizationEntryBCI || Bytecodes::is_defined(scope()->method()->java_code_at_bci(_bci)), "make sure bci points at a real bytecode");
 }
 
 
-CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, bool lock_stack_only)
+CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
   : _scope(info->_scope)
   , _exception_handlers(NULL)
-  , _bci(info->_bci)
   , _scope_debug_info(NULL)
   , _oop_map(NULL)
+  , _stack(stack == NULL ? info->_stack : stack)
   , _is_method_handle_invoke(info->_is_method_handle_invoke) {
-  if (lock_stack_only) {
-    if (info->_stack != NULL) {
-      _stack = info->_stack->copy_locks();
-    } else {
-      _stack = NULL;
-    }
-  } else {
-    _stack = info->_stack;
-  }
 
   // deep copy of exception handlers
   if (info->_exception_handlers != NULL) {
@@ -273,8 +213,6 @@
   assert(_oop_map != NULL, "oop map must already exist");
   assert(opr->is_single_cpu(), "should not call otherwise");
 
-  int frame_size = frame_map()->framesize();
-  int arg_count = frame_map()->oop_map_arg_count();
   VMReg name = frame_map()->regname(opr);
   _oop_map->set_oop(name);
 }
@@ -383,8 +321,7 @@
   void visit(Value* n) {
     // Local instructions and Phis for expression stack values at the
     // start of basic blocks are not added to the instruction list
-    if ((*n)->bci() == -99 && (*n)->as_Local() == NULL &&
-        (*n)->as_Phi() == NULL) {
+    if (!(*n)->is_linked()&& (*n)->can_be_linked()) {
       assert(false, "a node was not appended to the graph");
       Compilation::current()->bailout("a node was not appended to the graph");
     }
@@ -1338,7 +1275,7 @@
     // need to remove this instruction from the instruction stream
     if (n->subst() != n) {
       assert(last != NULL, "must have last");
-      last->set_next(n->next(), n->next()->bci());
+      last->set_next(n->next());
     } else {
       last = n;
     }