src/share/vm/interpreter/bytecode.hpp

changeset 3969
1d7922586cf6
parent 3251
e342a5110bed
child 4037
da91efe96a93
     1.1 --- a/src/share/vm/interpreter/bytecode.hpp	Mon Jul 23 13:04:59 2012 -0700
     1.2 +++ b/src/share/vm/interpreter/bytecode.hpp	Tue Jul 24 10:51:00 2012 -0700
     1.3 @@ -80,6 +80,7 @@
     1.4  
     1.5    Bytecodes::Code code() const                   { return _code; }
     1.6    Bytecodes::Code java_code() const              { return Bytecodes::java_code(code()); }
     1.7 +  Bytecodes::Code invoke_code() const            { return (code() == Bytecodes::_invokehandle) ? code() : java_code(); }
     1.8  
     1.9    // Static functions for parsing bytecodes in place.
    1.10    int get_index_u1(Bytecodes::Code bc) const {
    1.11 @@ -195,10 +196,14 @@
    1.12    Bytecode_member_ref(methodHandle method, int bci)  : Bytecode(method(), method()->bcp_from(bci)), _method(method) {}
    1.13  
    1.14    methodHandle method() const                    { return _method; }
    1.15 +  constantPoolOop constants() const              { return _method->constants(); }
    1.16 +  constantPoolCacheOop cpcache() const           { return _method->constants()->cache(); }
    1.17 +  ConstantPoolCacheEntry* cpcache_entry() const;
    1.18  
    1.19   public:
    1.20    int          index() const;                    // cache index (loaded from instruction)
    1.21    int          pool_index() const;               // constant pool index
    1.22 +  Symbol*      klass() const;                    // returns the klass of the method or field
    1.23    Symbol*      name() const;                     // returns the name of the method or field
    1.24    Symbol*      signature() const;                // returns the signature of the method or field
    1.25  
    1.26 @@ -218,13 +223,15 @@
    1.27  
    1.28    // Attributes
    1.29    methodHandle static_target(TRAPS);             // "specified" method   (from constant pool)
    1.30 +  Handle       appendix(TRAPS);                  // if CPCE::has_appendix (from constant pool)
    1.31  
    1.32    // Testers
    1.33 -  bool is_invokeinterface() const                { return java_code() == Bytecodes::_invokeinterface; }
    1.34 -  bool is_invokevirtual() const                  { return java_code() == Bytecodes::_invokevirtual; }
    1.35 -  bool is_invokestatic() const                   { return java_code() == Bytecodes::_invokestatic; }
    1.36 -  bool is_invokespecial() const                  { return java_code() == Bytecodes::_invokespecial; }
    1.37 -  bool is_invokedynamic() const                  { return java_code() == Bytecodes::_invokedynamic; }
    1.38 +  bool is_invokeinterface() const                { return invoke_code() == Bytecodes::_invokeinterface; }
    1.39 +  bool is_invokevirtual() const                  { return invoke_code() == Bytecodes::_invokevirtual; }
    1.40 +  bool is_invokestatic() const                   { return invoke_code() == Bytecodes::_invokestatic; }
    1.41 +  bool is_invokespecial() const                  { return invoke_code() == Bytecodes::_invokespecial; }
    1.42 +  bool is_invokedynamic() const                  { return invoke_code() == Bytecodes::_invokedynamic; }
    1.43 +  bool is_invokehandle() const                   { return invoke_code() == Bytecodes::_invokehandle; }
    1.44  
    1.45    bool has_receiver() const                      { return !is_invokestatic() && !is_invokedynamic(); }
    1.46  
    1.47 @@ -232,15 +239,12 @@
    1.48                                                            is_invokevirtual()   ||
    1.49                                                            is_invokestatic()    ||
    1.50                                                            is_invokespecial()   ||
    1.51 -                                                          is_invokedynamic(); }
    1.52 +                                                          is_invokedynamic()   ||
    1.53 +                                                          is_invokehandle(); }
    1.54  
    1.55 -  bool is_method_handle_invoke() const {
    1.56 -    return (is_invokedynamic() ||
    1.57 -            (is_invokevirtual() &&
    1.58 -             method()->constants()->klass_ref_at_noresolve(index()) == vmSymbols::java_lang_invoke_MethodHandle() &&
    1.59 -             methodOopDesc::is_method_handle_invoke_name(name())));
    1.60 -  }
    1.61 +  bool has_appendix()                            { return cpcache_entry()->has_appendix(); }
    1.62  
    1.63 + private:
    1.64    // Helper to skip verification.   Used is_valid() to check if the result is really an invoke
    1.65    inline friend Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci);
    1.66  };

mercurial