src/share/vm/ci/ciObject.cpp

changeset 4037
da91efe96a93
parent 3105
c26de9aef2ed
child 6680
78bbf4d43a14
     1.1 --- a/src/share/vm/ci/ciObject.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/ci/ciObject.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -43,7 +43,7 @@
    1.11  //
    1.12  // Within the VM, the oop and klass hierarchies are separate.
    1.13  // The compiler interface does not preserve this separation --
    1.14 -// the distinction between `klassOop' and `Klass' are not
    1.15 +// the distinction between `Klass*' and `Klass' are not
    1.16  // reflected in the interface and instead the Klass hierarchy
    1.17  // is directly modeled as the subclasses of ciKlass.
    1.18  
    1.19 @@ -57,7 +57,6 @@
    1.20      _handle = JNIHandles::make_global(o);
    1.21    }
    1.22    _klass = NULL;
    1.23 -  _ident = 0;
    1.24    init_flags_from(o);
    1.25  }
    1.26  
    1.27 @@ -72,7 +71,6 @@
    1.28      _handle = JNIHandles::make_global(h);
    1.29    }
    1.30    _klass = NULL;
    1.31 -  _ident = 0;
    1.32    init_flags_from(h());
    1.33  }
    1.34  
    1.35 @@ -86,7 +84,6 @@
    1.36    assert(klass != NULL, "must supply klass");
    1.37    _handle = NULL;
    1.38    _klass = klass;
    1.39 -  _ident = 0;
    1.40  }
    1.41  
    1.42  // ------------------------------------------------------------------
    1.43 @@ -97,7 +94,6 @@
    1.44    ASSERT_IN_VM;
    1.45    _handle = NULL;
    1.46    _klass = NULL;
    1.47 -  _ident = 0;
    1.48  }
    1.49  
    1.50  // ------------------------------------------------------------------
    1.51 @@ -117,33 +113,13 @@
    1.52  
    1.53      GUARDED_VM_ENTRY(
    1.54        oop o = get_oop();
    1.55 -      _klass = CURRENT_ENV->get_object(o->klass())->as_klass();
    1.56 +      _klass = CURRENT_ENV->get_klass(o->klass());
    1.57      );
    1.58    }
    1.59    return _klass;
    1.60  }
    1.61  
    1.62  // ------------------------------------------------------------------
    1.63 -// ciObject::set_ident
    1.64 -//
    1.65 -// Set the unique identity number of a ciObject.
    1.66 -void ciObject::set_ident(uint id) {
    1.67 -  assert((_ident >> FLAG_BITS) == 0, "must only initialize once");
    1.68 -  assert( id < ((uint)1 << (BitsPerInt-FLAG_BITS)), "id too big");
    1.69 -  _ident = _ident + (id << FLAG_BITS);
    1.70 -}
    1.71 -
    1.72 -// ------------------------------------------------------------------
    1.73 -// ciObject::ident
    1.74 -//
    1.75 -// Report the unique identity number of a ciObject.
    1.76 -uint ciObject::ident() {
    1.77 -  uint id = _ident >> FLAG_BITS;
    1.78 -  assert(id != 0, "must be initialized");
    1.79 -  return id;
    1.80 -}
    1.81 -
    1.82 -// ------------------------------------------------------------------
    1.83  // ciObject::equals
    1.84  //
    1.85  // Are two ciObjects equal?
    1.86 @@ -187,7 +163,7 @@
    1.87  // ciObject::can_be_constant
    1.88  bool ciObject::can_be_constant() {
    1.89    if (ScavengeRootsInCode >= 1)  return true;  // now everybody can encode as a constant
    1.90 -  return handle() == NULL || is_perm();
    1.91 +  return handle() == NULL;
    1.92  }
    1.93  
    1.94  // ------------------------------------------------------------------
    1.95 @@ -197,7 +173,7 @@
    1.96    if (is_null_object()) return true;
    1.97  
    1.98    ciEnv* env = CURRENT_ENV;
    1.99 -  if (!JavaObjectsInPerm) {
   1.100 +
   1.101      // We want Strings and Classes to be embeddable by default since
   1.102      // they used to be in the perm world.  Not all Strings used to be
   1.103      // embeddable but there's no easy way to distinguish the interned
   1.104 @@ -205,7 +181,6 @@
   1.105      if (klass() == env->String_klass() || klass() == env->Class_klass()) {
   1.106        return true;
   1.107      }
   1.108 -  }
   1.109    if (EnableInvokeDynamic &&
   1.110        (klass()->is_subclass_of(env->MethodHandle_klass()) ||
   1.111         klass()->is_subclass_of(env->CallSite_klass()))) {
   1.112 @@ -214,9 +189,20 @@
   1.113      return true;
   1.114    }
   1.115  
   1.116 -  return handle() == NULL || is_perm();
   1.117 +  return handle() == NULL;
   1.118  }
   1.119  
   1.120 +// ------------------------------------------------------------------
   1.121 +// ciObject::should_be_constant()
   1.122 +void ciObject::init_flags_from(oop x) {
   1.123 +  int flags = 0;
   1.124 +  if (x != NULL) {
   1.125 +    assert(Universe::heap()->is_in_reserved(x), "must be");
   1.126 +    if (x->is_scavengable())
   1.127 +      flags |= SCAVENGABLE_FLAG;
   1.128 +  }
   1.129 +  _ident |= flags;
   1.130 +}
   1.131  
   1.132  // ------------------------------------------------------------------
   1.133  // ciObject::print
   1.134 @@ -228,8 +214,7 @@
   1.135  void ciObject::print(outputStream* st) {
   1.136    st->print("<%s", type_string());
   1.137    GUARDED_VM_ENTRY(print_impl(st);)
   1.138 -  st->print(" ident=%d %s%s address=0x%x>", ident(),
   1.139 -        is_perm() ? "PERM" : "",
   1.140 +  st->print(" ident=%d %s address=0x%x>", ident(),
   1.141          is_scavengable() ? "SCAVENGABLE" : "",
   1.142          (address)this);
   1.143  }

mercurial