< prev index next >

src/hotspot/share/classfile/stackMapFrame.cpp

Print this page




  63     }
  64   }
  65   for (i = 0; i < _stack_size; i++) {
  66     if (_stack[i].equals(old_object)) {
  67       _stack[i] = new_object;
  68     }
  69   }
  70   if (old_object == VerificationType::uninitialized_this_type()) {
  71     // "this" has been initialized - reset flags
  72     _flags = 0;
  73   }
  74 }
  75 
  76 VerificationType StackMapFrame::set_locals_from_arg(
  77     const methodHandle& m, VerificationType thisKlass, TRAPS) {
  78   SignatureStream ss(m->signature());
  79   int init_local_num = 0;
  80   if (!m->is_static()) {
  81     init_local_num++;
  82     // add one extra argument for instance method
  83     if (m->name() == vmSymbols::object_initializer_name() &&
  84        thisKlass.name() != vmSymbols::java_lang_Object()) {
  85       _locals[0] = VerificationType::uninitialized_this_type();
  86       _flags |= FLAG_THIS_UNINIT;
  87     } else {
  88       _locals[0] = thisKlass;
  89     }
  90   }
  91 
  92   // local num may be greater than size of parameters because long/double occupies two slots
  93   while(!ss.at_return_type()) {
  94     init_local_num += _verifier->change_sig_to_verificationType(
  95       &ss, &_locals[init_local_num]);
  96     ss.next();
  97   }
  98   _locals_size = init_local_num;
  99 
 100   switch (ss.type()) {
 101     case T_OBJECT:
 102     case T_ARRAY:

 103     {
 104       Symbol* sig = ss.as_symbol();
 105       if (!sig->is_permanent()) {
 106         // Create another symbol to save as signature stream unreferences
 107         // this symbol.
 108         Symbol *sig_copy =
 109           verifier()->create_temporary_symbol(sig, 0, sig->utf8_length());
 110         assert(sig_copy == sig, "symbols don't match");
 111         sig = sig_copy;



 112       }
 113       return VerificationType::reference_type(sig);
 114     }
 115     case T_INT:     return VerificationType::integer_type();
 116     case T_BYTE:    return VerificationType::byte_type();
 117     case T_CHAR:    return VerificationType::char_type();
 118     case T_SHORT:   return VerificationType::short_type();
 119     case T_BOOLEAN: return VerificationType::boolean_type();
 120     case T_FLOAT:   return VerificationType::float_type();
 121     case T_DOUBLE:  return VerificationType::double_type();
 122     case T_LONG:    return VerificationType::long_type();
 123     case T_VOID:    return VerificationType::bogus_type();
 124     default:
 125       ShouldNotReachHere();
 126   }
 127   return VerificationType::bogus_type();
 128 }
 129 
 130 void StackMapFrame::copy_locals(const StackMapFrame* src) {
 131   int32_t len = src->locals_size() < _locals_size ?




  63     }
  64   }
  65   for (i = 0; i < _stack_size; i++) {
  66     if (_stack[i].equals(old_object)) {
  67       _stack[i] = new_object;
  68     }
  69   }
  70   if (old_object == VerificationType::uninitialized_this_type()) {
  71     // "this" has been initialized - reset flags
  72     _flags = 0;
  73   }
  74 }
  75 
  76 VerificationType StackMapFrame::set_locals_from_arg(
  77     const methodHandle& m, VerificationType thisKlass, TRAPS) {
  78   SignatureStream ss(m->signature());
  79   int init_local_num = 0;
  80   if (!m->is_static()) {
  81     init_local_num++;
  82     // add one extra argument for instance method
  83     if (m->is_object_constructor() &&
  84        thisKlass.name() != vmSymbols::java_lang_Object()) {
  85       _locals[0] = VerificationType::uninitialized_this_type();
  86       _flags |= FLAG_THIS_UNINIT;
  87     } else {
  88       _locals[0] = thisKlass;
  89     }
  90   }
  91 
  92   // local num may be greater than size of parameters because long/double occupies two slots
  93   while(!ss.at_return_type()) {
  94     init_local_num += _verifier->change_sig_to_verificationType(
  95       &ss, &_locals[init_local_num]);
  96     ss.next();
  97   }
  98   _locals_size = init_local_num;
  99 
 100   switch (ss.type()) {
 101     case T_OBJECT:
 102     case T_ARRAY:
 103     case T_VALUETYPE:
 104     {
 105       Symbol* sig = ss.as_symbol();
 106       if (!sig->is_permanent()) {
 107         // Create another symbol to save as signature stream unreferences
 108         // this symbol.
 109         Symbol *sig_copy =
 110           verifier()->create_temporary_symbol(sig, 0, sig->utf8_length());
 111         assert(sig_copy == sig, "symbols don't match");
 112         sig = sig_copy;
 113       }
 114       if (ss.type() == T_VALUETYPE) {
 115         return VerificationType::valuetype_type(sig);
 116       }
 117       return VerificationType::reference_type(sig);
 118     }
 119     case T_INT:     return VerificationType::integer_type();
 120     case T_BYTE:    return VerificationType::byte_type();
 121     case T_CHAR:    return VerificationType::char_type();
 122     case T_SHORT:   return VerificationType::short_type();
 123     case T_BOOLEAN: return VerificationType::boolean_type();
 124     case T_FLOAT:   return VerificationType::float_type();
 125     case T_DOUBLE:  return VerificationType::double_type();
 126     case T_LONG:    return VerificationType::long_type();
 127     case T_VOID:    return VerificationType::bogus_type();
 128     default:
 129       ShouldNotReachHere();
 130   }
 131   return VerificationType::bogus_type();
 132 }
 133 
 134 void StackMapFrame::copy_locals(const StackMapFrame* src) {
 135   int32_t len = src->locals_size() < _locals_size ?


< prev index next >