Example #1
0
associationOop oopFactory::new_association(symbolOop key, oop value, bool is_constant) {
  associationOop as = associationOop(Universe::associationKlassObj()->klass_part()->allocateObject());
  assert(as->is_association(), "type check");
  as->set_key(key);
  as->set_value(value);
  as->set_is_constant(is_constant);
  return as;
}
void associationKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
  // header
  memOop(obj)->oop_iterate_header(blk);
  associationOop assoc = associationOop(obj);
  blk->do_oop((oop*) &assoc->addr()->_key);
  blk->do_oop((oop*) &assoc->addr()->_value);
  blk->do_oop((oop*) &assoc->addr()->_is_constant);
  // instance variables
  memOop(obj)->oop_iterate_body(blk, associationOopDesc::header_size(), non_indexable_size());
}
void associationKlass::oop_short_print_on(oop obj, outputStream* st) {
  associationOop assoc = associationOop(obj);
  st->print("{"); 
  assoc->key()->print_symbol_on(st);
  st->print(", "); 
  assoc->value()->print_value_on(st);
  if (assoc->is_constant()) {
    st->print(" (constant)");
  }
  st->print("} "); 
}
void associationKlass::oop_print_value_on(oop obj, outputStream* st) {
  associationOop assoc = associationOop(obj);
  if (PrintObjectID) {
    memOop(obj)->print_id_on(st);
    st->print("-");
  }
  print_name_on(st);
  st->print(" {"); 
  assoc->key()->print_symbol_on(st);
  st->print(", "); 
  assoc->value()->print_value_on(st);
  if (assoc->is_constant()) {
    st->print(" (constant)");
  }
  st->print("}");
  if (PrintOopAddress) st->print(" (%#x)", this);
}
void MethodIterator::dispatch(MethodClosure* blk) {
  bool oldFailState = blk->in_prim_failure_block();
  blk->set_prim_failure(_interval->in_prim_failure_block());
  CodeIterator iter(_interval->method(), _interval->begin_bci());
  int lastArgNo = _interval->method()->number_of_arguments() - 1;
  blk->set_method(_interval->method());
  int next_bci = _interval->begin_bci();

  while (next_bci < _interval->end_bci() && !blk->aborting()) {
    iter.set_bci(next_bci);
    blk->set_bci(iter.bci());

    next_bci = iter.next_bci();
    blk->set_next_bci(next_bci);

    switch(iter.code()) {
      case Bytecodes::push_temp_0:
        blk->push_temporary(0);
        break;
      case Bytecodes::push_temp_1:
        blk->push_temporary(1);
        break;
      case Bytecodes::push_temp_2:
        blk->push_temporary(2);
        break;
      case Bytecodes::push_temp_3:
        blk->push_temporary(3);
        break;
      case Bytecodes::push_temp_4:
        blk->push_temporary(4);
        break;
      case Bytecodes::push_temp_5:
        blk->push_temporary(5);
        break;
      case Bytecodes::unimplemented_06:
        unknown_code(Bytecodes::unimplemented_06);
        break;
      case Bytecodes::push_temp_n:
        blk->push_temporary(255 - iter.byte_at(1));
        break;
      case Bytecodes::push_arg_1:
        blk->push_argument(lastArgNo);
        break;
      case Bytecodes::push_arg_2:
        blk->push_argument(lastArgNo - 1);
        break;
      case Bytecodes::push_arg_3:
        blk->push_argument(lastArgNo - 2);
        break;
      case Bytecodes::push_arg_n:
        blk->push_argument(lastArgNo - iter.byte_at(1));
        break;
      case Bytecodes::allocate_temp_1:
        blk->allocate_temporaries(1);
        break;
      case Bytecodes::allocate_temp_2:
        blk->allocate_temporaries(2);
        break;
      case Bytecodes::allocate_temp_3:
        blk->allocate_temporaries(3);
        break;
      case Bytecodes::allocate_temp_n:
        blk->allocate_temporaries(map0to256(iter.byte_at(1)));
        break;
      case Bytecodes::store_temp_0_pop:
        blk->store_temporary(0);
        blk->pop();
        break;
      case Bytecodes::store_temp_1_pop:
        blk->store_temporary(1);
        blk->pop();
        break;
      case Bytecodes::store_temp_2_pop:
        blk->store_temporary(2);
        blk->pop();
        break;
      case Bytecodes::store_temp_3_pop:
        blk->store_temporary(3);
        blk->pop();
        break;
      case Bytecodes::store_temp_4_pop:
        blk->store_temporary(4);
        blk->pop();
        break;
      case Bytecodes::store_temp_5_pop:
        blk->store_temporary(5);
        blk->pop();
        break;
      case Bytecodes::store_temp_n:
        blk->store_temporary(255 - iter.byte_at(1));
        break;
      case Bytecodes::store_temp_n_pop:
        blk->store_temporary(255 - iter.byte_at(1));
        blk->pop();
        break;
      case Bytecodes::push_neg_n:
        blk->push_literal(as_smiOop(-(int) iter.byte_at(1)));
        break;
      case Bytecodes::push_succ_n:
        blk->push_literal(as_smiOop(iter.byte_at(1)+1));
        break;
      case Bytecodes::push_literal:
        blk->push_literal(iter.oop_at(1));
        break;
      case Bytecodes::push_tos:
        blk->push_tos();
        break;
      case Bytecodes::push_self:
        blk->push_self();
        break;
      case Bytecodes::push_nil:
        blk->push_literal(nilObj);
        break;
      case Bytecodes::push_true:
        blk->push_literal(trueObj);
        break;
      case Bytecodes::push_false:
        blk->push_literal(falseObj);
        break;
      case Bytecodes::unimplemented_20:
        unknown_code(Bytecodes::unimplemented_20);
        break;
      case Bytecodes::unimplemented_21:
        unknown_code(Bytecodes::unimplemented_21);
        break;
      case Bytecodes::unimplemented_22:
        unknown_code(Bytecodes::unimplemented_22);
        break;
      case Bytecodes::unimplemented_23:
        unknown_code(Bytecodes::unimplemented_23);
        break;
      case Bytecodes::unimplemented_24:
        unknown_code(Bytecodes::unimplemented_24);
        break;
      case Bytecodes::unimplemented_25:
        unknown_code(Bytecodes::unimplemented_25);
        break;
      case Bytecodes::unimplemented_26:
        unknown_code(Bytecodes::unimplemented_26);
        break;
      case Bytecodes::unimplemented_27:
        unknown_code(Bytecodes::unimplemented_27);
        break;
      case Bytecodes::return_instVar_name: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->push_instVar_name(name);
        blk->method_return(0); 
                                           }
                                           break;
      case Bytecodes::push_classVar: {
        associationOop assoc = associationOop(iter.oop_at(1));
        assert(assoc->is_association(), "must be association");
        blk->push_classVar(assoc); 
                                     }
                                     break;
      case Bytecodes::store_classVar_pop: {
        associationOop assoc = associationOop(iter.oop_at(1));
        assert(assoc->is_association(), "must be association");
        blk->store_classVar(assoc);
        blk->pop(); 
                                          }
                                          break;
      case Bytecodes::store_classVar: {
        associationOop assoc = associationOop(iter.oop_at(1));
        assert(assoc->is_association(), "must be association");
        blk->store_classVar(assoc);
                                      }
                                      break;
      case Bytecodes::return_instVar: {
        smiOop offset = smiOop(iter.oop_at(1));
        assert(offset->is_smi(), "must be smi");
        blk->push_instVar(offset->value());
        blk->method_return(0); 
                                      }
                                      break;
      case Bytecodes::push_instVar: {
        smiOop offset = smiOop(iter.oop_at(1));
        assert(offset->is_smi(), "must be smi");
        blk->push_instVar(offset->value());
                                    }
                                    break;
      case Bytecodes::store_instVar_pop: {
        smiOop offset = smiOop(iter.oop_at(1));
        assert(offset->is_smi(), "must be smi");
        blk->store_instVar(offset->value());
        blk->pop();
                                         }
                                         break;
      case Bytecodes::store_instVar:{
        smiOop offset = smiOop(iter.oop_at(1));
        assert(offset->is_smi(), "must be smi");
        blk->store_instVar(offset->value());
                                    }
                                    break;
      case Bytecodes::float_allocate:
        blk->allocate_temporaries(1 + iter.byte_at(1)*2);
        blk->float_allocate(iter.byte_at(2), iter.byte_at(3));
        break;
      case Bytecodes::float_floatify_pop:
        blk->float_floatify(Floats::floatify, blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::float_move:
        blk->float_move(blk->float_at(iter.byte_at(1)), blk->float_at(iter.byte_at(2)));
        break;
      case Bytecodes::float_set:
        blk->float_set(blk->float_at(iter.byte_at(1)), *(doubleOop*)iter.aligned_oop(2));
        break;
      case Bytecodes::float_nullary_op:
        blk->float_nullary(Floats::Function(iter.byte_at(2)), blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::float_unary_op:
        blk->float_unary(Floats::Function(iter.byte_at(2)), blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::float_binary_op:
        blk->float_binary(Floats::Function(iter.byte_at(2)), blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::float_unary_op_to_oop:
        blk->float_unaryToOop(Floats::Function(iter.byte_at(2)), blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::float_binary_op_to_oop:
        blk->float_binaryToOop(Floats::Function(iter.byte_at(2)), blk->float_at(iter.byte_at(1)));
        break;
      case Bytecodes::unimplemented_39:
        unknown_code(Bytecodes::unimplemented_39);
        break;
      case Bytecodes::unimplemented_3a:
        unknown_code(Bytecodes::unimplemented_3a);
        break;
      case Bytecodes::unimplemented_3b:
        unknown_code(Bytecodes::unimplemented_3b); 
        break;
      case Bytecodes::unimplemented_3c:
        unknown_code(Bytecodes::unimplemented_3c); 
        break;
      case Bytecodes::push_instVar_name: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->push_instVar_name(name);
                                         }
                                         break;
      case Bytecodes::store_instVar_pop_name:  {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->store_instVar_name(name);
        blk->pop();
                                               }
                                               break;
      case Bytecodes::store_instVar_name:  {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->store_instVar_name(name);
                                           }
                                           break;
      case Bytecodes::push_temp_0_context_0:
        blk->push_temporary(0, 0);
        break;
      case Bytecodes::push_temp_1_context_0:
        blk->push_temporary(1, 0);
        break;
      case Bytecodes::push_temp_2_context_0:
        blk->push_temporary(2, 0);
        break;
      case Bytecodes::push_temp_n_context_0:
        blk->push_temporary(iter.byte_at(1), 0);
        break;
      case Bytecodes::store_temp_0_context_0_pop:
        blk->store_temporary(0, 0);
        blk->pop();
        break;
      case Bytecodes::store_temp_1_context_0_pop:
        blk->store_temporary(1, 0);
        blk->pop();
        break;
      case Bytecodes::store_temp_2_context_0_pop: 
        blk->store_temporary(2, 0);
        blk->pop();
        break;
      case Bytecodes::store_temp_n_context_0_pop:
        blk->store_temporary(iter.byte_at(1), 0);
        blk->pop();
        break;
      case Bytecodes::push_new_closure_context_0:
        blk->allocate_closure(context_as_scope, 0, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_context_1:
        blk->allocate_closure(context_as_scope, 1, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_context_2:
        blk->allocate_closure(context_as_scope, 2, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_context_n:
        blk->allocate_closure(context_as_scope, iter.byte_at(1), methodOop(iter.oop_at(2)));
        break;
      case Bytecodes::install_new_context_method_0:
        blk->allocate_context(0, true);
        break;
      case Bytecodes::install_new_context_method_1:
        blk->allocate_context(1, true);
        break;
      case Bytecodes::install_new_context_method_2:
        blk->allocate_context(2, true);
        break;
      case Bytecodes::install_new_context_method_n:
        blk->allocate_context(iter.byte_at(1), true);
        break;
      case Bytecodes::push_temp_0_context_1:
        blk->push_temporary(0, 1);
        break;
      case Bytecodes::push_temp_1_context_1:
        blk->push_temporary(1, 1);
        break;
      case Bytecodes::push_temp_2_context_1:
        blk->push_temporary(2, 1);
        break;
      case Bytecodes::push_temp_n_context_1:
        blk->push_temporary(iter.byte_at(1), 1);
        break;
      case Bytecodes::store_temp_0_context_1_pop:
        blk->store_temporary(0, 1);
        blk->pop();
        break;
      case Bytecodes::store_temp_1_context_1_pop:
        blk->store_temporary(1, 1);
        blk->pop();
        break;
      case Bytecodes::store_temp_2_context_1_pop:
        blk->store_temporary(2, 1);
        blk->pop();
        break;
      case Bytecodes::store_temp_n_context_1_pop:
        blk->store_temporary(iter.byte_at(1), 1);
        blk->pop();
        break;
      case Bytecodes::push_new_closure_tos_0:
        blk->allocate_closure(tos_as_scope, 0, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_tos_1:
        blk->allocate_closure(tos_as_scope, 1, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_tos_2:
        blk->allocate_closure(tos_as_scope, 2, methodOop(iter.oop_at(1)));
        break;
      case Bytecodes::push_new_closure_tos_n:
        blk->allocate_closure(tos_as_scope, iter.byte_at(1), methodOop(iter.oop_at(2)));
        break;
      case Bytecodes::only_pop:
        blk->pop();
        break;
      case Bytecodes::install_new_context_block_1:
        blk->allocate_context(1, false);
        break;
      case Bytecodes::install_new_context_block_2:
        blk->allocate_context(2, false);
        break;
      case Bytecodes::install_new_context_block_n:
        blk->allocate_context(iter.byte_at(1), false);
        break;
      case Bytecodes::push_temp_0_context_n:
        blk->push_temporary(0, iter.byte_at(1));
        break;
      case Bytecodes::push_temp_1_context_n:
        blk->push_temporary(1, iter.byte_at(1));
        break;
      case Bytecodes::push_temp_2_context_n:
        blk->push_temporary(2, iter.byte_at(1));
        break;
      case Bytecodes::push_temp_n_context_n:
        blk->push_temporary(iter.byte_at(1), map0to256(iter.byte_at(2)));
        break;
      case Bytecodes::store_temp_0_context_n_pop:
        blk->store_temporary(0, iter.byte_at(1));
        blk->pop();
        break;
      case Bytecodes::store_temp_1_context_n_pop:
        blk->store_temporary(1, iter.byte_at(1));
        blk->pop();
        break;
      case Bytecodes::store_temp_2_context_n_pop:
        blk->store_temporary(2, iter.byte_at(1));
        blk->pop();
        break;
      case Bytecodes::store_temp_n_context_n_pop:
        blk->store_temporary(iter.byte_at(1), map0to256(iter.byte_at(2)));
        blk->pop();
        break;
      case Bytecodes::set_self_via_context:
        blk->set_self_via_context();
        break;
      case Bytecodes::copy_1_into_context:
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(1), 0);
        break;
      case Bytecodes::copy_2_into_context:
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(1), 0); 
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(2), 1);
        break;
      case Bytecodes::copy_n_into_context: {
        int len = map0to256(iter.byte_at(1));
        for (int i = 0; i < len; i++)
          blk->copy_argument_into_context(lastArgNo - iter.byte_at(i + 2), i);
        break;
                                           }
      case Bytecodes::copy_self_into_context:
        blk->copy_self_into_context();
        break;
      case Bytecodes::copy_self_1_into_context:
        blk->copy_self_into_context(); 
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(1), 1);
        break;
      case Bytecodes::copy_self_2_into_context:
        blk->copy_self_into_context();
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(1), 1); 
        blk->copy_argument_into_context(lastArgNo - iter.byte_at(2), 2);
        break;
      case Bytecodes::copy_self_n_into_context: {
        blk->copy_self_into_context();
        int len = map0to256(iter.byte_at(1));
        for (int i = 0; i < len; i++)
          blk->copy_argument_into_context(lastArgNo - iter.byte_at(i + 2), i+1);
        break;
                                                }
      case Bytecodes::ifTrue_byte: {
        IfNode* node = MethodIterator::factory->new_IfNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), true, iter.byte_at(2), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->if_node(node);
        next_bci = node->end_bci();
        break;
                                   }
      case Bytecodes::ifFalse_byte: {
        IfNode* node = MethodIterator::factory->new_IfNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), false, iter.byte_at(2), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->if_node(node);
        next_bci = node->end_bci();
        break;
                                    }
      case Bytecodes::and_byte: {
        AndNode* node = MethodIterator::factory->new_AndNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->cond_node(node);
        next_bci = node->end_bci();
        break;
                                }
      case Bytecodes::or_byte: {
        OrNode* node = MethodIterator::factory->new_OrNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->cond_node(node);
        next_bci = node->end_bci();
        break;
                               }
      case Bytecodes::whileTrue_byte:
        // ignore since they are inside WhileNode expression body
        break;
      case Bytecodes::whileFalse_byte:
        // ignore since they are inside WhileNode expression body
        break;
      case Bytecodes::jump_else_byte:
        should_never_encounter(Bytecodes::jump_else_byte);
        break;
      case Bytecodes::jump_loop_byte: {
        WhileNode* node = MethodIterator::factory->new_WhileNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.byte_at(2), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->while_node(node);
        next_bci = node->end_bci();
        break;
                                      }
      case Bytecodes::ifTrue_word: {
        IfNode* node = MethodIterator::factory->new_IfNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), true, 
          iter.word_at(2), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->if_node(node);
        next_bci = node->end_bci();
        break;
                                   }
      case Bytecodes::ifFalse_word: {
        IfNode* node = MethodIterator::factory->new_IfNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), false, 
          iter.word_at(2), iter.byte_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->if_node(node);
        next_bci = node->end_bci();
        break;
                                    }
      case Bytecodes::and_word: {
        AndNode* node = MethodIterator::factory->new_AndNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.word_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->cond_node(node);
        next_bci = node->end_bci();
        break;
                                }
      case Bytecodes::or_word: {
        OrNode* node = MethodIterator::factory->new_OrNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.word_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->cond_node(node);
        next_bci = node->end_bci();
        break;
                               }
      case Bytecodes::whileTrue_word:
        // Ignore since they are inside WhileNode expression body
        break;
      case Bytecodes::whileFalse_word:
        // Ignore since they are inside WhileNode expression body
        break;
      case Bytecodes::jump_else_word:
        should_never_encounter(Bytecodes::jump_else_word);
        break;
      case Bytecodes::jump_loop_word: {
        WhileNode* node = MethodIterator::factory->new_WhileNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), 
          iter.word_at(1 + oopSize), iter.word_at(1));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->while_node(node);
        next_bci = node->end_bci();
        break;
                                      }
      case Bytecodes::interpreted_send_0:		// fall through
      case Bytecodes::interpreted_send_1:		// fall through
      case Bytecodes::interpreted_send_2:		// fall through
      case Bytecodes::interpreted_send_n:		// fall through
      case Bytecodes::compiled_send_0:			// fall through
      case Bytecodes::compiled_send_1:			// fall through
      case Bytecodes::compiled_send_2:			// fall through
      case Bytecodes::compiled_send_n:			// fall through
      case Bytecodes::primitive_send_0:			// fall through
      case Bytecodes::primitive_send_1:			// fall through
      case Bytecodes::primitive_send_2:			// fall through
      case Bytecodes::primitive_send_n:			// fall through
      case Bytecodes::polymorphic_send_0:		// fall through
      case Bytecodes::polymorphic_send_1:		// fall through
      case Bytecodes::polymorphic_send_2:		// fall through
      case Bytecodes::polymorphic_send_n:		// fall through
      case Bytecodes::megamorphic_send_0: 		// fall through
      case Bytecodes::megamorphic_send_1: 		// fall through
      case Bytecodes::megamorphic_send_2:		// fall through
      case Bytecodes::megamorphic_send_n:		// fall through
        blk->normal_send(iter.ic());
        break;
      case Bytecodes::interpreted_send_0_pop:		// fall through
      case Bytecodes::interpreted_send_1_pop:		// fall through
      case Bytecodes::interpreted_send_2_pop:		// fall through
      case Bytecodes::interpreted_send_n_pop:		// fall through
      case Bytecodes::compiled_send_0_pop: 		// fall through
      case Bytecodes::compiled_send_1_pop: 		// fall through
      case Bytecodes::compiled_send_2_pop:		// fall through
      case Bytecodes::compiled_send_n_pop:		// fall through
      case Bytecodes::primitive_send_0_pop:		// fall through
      case Bytecodes::primitive_send_1_pop:		// fall through
      case Bytecodes::primitive_send_2_pop:		// fall through
      case Bytecodes::primitive_send_n_pop:		// fall through
      case Bytecodes::polymorphic_send_0_pop:		// fall through
      case Bytecodes::polymorphic_send_1_pop:		// fall through
      case Bytecodes::polymorphic_send_2_pop:		// fall through
      case Bytecodes::polymorphic_send_n_pop:		// fall through
      case Bytecodes::megamorphic_send_0_pop: 		// fall through
      case Bytecodes::megamorphic_send_1_pop: 		// fall through
      case Bytecodes::megamorphic_send_2_pop:		// fall through
      case Bytecodes::megamorphic_send_n_pop:		// fall through
        blk->normal_send(iter.ic());
        blk->pop();
        break;
      case Bytecodes::interpreted_send_self:		// fall through
      case Bytecodes::compiled_send_self:		// fall through
      case Bytecodes::primitive_send_self:		// fall through
      case Bytecodes::polymorphic_send_self:		// fall through
      case Bytecodes::megamorphic_send_self:		// fall through
        blk->self_send(iter.ic());
        break;
      case Bytecodes::interpreted_send_self_pop:	// fall through
      case Bytecodes::compiled_send_self_pop:		// fall through
      case Bytecodes::primitive_send_self_pop:		// fall through
      case Bytecodes::polymorphic_send_self_pop:	// fall through
      case Bytecodes::megamorphic_send_self_pop:	// fall through
        blk->self_send(iter.ic());
        blk->pop();
        break;
      case Bytecodes::interpreted_send_super:		// fall through
      case Bytecodes::compiled_send_super:		// fall through
      case Bytecodes::primitive_send_super:		// fall through
      case Bytecodes::polymorphic_send_super:		// fall through
      case Bytecodes::megamorphic_send_super:		// fall through
        blk->super_send(iter.ic());
        break;
      case Bytecodes::interpreted_send_super_pop:	// fall through
      case Bytecodes::compiled_send_super_pop:		// fall through
      case Bytecodes::primitive_send_super_pop:		// fall through
      case Bytecodes::polymorphic_send_super_pop:	// fall through
      case Bytecodes::megamorphic_send_super_pop:	// fall through
        blk->super_send(iter.ic());
        blk->pop();
        break;
      case Bytecodes::return_tos_pop_0:
        blk->method_return(0);
        break;
      case Bytecodes::return_tos_pop_1:
        blk->method_return(1);
        break;
      case Bytecodes::return_tos_pop_2:
        blk->method_return(2);
        break;
      case Bytecodes::return_tos_pop_n:
        blk->method_return(iter.byte_at(1));
        break;
      case Bytecodes::return_self_pop_0:
        blk->push_self();
        blk->method_return(0);
        break;
      case Bytecodes::return_self_pop_1:
        blk->push_self();
        blk->method_return(1);
        break;
      case Bytecodes::return_self_pop_2:
        blk->push_self();
        blk->method_return(2);
        break;
      case Bytecodes::return_self_pop_n:
        blk->push_self();
        blk->method_return(iter.byte_at(1));
        break;
      case Bytecodes::return_tos_zap_pop_n:
        blk->zap_scope();
        blk->method_return(iter.byte_at(1));
        break;
      case Bytecodes::return_self_zap_pop_n:
        blk->zap_scope();
        blk->push_self();
        blk->method_return(iter.byte_at(1));
        break;
      case Bytecodes::non_local_return_tos_pop_n:
        blk->nonlocal_return(iter.byte_at(1));
        break;
      case Bytecodes::non_local_return_self_pop_n:
        blk->push_self();
        blk->nonlocal_return(iter.byte_at(1));
        break;
      case Bytecodes::prim_call: // fall through
      case Bytecodes::prim_call_self: {
        primitive_desc* pdesc = primitives::lookup((fntype) iter.word_at(1));
        PrimitiveCallNode* node = 
          MethodIterator::factory->new_PrimitiveCallNode(_interval->method(),
          _interval,
          iter.bci(),
          iter.next_bci(),
          pdesc->has_receiver(),
          NULL,
          pdesc);
        // %hack: this assertion fails
        // assert(pdesc->has_receiver() == (iter.code() == Bytecodes::prim_call_self), "just checking");
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->primitive_call_node(node);
        next_bci = node->end_bci();
        break;
                                      }
      case Bytecodes::predict_prim_call:
        blk->predict_prim_call(primitives::lookup((fntype) iter.word_at(1)), -1);
        break;
      case Bytecodes::prim_call_failure: // fall through
      case Bytecodes::prim_call_self_failure: {
        primitive_desc* pdesc = primitives::lookup((fntype) iter.word_at(1));
        PrimitiveCallNode* node = MethodIterator::factory->new_PrimitiveCallNode(
          _interval->method(),
          _interval,
          iter.bci(), 
          iter.next_bci(),
          pdesc->has_receiver(),
          NULL,
          pdesc,
          iter.word_at(1 + oopSize));
        assert(pdesc->has_receiver() == (iter.code() == Bytecodes::prim_call_self_failure), "just checking");
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->primitive_call_node(node);
        next_bci = node->end_bci();
        break;
                                              }
      case Bytecodes::predict_prim_call_failure:
        blk->predict_prim_call(
          primitives::lookup((fntype) iter.word_at(1)),
          iter.next_bci() + iter.word_at(1 + oopSize));
        break;
      case Bytecodes::dll_call_sync: {
        DLLCallNode* node = MethodIterator::factory->new_DLLCallNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.dll_cache());
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->dll_call_node(node);
        next_bci = node->end_bci();
        break;
                                     }
      case Bytecodes::access_send_self:
        blk->self_send(iter.ic());
        break;
      case Bytecodes::unimplemented_bc:
        unknown_code(Bytecodes::unimplemented_bc);
        break;
      case Bytecodes::prim_call_lookup: // fall through
      case Bytecodes::prim_call_self_lookup: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "name must be symbolOop");
        PrimitiveCallNode* node = 
          MethodIterator::factory->new_PrimitiveCallNode(_interval->method(),
          _interval, 
          iter.bci(),
          iter.next_bci(),
          iter.code() == Bytecodes::prim_call_self_lookup,
          name,
          NULL);
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->primitive_call_node(node);
        next_bci = node->end_bci();
        break;
                                             }
      case Bytecodes::predict_prim_call_lookup:
        blk->predict_prim_call(primitives::lookup(symbolOop(iter.word_at(1))), -1);
        break;
      case Bytecodes::prim_call_failure_lookup: // fall through
      case Bytecodes::prim_call_self_failure_lookup: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "name must be symbolOop");
        PrimitiveCallNode* node = MethodIterator::factory->new_PrimitiveCallNode(
          _interval->method(),
          _interval, 
          iter.bci(), 
          iter.next_bci(),
          iter.code() == Bytecodes::prim_call_self_failure_lookup, 
          name,
          NULL,
          iter.word_at(1 + oopSize));
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->primitive_call_node(node);
        next_bci = node->end_bci();
        break;
                                                     }
      case Bytecodes::predict_prim_call_failure_lookup:
        blk->predict_prim_call(
          primitives::lookup(symbolOop(iter.word_at(1))),
          iter.bci() + iter.word_at(1 + oopSize));
        break;
      case Bytecodes::dll_call_async: {
        DLLCallNode* node = MethodIterator::factory->new_DLLCallNode(
          _interval->method(), _interval, iter.bci(), iter.next_bci(), iter.dll_cache());
        assert(node->end_bci() <= _interval->end_bci(), "just checking");
        blk->dll_call_node(node);
        next_bci = node->end_bci();
        break;
                                      }
      case Bytecodes::unimplemented_c7:
        unknown_code(Bytecodes::unimplemented_c7);
        break;
      case Bytecodes::access_send_0:
        blk->normal_send(iter.ic());
        break;
      case Bytecodes::unimplemented_cc:
        unknown_code(Bytecodes::unimplemented_cc);
        break;
      case Bytecodes::unimplemented_dc:
        unknown_code(Bytecodes::unimplemented_dc);
        break;
      case Bytecodes::special_primitive_send_1_hint:
        // ignore - only meaningfull for the interpreter
        break;
      case Bytecodes::unimplemented_de:
        unknown_code(Bytecodes::unimplemented_de);
        break;
      case Bytecodes::unimplemented_df:
        unknown_code(Bytecodes::unimplemented_df);
        break;
      case Bytecodes::smi_add		: // fall through
      case Bytecodes::smi_sub		: // fall through
      case Bytecodes::smi_mult		: // fall through
      case Bytecodes::smi_div		: // fall through
      case Bytecodes::smi_mod		: // fall through
      case Bytecodes::smi_create_point	: // fall through
      case Bytecodes::smi_equal		: // fall through
      case Bytecodes::smi_not_equal	: // fall through
      case Bytecodes::smi_less		: // fall through
      case Bytecodes::smi_less_equal	: // fall through
      case Bytecodes::smi_greater	: // fall through
      case Bytecodes::smi_greater_equal	: // fall through
      case Bytecodes::objArray_at	: // fall through
      case Bytecodes::objArray_at_put	: // fall through
      case Bytecodes::smi_and		: // fall through
      case Bytecodes::smi_or		: // fall through
      case Bytecodes::smi_xor		: // fall through
      case Bytecodes::smi_shift		:
        blk->normal_send(iter.ic());
        break;
      case Bytecodes::double_equal:
        blk->double_equal();
        break;
      case Bytecodes::double_tilde:
        blk->double_not_equal();
        break;
      case Bytecodes::push_global:
        assert(iter.oop_at(1)->is_association(), "must be an association");
        blk->push_global(associationOop(iter.oop_at(1))); 
        break;
      case Bytecodes::store_global_pop:
        assert(iter.oop_at(1)->is_association(), "must be an association");
        blk->store_global(associationOop(iter.oop_at(1)));
        blk->pop(); 
        break;
      case Bytecodes::store_global:
        assert(iter.oop_at(1)->is_association(), "must be an association");
        blk->store_global(associationOop(iter.oop_at(1)));  
        break;
      case Bytecodes::push_classVar_name: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->push_classVar_name(name);
                                          }
                                          break;
      case Bytecodes::store_classVar_pop_name: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->store_classVar_name(name);
        blk->pop();
                                               }
                                               break;
      case Bytecodes::store_classVar_name: {
        symbolOop name = symbolOop(iter.oop_at(1));
        assert(name->is_symbol(), "must be symbol");
        blk->store_classVar_name(name);
                                           }
                                           break;
      case Bytecodes::unimplemented_fa:
        unknown_code(Bytecodes::unimplemented_fa);
        break;
      case Bytecodes::unimplemented_fb:
        unknown_code(Bytecodes::unimplemented_fb);
        break;
      case Bytecodes::unimplemented_fc:
        unknown_code(Bytecodes::unimplemented_fc);
        break;
      case Bytecodes::unimplemented_fd:
        unknown_code(Bytecodes::unimplemented_fd);
        break;
      case Bytecodes::unimplemented_fe:
        unknown_code(Bytecodes::unimplemented_fe);
        break;
      case Bytecodes::halt:
        unknown_code(Bytecodes::halt);
        break;
      default:
        ShouldNotReachHere();
    }
  }
  blk->set_prim_failure(oldFailState);
}
inline associationOop as_associationOop(void* p) {
    return associationOop(as_memOop(p));
}
Example #7
0
 friend associationOop as_associationOop(void* p) {
   return associationOop(as_memOop(p)); }