src/share/vm/code/dependencies.hpp

changeset 4037
da91efe96a93
parent 3094
b27c72d69fd1
child 6876
710a3c8b516e
child 7030
3c048df3ef8b
child 7499
9906d432d6db
     1.1 --- a/src/share/vm/code/dependencies.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/code/dependencies.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 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 @@ -203,7 +203,7 @@
    1.11   private:
    1.12    // State for writing a new set of dependencies:
    1.13    GrowableArray<int>*       _dep_seen;  // (seen[h->ident] & (1<<dept))
    1.14 -  GrowableArray<ciObject*>* _deps[TYPE_LIMIT];
    1.15 +  GrowableArray<ciBaseObject*>*  _deps[TYPE_LIMIT];
    1.16  
    1.17    static const char* _dep_name[TYPE_LIMIT];
    1.18    static int         _dep_args[TYPE_LIMIT];
    1.19 @@ -212,7 +212,7 @@
    1.20      return (int)dept >= 0 && dept < TYPE_LIMIT && ((1<<dept) & mask) != 0;
    1.21    }
    1.22  
    1.23 -  bool note_dep_seen(int dept, ciObject* x) {
    1.24 +  bool note_dep_seen(int dept, ciBaseObject* x) {
    1.25      assert(dept < BitsPerInt, "oob");
    1.26      int x_id = x->ident();
    1.27      assert(_dep_seen != NULL, "deps must be writable");
    1.28 @@ -222,7 +222,7 @@
    1.29      return (seen & (1<<dept)) != 0;
    1.30    }
    1.31  
    1.32 -  bool maybe_merge_ctxk(GrowableArray<ciObject*>* deps,
    1.33 +  bool maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps,
    1.34                          int ctxk_i, ciKlass* ctxk);
    1.35  
    1.36    void sort_all_deps();
    1.37 @@ -260,9 +260,9 @@
    1.38      assert(!is_concrete_klass(ctxk->as_instance_klass()), "must be abstract");
    1.39    }
    1.40  
    1.41 -  void assert_common_1(DepType dept, ciObject* x);
    1.42 -  void assert_common_2(DepType dept, ciObject* x0, ciObject* x1);
    1.43 -  void assert_common_3(DepType dept, ciKlass* ctxk, ciObject* x1, ciObject* x2);
    1.44 +  void assert_common_1(DepType dept, ciBaseObject* x);
    1.45 +  void assert_common_2(DepType dept, ciBaseObject* x0, ciBaseObject* x1);
    1.46 +  void assert_common_3(DepType dept, ciKlass* ctxk, ciBaseObject* x1, ciBaseObject* x2);
    1.47  
    1.48   public:
    1.49    // Adding assertions to a new dependency set at compile time:
    1.50 @@ -286,8 +286,8 @@
    1.51    // methods to remain non-concrete until their first invocation.
    1.52    // In that case, there would be a middle ground between concrete
    1.53    // and abstract (as defined by the Java language and VM).
    1.54 -  static bool is_concrete_klass(klassOop k);    // k is instantiable
    1.55 -  static bool is_concrete_method(methodOop m);  // m is invocable
    1.56 +  static bool is_concrete_klass(Klass* k);    // k is instantiable
    1.57 +  static bool is_concrete_method(Method* m);  // m is invocable
    1.58    static Klass* find_finalizable_subclass(Klass* k);
    1.59  
    1.60    // These versions of the concreteness queries work through the CI.
    1.61 @@ -314,24 +314,24 @@
    1.62    // dependency on it must fail.
    1.63  
    1.64    // Checking old assertions at run-time (in the VM only):
    1.65 -  static klassOop check_evol_method(methodOop m);
    1.66 -  static klassOop check_leaf_type(klassOop ctxk);
    1.67 -  static klassOop check_abstract_with_unique_concrete_subtype(klassOop ctxk, klassOop conck,
    1.68 +  static Klass* check_evol_method(Method* m);
    1.69 +  static Klass* check_leaf_type(Klass* ctxk);
    1.70 +  static Klass* check_abstract_with_unique_concrete_subtype(Klass* ctxk, Klass* conck,
    1.71                                                                KlassDepChange* changes = NULL);
    1.72 -  static klassOop check_abstract_with_no_concrete_subtype(klassOop ctxk,
    1.73 +  static Klass* check_abstract_with_no_concrete_subtype(Klass* ctxk,
    1.74                                                            KlassDepChange* changes = NULL);
    1.75 -  static klassOop check_concrete_with_no_concrete_subtype(klassOop ctxk,
    1.76 +  static Klass* check_concrete_with_no_concrete_subtype(Klass* ctxk,
    1.77                                                            KlassDepChange* changes = NULL);
    1.78 -  static klassOop check_unique_concrete_method(klassOop ctxk, methodOop uniqm,
    1.79 +  static Klass* check_unique_concrete_method(Klass* ctxk, Method* uniqm,
    1.80                                                 KlassDepChange* changes = NULL);
    1.81 -  static klassOop check_abstract_with_exclusive_concrete_subtypes(klassOop ctxk, klassOop k1, klassOop k2,
    1.82 +  static Klass* check_abstract_with_exclusive_concrete_subtypes(Klass* ctxk, Klass* k1, Klass* k2,
    1.83                                                                    KlassDepChange* changes = NULL);
    1.84 -  static klassOop check_exclusive_concrete_methods(klassOop ctxk, methodOop m1, methodOop m2,
    1.85 +  static Klass* check_exclusive_concrete_methods(Klass* ctxk, Method* m1, Method* m2,
    1.86                                                     KlassDepChange* changes = NULL);
    1.87 -  static klassOop check_has_no_finalizable_subclasses(klassOop ctxk, KlassDepChange* changes = NULL);
    1.88 -  static klassOop check_call_site_target_value(oop call_site, oop method_handle, CallSiteDepChange* changes = NULL);
    1.89 -  // A returned klassOop is NULL if the dependency assertion is still
    1.90 -  // valid.  A non-NULL klassOop is a 'witness' to the assertion
    1.91 +  static Klass* check_has_no_finalizable_subclasses(Klass* ctxk, KlassDepChange* changes = NULL);
    1.92 +  static Klass* check_call_site_target_value(oop call_site, oop method_handle, CallSiteDepChange* changes = NULL);
    1.93 +  // A returned Klass* is NULL if the dependency assertion is still
    1.94 +  // valid.  A non-NULL Klass* is a 'witness' to the assertion
    1.95    // failure, a point in the class hierarchy where the assertion has
    1.96    // been proven false.  For example, if check_leaf_type returns
    1.97    // non-NULL, the value is a subtype of the supposed leaf type.  This
    1.98 @@ -345,10 +345,10 @@
    1.99    // It is used by DepStream::spot_check_dependency_at.
   1.100  
   1.101    // Detecting possible new assertions:
   1.102 -  static klassOop  find_unique_concrete_subtype(klassOop ctxk);
   1.103 -  static methodOop find_unique_concrete_method(klassOop ctxk, methodOop m);
   1.104 -  static int       find_exclusive_concrete_subtypes(klassOop ctxk, int klen, klassOop k[]);
   1.105 -  static int       find_exclusive_concrete_methods(klassOop ctxk, int mlen, methodOop m[]);
   1.106 +  static Klass*    find_unique_concrete_subtype(Klass* ctxk);
   1.107 +  static Method*   find_unique_concrete_method(Klass* ctxk, Method* m);
   1.108 +  static int       find_exclusive_concrete_subtypes(Klass* ctxk, int klen, Klass* k[]);
   1.109 +  static int       find_exclusive_concrete_methods(Klass* ctxk, int mlen, Method* m[]);
   1.110  
   1.111    // Create the encoding which will be stored in an nmethod.
   1.112    void encode_content_bytes();
   1.113 @@ -368,15 +368,15 @@
   1.114    void copy_to(nmethod* nm);
   1.115  
   1.116    void log_all_dependencies();
   1.117 -  void log_dependency(DepType dept, int nargs, ciObject* args[]) {
   1.118 +  void log_dependency(DepType dept, int nargs, ciBaseObject* args[]) {
   1.119      write_dependency_to(log(), dept, nargs, args);
   1.120    }
   1.121    void log_dependency(DepType dept,
   1.122 -                      ciObject* x0,
   1.123 -                      ciObject* x1 = NULL,
   1.124 -                      ciObject* x2 = NULL) {
   1.125 +                      ciBaseObject* x0,
   1.126 +                      ciBaseObject* x1 = NULL,
   1.127 +                      ciBaseObject* x2 = NULL) {
   1.128      if (log() == NULL)  return;
   1.129 -    ciObject* args[max_arg_count];
   1.130 +    ciBaseObject* args[max_arg_count];
   1.131      args[0] = x0;
   1.132      args[1] = x1;
   1.133      args[2] = x2;
   1.134 @@ -384,27 +384,47 @@
   1.135      log_dependency(dept, dep_args(dept), args);
   1.136    }
   1.137  
   1.138 +  class DepArgument : public ResourceObj {
   1.139 +   private:
   1.140 +    bool  _is_oop;
   1.141 +    bool  _valid;
   1.142 +    void* _value;
   1.143 +   public:
   1.144 +    DepArgument() : _is_oop(false), _value(NULL), _valid(false) {}
   1.145 +    DepArgument(oop v): _is_oop(true), _value(v), _valid(true) {}
   1.146 +    DepArgument(Metadata* v): _is_oop(false), _value(v), _valid(true) {}
   1.147 +
   1.148 +    bool is_null() const               { return _value == NULL; }
   1.149 +    bool is_oop() const                { return _is_oop; }
   1.150 +    bool is_metadata() const           { return !_is_oop; }
   1.151 +    bool is_klass() const              { return is_metadata() && metadata_value()->is_klass(); }
   1.152 +    bool is_method() const              { return is_metadata() && metadata_value()->is_method(); }
   1.153 +
   1.154 +    oop oop_value() const              { assert(_is_oop && _valid, "must be"); return (oop) _value; }
   1.155 +    Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; }
   1.156 +  };
   1.157 +
   1.158    static void write_dependency_to(CompileLog* log,
   1.159                                    DepType dept,
   1.160 -                                  int nargs, ciObject* args[],
   1.161 -                                  klassOop witness = NULL);
   1.162 +                                  int nargs, ciBaseObject* args[],
   1.163 +                                  Klass* witness = NULL);
   1.164    static void write_dependency_to(CompileLog* log,
   1.165                                    DepType dept,
   1.166 -                                  int nargs, oop args[],
   1.167 -                                  klassOop witness = NULL);
   1.168 +                                  int nargs, DepArgument args[],
   1.169 +                                  Klass* witness = NULL);
   1.170    static void write_dependency_to(xmlStream* xtty,
   1.171                                    DepType dept,
   1.172 -                                  int nargs, oop args[],
   1.173 -                                  klassOop witness = NULL);
   1.174 +                                  int nargs, DepArgument args[],
   1.175 +                                  Klass* witness = NULL);
   1.176    static void print_dependency(DepType dept,
   1.177 -                               int nargs, oop args[],
   1.178 -                               klassOop witness = NULL);
   1.179 +                               int nargs, DepArgument args[],
   1.180 +                               Klass* witness = NULL);
   1.181  
   1.182   private:
   1.183    // helper for encoding common context types as zero:
   1.184 -  static ciKlass* ctxk_encoded_as_null(DepType dept, ciObject* x);
   1.185 +  static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x);
   1.186  
   1.187 -  static klassOop ctxk_encoded_as_null(DepType dept, oop x);
   1.188 +  static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x);
   1.189  
   1.190   public:
   1.191    // Use this to iterate over an nmethod's dependency set.
   1.192 @@ -433,13 +453,13 @@
   1.193  
   1.194      void initial_asserts(size_t byte_limit) NOT_DEBUG({});
   1.195  
   1.196 +    inline Metadata* recorded_metadata_at(int i);
   1.197      inline oop recorded_oop_at(int i);
   1.198 -        // => _code? _code->oop_at(i): *_deps->_oop_recorder->handle_at(i)
   1.199  
   1.200 -    klassOop check_klass_dependency(KlassDepChange* changes);
   1.201 -    klassOop check_call_site_dependency(CallSiteDepChange* changes);
   1.202 +    Klass* check_klass_dependency(KlassDepChange* changes);
   1.203 +    Klass* check_call_site_dependency(CallSiteDepChange* changes);
   1.204  
   1.205 -    void trace_and_log_witness(klassOop witness);
   1.206 +    void trace_and_log_witness(Klass* witness);
   1.207  
   1.208    public:
   1.209      DepStream(Dependencies* deps)
   1.210 @@ -463,38 +483,39 @@
   1.211      int argument_count()         { return dep_args(type()); }
   1.212      int argument_index(int i)    { assert(0 <= i && i < argument_count(), "oob");
   1.213                                     return _xi[i]; }
   1.214 -    oop argument(int i);         // => recorded_oop_at(argument_index(i))
   1.215 -    klassOop context_type();
   1.216 +    Metadata* argument(int i);     // => recorded_oop_at(argument_index(i))
   1.217 +    oop argument_oop(int i);         // => recorded_oop_at(argument_index(i))
   1.218 +    Klass* context_type();
   1.219  
   1.220      bool is_klass_type()         { return Dependencies::is_klass_type(type()); }
   1.221  
   1.222 -    methodOop method_argument(int i) {
   1.223 -      oop x = argument(i);
   1.224 +    Method* method_argument(int i) {
   1.225 +      Metadata* x = argument(i);
   1.226        assert(x->is_method(), "type");
   1.227 -      return (methodOop) x;
   1.228 +      return (Method*) x;
   1.229      }
   1.230 -    klassOop type_argument(int i) {
   1.231 -      oop x = argument(i);
   1.232 +    Klass* type_argument(int i) {
   1.233 +      Metadata* x = argument(i);
   1.234        assert(x->is_klass(), "type");
   1.235 -      return (klassOop) x;
   1.236 +      return (Klass*) x;
   1.237      }
   1.238  
   1.239      // The point of the whole exercise:  Is this dep still OK?
   1.240 -    klassOop check_dependency() {
   1.241 -      klassOop result = check_klass_dependency(NULL);
   1.242 +    Klass* check_dependency() {
   1.243 +      Klass* result = check_klass_dependency(NULL);
   1.244        if (result != NULL)  return result;
   1.245        return check_call_site_dependency(NULL);
   1.246      }
   1.247  
   1.248      // A lighter version:  Checks only around recent changes in a class
   1.249      // hierarchy.  (See Universe::flush_dependents_on.)
   1.250 -    klassOop spot_check_dependency_at(DepChange& changes);
   1.251 +    Klass* spot_check_dependency_at(DepChange& changes);
   1.252  
   1.253      // Log the current dependency to xtty or compilation log.
   1.254 -    void log_dependency(klassOop witness = NULL);
   1.255 +    void log_dependency(Klass* witness = NULL);
   1.256  
   1.257      // Print the current dependency to tty.
   1.258 -    void print_dependency(klassOop witness = NULL, bool verbose = false);
   1.259 +    void print_dependency(Klass* witness = NULL, bool verbose = false);
   1.260    };
   1.261    friend class Dependencies::DepStream;
   1.262  
   1.263 @@ -533,7 +554,7 @@
   1.264  
   1.265    // Usage:
   1.266    // for (DepChange::ContextStream str(changes); str.next(); ) {
   1.267 -  //   klassOop k = str.klass();
   1.268 +  //   Klass* k = str.klass();
   1.269    //   switch (str.change_type()) {
   1.270    //     ...
   1.271    //   }
   1.272 @@ -545,8 +566,8 @@
   1.273  
   1.274      // iteration variables:
   1.275      ChangeType  _change_type;
   1.276 -    klassOop    _klass;
   1.277 -    objArrayOop _ti_base;    // i.e., transitive_interfaces
   1.278 +    Klass*      _klass;
   1.279 +    Array<Klass*>* _ti_base;    // i.e., transitive_interfaces
   1.280      int         _ti_index;
   1.281      int         _ti_limit;
   1.282  
   1.283 @@ -566,7 +587,7 @@
   1.284      bool next();
   1.285  
   1.286      ChangeType change_type()     { return _change_type; }
   1.287 -    klassOop   klass()           { return _klass; }
   1.288 +    Klass*     klass()           { return _klass; }
   1.289    };
   1.290    friend class DepChange::ContextStream;
   1.291  };
   1.292 @@ -598,10 +619,10 @@
   1.293    // What kind of DepChange is this?
   1.294    virtual bool is_klass_change() const { return true; }
   1.295  
   1.296 -  klassOop new_type() { return _new_type(); }
   1.297 +  Klass* new_type() { return _new_type(); }
   1.298  
   1.299    // involves_context(k) is true if k is new_type or any of the super types
   1.300 -  bool involves_context(klassOop k);
   1.301 +  bool involves_context(Klass* k);
   1.302  };
   1.303  
   1.304  

mercurial