< prev index next >

src/hotspot/share/cds/lambdaProxyClassDictionary.hpp

Print this page
*** 120,11 ***
    void add_proxy_klass(InstanceKlass* proxy_klass) {
      if (_proxy_klasses == nullptr) {
        _proxy_klasses = new (mtClassShared) GrowableArray<InstanceKlass*>(5, mtClassShared);
      }
      assert(_proxy_klasses != nullptr, "sanity");
!     _proxy_klasses->append(proxy_klass);
    }
  
    void metaspace_pointers_do(MetaspaceClosure* it) {
      for (int i=0; i<_proxy_klasses->length(); i++) {
        it->push(_proxy_klasses->adr_at(i));
--- 120,12 ---
    void add_proxy_klass(InstanceKlass* proxy_klass) {
      if (_proxy_klasses == nullptr) {
        _proxy_klasses = new (mtClassShared) GrowableArray<InstanceKlass*>(5, mtClassShared);
      }
      assert(_proxy_klasses != nullptr, "sanity");
!     // Try to preserve the order. get_shared_lambda_proxy_class returns shared classes in reverse order.
+     _proxy_klasses->insert_before(0, proxy_klass);
    }
  
    void metaspace_pointers_do(MetaspaceClosure* it) {
      for (int i=0; i<_proxy_klasses->length(); i++) {
        it->push(_proxy_klasses->adr_at(i));
< prev index next >