hotspot/src/share/vm/ci/ciObjectFactory.hpp
author roland
Thu, 10 Apr 2014 11:38:12 +0200
changeset 24002 4e6a72032a99
parent 22234 da823d78ad65
child 25490 59f226da8d81
permissions -rw-r--r--
8005079: fix LogCompilation for incremental inlining Summary: report late inlining as part of the rest of the inlining output Reviewed-by: twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 19710
diff changeset
     2
 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    25
#ifndef SHARE_VM_CI_CIOBJECTFACTORY_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    26
#define SHARE_VM_CI_CIOBJECTFACTORY_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    28
#include "ci/ciClassList.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    29
#include "ci/ciObject.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    30
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// ciObjectFactory
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// This class handles requests for the creation of new instances
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// of ciObject and its subclasses.  It contains a caching mechanism
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// which ensures that for each oop, at most one ciObject is created.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// This invariant allows efficient implementation of ciObject.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class ciObjectFactory : public ResourceObj {
10547
ea4a2ec31ae2 7088955: add C2 IR support to the SA
never
parents: 8921
diff changeset
    39
  friend class VMStructs;
ea4a2ec31ae2 7088955: add C2 IR support to the SA
never
parents: 8921
diff changeset
    40
  friend class ciEnv;
ea4a2ec31ae2 7088955: add C2 IR support to the SA
never
parents: 8921
diff changeset
    41
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  static volatile bool _initialized;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    44
  static GrowableArray<ciMetadata*>* _shared_ci_metadata;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  static ciSymbol*                 _shared_ci_symbols[];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static int                       _shared_ident_limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  Arena*                    _arena;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    49
  GrowableArray<ciMetadata*>*        _ci_metadata;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  GrowableArray<ciMethod*>* _unloaded_methods;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  GrowableArray<ciKlass*>* _unloaded_klasses;
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
    52
  GrowableArray<ciInstance*>* _unloaded_instances;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  GrowableArray<ciReturnAddress*>* _return_addresses;
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    54
  GrowableArray<ciSymbol*>* _symbols;  // keep list of symbols created
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  int                       _next_ident;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  struct NonPermObject : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    ciObject*      _object;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    NonPermObject* _next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    ciObject*     object()  { return _object; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    NonPermObject* &next()  { return _next; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  enum { NON_PERM_BUCKETS = 61 };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  int _non_perm_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    71
  int find(Metadata* key, GrowableArray<ciMetadata*>* objects);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    72
  bool is_found_at(int index, Metadata* key, GrowableArray<ciMetadata*>* objects);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    73
  void insert(int index, ciMetadata* obj, GrowableArray<ciMetadata*>* objects);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    74
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ciObject* create_new_object(oop o);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    76
  ciMetadata* create_new_object(Metadata* o);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    77
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  static bool is_equal(NonPermObject* p, oop key) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    return p->object()->get_oop() == key;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  NonPermObject* &find_non_perm(oop key);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
    85
  void init_ident_of(ciBaseObject* obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  Arena* arena() { return _arena; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  void print_contents_impl();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
    91
  ciInstance* get_unloaded_instance(ciInstanceKlass* klass);
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
    92
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  static bool is_initialized() { return _initialized; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  static void initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  void init_shared_objects();
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    98
  void remove_symbols();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  ciObjectFactory(Arena* arena, int expected_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  // Get the ciObject corresponding to some oop.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  ciObject* get(oop key);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
   104
  ciMetadata* get_metadata(Metadata* key);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   105
  ciSymbol* get_symbol(Symbol* key);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   106
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // Get the ciSymbol corresponding to one of the vmSymbols.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  static ciSymbol* vm_symbol_at(int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  // Get the ciMethod representing an unloaded/unfound method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  ciMethod* get_unloaded_method(ciInstanceKlass* holder,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                                ciSymbol*        name,
10734
065435337883 7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents: 10547
diff changeset
   113
                                ciSymbol*        signature,
065435337883 7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents: 10547
diff changeset
   114
                                ciInstanceKlass* accessor);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  // Get a ciKlass representing an unloaded klass.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  ciKlass* get_unloaded_klass(ciKlass* accessing_klass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
                              ciSymbol* name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
                              bool create_if_not_found);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
5882
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   121
  // Get a ciInstance representing an unresolved klass mirror.
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   122
  ciInstance* get_unloaded_klass_mirror(ciKlass* type);
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   123
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   124
  // Get a ciInstance representing an unresolved method handle constant.
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   125
  ciInstance* get_unloaded_method_handle_constant(ciKlass*  holder,
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   126
                                                  ciSymbol* name,
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   127
                                                  ciSymbol* signature,
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   128
                                                  int       ref_kind);
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   129
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   130
  // Get a ciInstance representing an unresolved method type constant.
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   131
  ciInstance* get_unloaded_method_type_constant(ciSymbol* signature);
6b2aecc4f7d8 6939203: JSR 292 needs method handle constants
jrose
parents: 5547
diff changeset
   132
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 14477
diff changeset
   134
  ciInstance* get_unloaded_object_constant();
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 14477
diff changeset
   135
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // Get the ciMethodData representing the methodData for a method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  // with none.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  ciMethodData* get_empty_methodData();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  ciReturnAddress* get_return_address(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
14477
95e66ea71f71 6830717: replay of compilations would help with debugging
minqi
parents: 13728
diff changeset
   142
  GrowableArray<ciMetadata*>* get_ci_metadata() const { return _ci_metadata; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
   143
  // RedefineClasses support
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
   144
  void metadata_do(void f(Metadata*));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10734
diff changeset
   145
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  void print_contents();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  void print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
   149
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5882
diff changeset
   150
#endif // SHARE_VM_CI_CIOBJECTFACTORY_HPP