src/share/vm/ci/ciObjectFactory.hpp

Mon, 26 Apr 2010 23:59:45 -0700

author
never
date
Mon, 26 Apr 2010 23:59:45 -0700
changeset 1832
b4776199210f
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6943485: JVMTI always on capabilities change code generation too much
Reviewed-by: twisti, dcubed

     1 /*
     2  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // ciObjectFactory
    26 //
    27 // This class handles requests for the creation of new instances
    28 // of ciObject and its subclasses.  It contains a caching mechanism
    29 // which ensures that for each oop, at most one ciObject is created.
    30 // This invariant allows efficient implementation of ciObject.
    31 class ciObjectFactory : public ResourceObj {
    32 private:
    33   static volatile bool _initialized;
    34   static GrowableArray<ciObject*>* _shared_ci_objects;
    35   static ciSymbol*                 _shared_ci_symbols[];
    36   static int                       _shared_ident_limit;
    38   Arena*                    _arena;
    39   GrowableArray<ciObject*>* _ci_objects;
    40   GrowableArray<ciMethod*>* _unloaded_methods;
    41   GrowableArray<ciKlass*>* _unloaded_klasses;
    42   GrowableArray<ciReturnAddress*>* _return_addresses;
    43   int                       _next_ident;
    45 public:
    46   struct NonPermObject : public ResourceObj {
    47     ciObject*      _object;
    48     NonPermObject* _next;
    50     inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object);
    51     ciObject*     object()  { return _object; }
    52     NonPermObject* &next()  { return _next; }
    53   };
    54 private:
    55   enum { NON_PERM_BUCKETS = 61 };
    56   NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS];
    57   int _non_perm_count;
    59   int find(oop key, GrowableArray<ciObject*>* objects);
    60   bool is_found_at(int index, oop key, GrowableArray<ciObject*>* objects);
    61   void insert(int index, ciObject* obj, GrowableArray<ciObject*>* objects);
    62   ciObject* create_new_object(oop o);
    63   static bool is_equal(NonPermObject* p, oop key) {
    64     return p->object()->get_oop() == key;
    65   }
    67   NonPermObject* &find_non_perm(oop key);
    68   void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj);
    70   void init_ident_of(ciObject* obj);
    72   Arena* arena() { return _arena; }
    74   void print_contents_impl();
    76 public:
    77   static bool is_initialized() { return _initialized; }
    79   static void initialize();
    80   void init_shared_objects();
    82   ciObjectFactory(Arena* arena, int expected_size);
    85   // Get the ciObject corresponding to some oop.
    86   ciObject* get(oop key);
    88   // Get the ciSymbol corresponding to one of the vmSymbols.
    89   static ciSymbol* vm_symbol_at(int index);
    91   // Get the ciMethod representing an unloaded/unfound method.
    92   ciMethod* get_unloaded_method(ciInstanceKlass* holder,
    93                                 ciSymbol*        name,
    94                                 ciSymbol*        signature);
    96   // Get a ciKlass representing an unloaded klass.
    97   ciKlass* get_unloaded_klass(ciKlass* accessing_klass,
    98                               ciSymbol* name,
    99                               bool create_if_not_found);
   102   // Get the ciMethodData representing the methodData for a method
   103   // with none.
   104   ciMethodData* get_empty_methodData();
   106   ciReturnAddress* get_return_address(int bci);
   108   void print_contents();
   109   void print();
   110 };

mercurial