Пример #1
0
bool LocationAddress::has_fixed_offset(jint& fixed_offset) {
  int base_offset;
  int actual_index;

  CodeGenerator* gen = code_generator() ;

  if (gen->omit_stack_frame()) {
    // Everything is accessed using jsp
    actual_index = frame()->stack_pointer() - index();
    fixed_offset = JavaFrame::arg_offset_from_sp(actual_index);     
  } else {
    // With a stack frame: locals are accessed using fp
    //                     stacks are accessed using jsp
    if (is_local()) {
      // The offset from the fp that would have it point at the end of the
      // locals block 
      base_offset = JavaFrame::end_of_locals_offset();
      actual_index = gen->root_method()->max_locals() - 1 - index();
    } else {
      if (Assembler::jsp == Assembler::sp) {
        // We need to make sure that we don't put something beyond
        // the current end of stack
        gen->ensure_sufficient_stack_for(index(), type());
      } 
      base_offset = 0;
      actual_index = gen->frame()->stack_pointer() - index();
    }
    fixed_offset = base_offset + JavaFrame::arg_offset_from_sp(actual_index);
  }
  return true;
}