hotspot/src/share/vm/oops/typeArrayKlass.hpp
author iveresov
Fri, 04 Mar 2011 15:14:16 -0800
changeset 8667 b32929355d27
parent 7397 5b173b4ca846
child 10566 630c177ec580
permissions -rw-r--r--
7020403: Add AdvancedCompilationPolicy for tiered Summary: This implements adaptive tiered compilation policy. Reviewed-by: kvn, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 1997, 2010, 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: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
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: 2105
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: 5547
diff changeset
    25
#ifndef SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/arrayKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// A typeArrayKlass is the klass of a typeArray
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// It contains the type and size of the elements
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class typeArrayKlass : public arrayKlass {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  jint _max_length;            // maximum number of elements allowed in an array
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  // instance variables
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  jint max_length()                     { return _max_length; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  void set_max_length(jint m)           { _max_length = m;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // testers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  bool oop_is_typeArray_slow() const    { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  // klass allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  DEFINE_ALLOCATE_PERMANENT(typeArrayKlass);
1668
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    47
  static klassOop create_klass(BasicType type, int scale, const char* name_str,
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    48
                               TRAPS);
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    49
  static inline klassOop create_klass(BasicType type, int scale, TRAPS) {
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    50
    return create_klass(type, scale, external_name(type), CHECK_NULL);
8ec481b8f514 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 1
diff changeset
    51
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  int oop_size(oop obj) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  int klass_oop_size() const  { return object_size(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  bool compute_is_subtype_of(klassOop k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // Allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  typeArrayOop allocate(int length, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  typeArrayOop allocate_permanent(int length, TRAPS);  // used for class file structures
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  oop multi_allocate(int rank, jint* sizes, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // Copying
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  void  copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // Iteration
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  int oop_oop_iterate(oop obj, OopClosure* blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // Garbage collection
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  void oop_follow_contents(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  int  oop_adjust_pointers(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Parallel Scavenge and Parallel Old
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  PARALLEL_GC_DECLS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // Find n'th dimensional array
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  virtual klassOop array_klass_impl(bool or_null, int n, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // Returns the array class with this class as element type
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  virtual klassOop array_klass_impl(bool or_null, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // Casting from klassOop
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  static typeArrayKlass* cast(klassOop k) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    assert(k->klass_part()->oop_is_typeArray_slow(), "cast to typeArrayKlass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    return (typeArrayKlass*) k->klass_part();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // Naming
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  static const char* external_name(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // Sizing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  static int header_size()  { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  int object_size() const   { return arrayKlass::object_size(header_size()); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // Initialization (virtual from Klass)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  void initialize(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
   // Helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
   static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  void oop_print_on(oop obj, outputStream* st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  const char* internal_name() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   113
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   114
#endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP