src/share/vm/classfile/verificationType.cpp

changeset 2497
3582bf76420e
parent 2314
f95d63e2154a
child 2708
1d1603768966
     1.1 --- a/src/share/vm/classfile/verificationType.cpp	Thu Jan 27 13:42:28 2011 -0800
     1.2 +++ b/src/share/vm/classfile/verificationType.cpp	Thu Jan 27 16:11:27 2011 -0800
     1.3 @@ -25,6 +25,7 @@
     1.4  #include "precompiled.hpp"
     1.5  #include "classfile/symbolTable.hpp"
     1.6  #include "classfile/verificationType.hpp"
     1.7 +#include "classfile/verifier.hpp"
     1.8  
     1.9  VerificationType VerificationType::from_tag(u1 tag) {
    1.10    switch (tag) {
    1.11 @@ -41,7 +42,8 @@
    1.12  }
    1.13  
    1.14  bool VerificationType::is_reference_assignable_from(
    1.15 -    const VerificationType& from, instanceKlassHandle context, TRAPS) const {
    1.16 +    const VerificationType& from, ClassVerifier* context, TRAPS) const {
    1.17 +  instanceKlassHandle klass = context->current_class();
    1.18    if (from.is_null()) {
    1.19      // null is assignable to any reference
    1.20      return true;
    1.21 @@ -56,8 +58,8 @@
    1.22        return true;
    1.23      }
    1.24      klassOop obj = SystemDictionary::resolve_or_fail(
    1.25 -        name_handle(), Handle(THREAD, context->class_loader()),
    1.26 -        Handle(THREAD, context->protection_domain()), true, CHECK_false);
    1.27 +        name(), Handle(THREAD, klass->class_loader()),
    1.28 +        Handle(THREAD, klass->protection_domain()), true, CHECK_false);
    1.29      KlassHandle this_class(THREAD, obj);
    1.30  
    1.31      if (this_class->is_interface()) {
    1.32 @@ -66,13 +68,13 @@
    1.33        return true;
    1.34      } else if (from.is_object()) {
    1.35        klassOop from_class = SystemDictionary::resolve_or_fail(
    1.36 -          from.name_handle(), Handle(THREAD, context->class_loader()),
    1.37 -          Handle(THREAD, context->protection_domain()), true, CHECK_false);
    1.38 +          from.name(), Handle(THREAD, klass->class_loader()),
    1.39 +          Handle(THREAD, klass->protection_domain()), true, CHECK_false);
    1.40        return instanceKlass::cast(from_class)->is_subclass_of(this_class());
    1.41      }
    1.42    } else if (is_array() && from.is_array()) {
    1.43 -    VerificationType comp_this = get_component(CHECK_false);
    1.44 -    VerificationType comp_from = from.get_component(CHECK_false);
    1.45 +    VerificationType comp_this = get_component(context, CHECK_false);
    1.46 +    VerificationType comp_from = from.get_component(context, CHECK_false);
    1.47      if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
    1.48        return comp_this.is_assignable_from(comp_from, context, CHECK_false);
    1.49      }
    1.50 @@ -80,9 +82,9 @@
    1.51    return false;
    1.52  }
    1.53  
    1.54 -VerificationType VerificationType::get_component(TRAPS) const {
    1.55 +VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS) const {
    1.56    assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
    1.57 -  symbolOop component;
    1.58 +  Symbol* component;
    1.59    switch (name()->byte_at(1)) {
    1.60      case 'Z': return VerificationType(Boolean);
    1.61      case 'B': return VerificationType(Byte);
    1.62 @@ -93,12 +95,12 @@
    1.63      case 'F': return VerificationType(Float);
    1.64      case 'D': return VerificationType(Double);
    1.65      case '[':
    1.66 -      component = SymbolTable::lookup(
    1.67 +      component = context->create_temporary_symbol(
    1.68          name(), 1, name()->utf8_length(),
    1.69          CHECK_(VerificationType::bogus_type()));
    1.70        return VerificationType::reference_type(component);
    1.71      case 'L':
    1.72 -      component = SymbolTable::lookup(
    1.73 +      component = context->create_temporary_symbol(
    1.74          name(), 2, name()->utf8_length() - 1,
    1.75          CHECK_(VerificationType::bogus_type()));
    1.76        return VerificationType::reference_type(component);

mercurial