src/share/vm/runtime/frame.cpp

changeset 1868
df736661d0c8
parent 1844
cff162798819
parent 1861
2338d41fbd81
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/runtime/frame.cpp	Mon May 10 14:58:38 2010 -0700
     1.2 +++ b/src/share/vm/runtime/frame.cpp	Tue May 11 15:19:19 2010 -0700
     1.3 @@ -468,42 +468,16 @@
     1.4    return &((*interpreter_frame_locals_addr())[n]);
     1.5  }
     1.6  
     1.7 -frame::Tag frame::interpreter_frame_local_tag(int index) const {
     1.8 -  const int n = Interpreter::local_tag_offset_in_bytes(index)/wordSize;
     1.9 -  return (Tag)(*interpreter_frame_locals_addr()) [n];
    1.10 -}
    1.11 -
    1.12 -void frame::interpreter_frame_set_local_tag(int index, Tag tag) const {
    1.13 -  const int n = Interpreter::local_tag_offset_in_bytes(index)/wordSize;
    1.14 -  (*interpreter_frame_locals_addr())[n] = (intptr_t)tag;
    1.15 -}
    1.16 -
    1.17  intptr_t* frame::interpreter_frame_expression_stack_at(jint offset) const {
    1.18    const int i = offset * interpreter_frame_expression_stack_direction();
    1.19 -  const int n = ((i * Interpreter::stackElementSize()) +
    1.20 -                 Interpreter::value_offset_in_bytes())/wordSize;
    1.21 +  const int n = i * Interpreter::stackElementWords;
    1.22    return &(interpreter_frame_expression_stack()[n]);
    1.23  }
    1.24  
    1.25 -frame::Tag frame::interpreter_frame_expression_stack_tag(jint offset) const {
    1.26 -  const int i = offset * interpreter_frame_expression_stack_direction();
    1.27 -  const int n = ((i * Interpreter::stackElementSize()) +
    1.28 -                 Interpreter::tag_offset_in_bytes())/wordSize;
    1.29 -  return (Tag)(interpreter_frame_expression_stack()[n]);
    1.30 -}
    1.31 -
    1.32 -void frame::interpreter_frame_set_expression_stack_tag(jint offset,
    1.33 -                                                       Tag tag) const {
    1.34 -  const int i = offset * interpreter_frame_expression_stack_direction();
    1.35 -  const int n = ((i * Interpreter::stackElementSize()) +
    1.36 -                 Interpreter::tag_offset_in_bytes())/wordSize;
    1.37 -  interpreter_frame_expression_stack()[n] = (intptr_t)tag;
    1.38 -}
    1.39 -
    1.40  jint frame::interpreter_frame_expression_stack_size() const {
    1.41    // Number of elements on the interpreter expression stack
    1.42    // Callers should span by stackElementWords
    1.43 -  int element_size = Interpreter::stackElementWords();
    1.44 +  int element_size = Interpreter::stackElementWords;
    1.45    if (frame::interpreter_frame_expression_stack_direction() < 0) {
    1.46      return (interpreter_frame_expression_stack() -
    1.47              interpreter_frame_tos_address() + 1)/element_size;
    1.48 @@ -585,20 +559,12 @@
    1.49    for (i = 0; i < interpreter_frame_method()->max_locals(); i++ ) {
    1.50      intptr_t x = *interpreter_frame_local_at(i);
    1.51      st->print(" - local  [" INTPTR_FORMAT "]", x);
    1.52 -    if (TaggedStackInterpreter) {
    1.53 -      Tag x = interpreter_frame_local_tag(i);
    1.54 -      st->print(" - local tag [" INTPTR_FORMAT "]", x);
    1.55 -    }
    1.56      st->fill_to(23);
    1.57      st->print_cr("; #%d", i);
    1.58    }
    1.59    for (i = interpreter_frame_expression_stack_size() - 1; i >= 0; --i ) {
    1.60      intptr_t x = *interpreter_frame_expression_stack_at(i);
    1.61      st->print(" - stack  [" INTPTR_FORMAT "]", x);
    1.62 -    if (TaggedStackInterpreter) {
    1.63 -      Tag x = interpreter_frame_expression_stack_tag(i);
    1.64 -      st->print(" - stack tag [" INTPTR_FORMAT "]", x);
    1.65 -    }
    1.66      st->fill_to(23);
    1.67      st->print_cr("; #%d", i);
    1.68    }
    1.69 @@ -950,103 +916,19 @@
    1.70      }
    1.71    }
    1.72  
    1.73 -  if (TaggedStackInterpreter) {
    1.74 -    // process locals & expression stack
    1.75 -    InterpreterOopMap *mask = NULL;
    1.76 -#ifdef ASSERT
    1.77 -    InterpreterOopMap oopmap_mask;
    1.78 -    OopMapCache::compute_one_oop_map(m, bci, &oopmap_mask);
    1.79 -    mask = &oopmap_mask;
    1.80 -#endif // ASSERT
    1.81 -    oops_interpreted_locals_do(f, max_locals, mask);
    1.82 -    oops_interpreted_expressions_do(f, signature, has_receiver,
    1.83 -                                    m->max_stack(),
    1.84 -                                    max_locals, mask);
    1.85 +  InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
    1.86 +
    1.87 +  // process locals & expression stack
    1.88 +  InterpreterOopMap mask;
    1.89 +  if (query_oop_map_cache) {
    1.90 +    m->mask_for(bci, &mask);
    1.91    } else {
    1.92 -    InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f);
    1.93 -
    1.94 -    // process locals & expression stack
    1.95 -    InterpreterOopMap mask;
    1.96 -    if (query_oop_map_cache) {
    1.97 -      m->mask_for(bci, &mask);
    1.98 -    } else {
    1.99 -      OopMapCache::compute_one_oop_map(m, bci, &mask);
   1.100 -    }
   1.101 -    mask.iterate_oop(&blk);
   1.102 +    OopMapCache::compute_one_oop_map(m, bci, &mask);
   1.103    }
   1.104 +  mask.iterate_oop(&blk);
   1.105  }
   1.106  
   1.107  
   1.108 -void frame::oops_interpreted_locals_do(OopClosure *f,
   1.109 -                                      int max_locals,
   1.110 -                                      InterpreterOopMap *mask) {
   1.111 -  // Process locals then interpreter expression stack
   1.112 -  for (int i = 0; i < max_locals; i++ ) {
   1.113 -    Tag tag = interpreter_frame_local_tag(i);
   1.114 -    if (tag == TagReference) {
   1.115 -      oop* addr = (oop*) interpreter_frame_local_at(i);
   1.116 -      assert((intptr_t*)addr >= sp(), "must be inside the frame");
   1.117 -      f->do_oop(addr);
   1.118 -#ifdef ASSERT
   1.119 -    } else {
   1.120 -      assert(tag == TagValue, "bad tag value for locals");
   1.121 -      oop* p = (oop*) interpreter_frame_local_at(i);
   1.122 -      // Not always true - too bad.  May have dead oops without tags in locals.
   1.123 -      // assert(*p == NULL || !(*p)->is_oop(), "oop not tagged on interpreter locals");
   1.124 -      assert(*p == NULL || !mask->is_oop(i), "local oop map mismatch");
   1.125 -#endif // ASSERT
   1.126 -    }
   1.127 -  }
   1.128 -}
   1.129 -
   1.130 -void frame::oops_interpreted_expressions_do(OopClosure *f,
   1.131 -                                      symbolHandle signature,
   1.132 -                                      bool has_receiver,
   1.133 -                                      int max_stack,
   1.134 -                                      int max_locals,
   1.135 -                                      InterpreterOopMap *mask) {
   1.136 -  // There is no stack no matter what the esp is pointing to (native methods
   1.137 -  // might look like expression stack is nonempty).
   1.138 -  if (max_stack == 0) return;
   1.139 -
   1.140 -  // Point the top of the expression stack above arguments to a call so
   1.141 -  // arguments aren't gc'ed as both stack values for callee and callee
   1.142 -  // arguments in callee's locals.
   1.143 -  int args_size = 0;
   1.144 -  if (!signature.is_null()) {
   1.145 -    args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
   1.146 -  }
   1.147 -
   1.148 -  intptr_t *tos_addr = interpreter_frame_tos_at(args_size);
   1.149 -  assert(args_size != 0 || tos_addr == interpreter_frame_tos_address(), "these are same");
   1.150 -  intptr_t *frst_expr = interpreter_frame_expression_stack_at(0);
   1.151 -  // In case of exceptions, the expression stack is invalid and the esp
   1.152 -  // will be reset to express this condition. Therefore, we call f only
   1.153 -  // if addr is 'inside' the stack (i.e., addr >= esp for Intel).
   1.154 -  bool in_stack;
   1.155 -  if (interpreter_frame_expression_stack_direction() > 0) {
   1.156 -    in_stack = (intptr_t*)frst_expr <= tos_addr;
   1.157 -  } else {
   1.158 -    in_stack = (intptr_t*)frst_expr >= tos_addr;
   1.159 -  }
   1.160 -  if (!in_stack) return;
   1.161 -
   1.162 -  jint stack_size = interpreter_frame_expression_stack_size() - args_size;
   1.163 -  for (int j = 0; j < stack_size; j++) {
   1.164 -    Tag tag = interpreter_frame_expression_stack_tag(j);
   1.165 -    if (tag == TagReference) {
   1.166 -      oop *addr = (oop*) interpreter_frame_expression_stack_at(j);
   1.167 -      f->do_oop(addr);
   1.168 -#ifdef ASSERT
   1.169 -    } else {
   1.170 -      assert(tag == TagValue, "bad tag value for stack element");
   1.171 -      oop *p = (oop*) interpreter_frame_expression_stack_at((j));
   1.172 -      assert(*p == NULL || !mask->is_oop(j+max_locals), "stack oop map mismatch");
   1.173 -#endif // ASSERT
   1.174 -    }
   1.175 -  }
   1.176 -}
   1.177 -
   1.178  void frame::oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f) {
   1.179    InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
   1.180    finder.oops_do();
   1.181 @@ -1306,29 +1188,18 @@
   1.182  
   1.183    int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals();
   1.184  
   1.185 -  if (TaggedStackInterpreter) {
   1.186 -    InterpreterOopMap *mask = NULL;
   1.187 -#ifdef ASSERT
   1.188 -    InterpreterOopMap oopmap_mask;
   1.189 -    methodHandle method(thread, m);
   1.190 -    OopMapCache::compute_one_oop_map(method, bci, &oopmap_mask);
   1.191 -    mask = &oopmap_mask;
   1.192 -#endif // ASSERT
   1.193 -    oops_interpreted_locals_do(&_check_oop, max_locals, mask);
   1.194 -  } else {
   1.195 -    // process dynamic part
   1.196 -    InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(),
   1.197 -                                      &_check_value);
   1.198 -    InterpreterFrameClosure   oop_blk(this, max_locals, m->max_stack(),
   1.199 -                                      &_check_oop  );
   1.200 -    InterpreterFrameClosure  dead_blk(this, max_locals, m->max_stack(),
   1.201 -                                      &_zap_dead   );
   1.202 +  // process dynamic part
   1.203 +  InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(),
   1.204 +                                    &_check_value);
   1.205 +  InterpreterFrameClosure   oop_blk(this, max_locals, m->max_stack(),
   1.206 +                                    &_check_oop  );
   1.207 +  InterpreterFrameClosure  dead_blk(this, max_locals, m->max_stack(),
   1.208 +                                    &_zap_dead   );
   1.209  
   1.210 -    // get frame map
   1.211 -    InterpreterOopMap mask;
   1.212 -    m->mask_for(bci, &mask);
   1.213 -    mask.iterate_all( &oop_blk, &value_blk, &dead_blk);
   1.214 -  }
   1.215 +  // get frame map
   1.216 +  InterpreterOopMap mask;
   1.217 +  m->mask_for(bci, &mask);
   1.218 +  mask.iterate_all( &oop_blk, &value_blk, &dead_blk);
   1.219  }
   1.220  
   1.221  

mercurial