src/share/vm/runtime/vframe_hp.hpp

Tue, 18 Mar 2014 19:07:22 +0100

author
pliden
date
Tue, 18 Mar 2014 19:07:22 +0100
changeset 6413
595c0f60d50d
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8029075: String deduplication in G1
Summary: Implementation of JEP 192, http://openjdk.java.net/jeps/192
Reviewed-by: brutisso, tschatzl, coleenp

     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #ifndef SHARE_VM_RUNTIME_VFRAME_HP_HPP
    26 #define SHARE_VM_RUNTIME_VFRAME_HP_HPP
    28 #include "runtime/vframe.hpp"
    30 class compiledVFrame: public javaVFrame {
    31  public:
    32   // JVM state
    33   Method*                      method()             const;
    34   int                          bci()                const;
    35   bool                         should_reexecute()   const;
    36   StackValueCollection*        locals()             const;
    37   StackValueCollection*        expressions()        const;
    38   GrowableArray<MonitorInfo*>* monitors()           const;
    40   void set_locals(StackValueCollection* values) const;
    42   // Virtuals defined in vframe
    43   bool is_compiled_frame() const { return true; }
    44   vframe* sender() const;
    45   bool is_top() const;
    47   // Casting
    48   static compiledVFrame* cast(vframe* vf) {
    49     assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame");
    50     return (compiledVFrame*) vf;
    51   }
    53  public:
    54   // Constructors
    55   compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm);
    57   // Update a local in a compiled frame. Update happens when deopt occurs
    58   void update_local(BasicType type, int index, jvalue value);
    60   // Returns the active nmethod
    61   nmethod*  code() const;
    63   // Returns the scopeDesc
    64   ScopeDesc* scope() const { return _scope; }
    66   // Returns SynchronizationEntryBCI or bci() (used for synchronization)
    67   int raw_bci() const;
    69  protected:
    70   ScopeDesc* _scope;
    73   //StackValue resolve(ScopeValue* sv) const;
    74   BasicLock* resolve_monitor_lock(Location location) const;
    75   StackValue *create_stack_value(ScopeValue *sv) const;
    77  private:
    78   compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope);
    80 #ifndef PRODUCT
    81  public:
    82   void verify() const;
    83 #endif
    84 };
    86 // In order to implement set_locals for compiled vframes we must
    87 // store updated locals in a data structure that contains enough
    88 // information to recognize equality with a vframe and to store
    89 // any updated locals.
    91 class jvmtiDeferredLocalVariable;
    92 class jvmtiDeferredLocalVariableSet : public CHeapObj<mtCompiler> {
    93 private:
    95   Method* _method;
    96   int       _bci;
    97   intptr_t* _id;
    98   GrowableArray<jvmtiDeferredLocalVariable*>* _locals;
   100  public:
   101   // JVM state
   102   Method*                           method()         const  { return _method; }
   103   int                               bci()            const  { return _bci; }
   104   intptr_t*                         id()             const  { return _id; }
   105   GrowableArray<jvmtiDeferredLocalVariable*>* locals()         const  { return _locals; }
   106   void                              set_local_at(int idx, BasicType typ, jvalue val);
   108   // Does the vframe match this jvmtiDeferredLocalVariableSet
   109   bool                              matches(vframe* vf);
   110   // GC
   111   void                              oops_do(OopClosure* f);
   113   // constructor
   114   jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id);
   116   // destructor
   117   ~jvmtiDeferredLocalVariableSet();
   120 };
   122 class jvmtiDeferredLocalVariable : public CHeapObj<mtCompiler> {
   123   public:
   125     jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value);
   127     BasicType type(void)                   { return _type; }
   128     int index(void)                        { return _index; }
   129     jvalue value(void)                     { return _value; }
   130     // Only mutator is for value as only it can change
   131     void set_value(jvalue value)           { _value = value; }
   132     // For gc
   133     oop* oop_addr(void)                    { return (oop*) &_value.l; }
   135   private:
   137     BasicType         _type;
   138     jvalue            _value;
   139     int               _index;
   141 };
   143 #endif // SHARE_VM_RUNTIME_VFRAME_HP_HPP

mercurial