src/share/vm/code/icBuffer.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2003, 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  */
  24 







  25 //
  26 // For CompiledIC's:
  27 //
  28 // In cases where we do not have MT-safe state transformation,
  29 // we go to a transition state, using ICStubs. At a safepoint,
  30 // the inline caches are transferred from the transitional code:
  31 //
  32 //    instruction_address --> 01 set xxx_oop, Ginline_cache_klass
  33 //                            23 jump_to Gtemp, yyyy
  34 //                            4  nop
  35 
  36 class ICStub: public Stub {
  37  private:
  38   int                 _size;       // total size of the stub incl. code
  39   address             _ic_site;    // points at call instruction of owning ic-buffer
  40   /* stub code follows here */
  41  protected:
  42   friend class ICStubInterface;
  43   // This will be called only by ICStubInterface
  44   void    initialize(int size) { _size = size; _ic_site = NULL; }


 109  public:
 110 
 111     // Initialization; must be called before first usage
 112   static void initialize();
 113 
 114   // Access
 115   static bool contains(address instruction_address);
 116 
 117     // removes the ICStubs after backpatching
 118   static void update_inline_caches();
 119 
 120   // for debugging
 121   static bool is_empty();
 122 
 123 
 124   // New interface
 125   static void    create_transition_stub(CompiledIC *ic, oop cached_oop, address entry);
 126   static address ic_destination_for(CompiledIC *ic);
 127   static oop     cached_oop_for(CompiledIC *ic);
 128 };


   1 /*
   2  * Copyright (c) 1997, 2010, 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  */
  24 
  25 #ifndef SHARE_VM_CODE_ICBUFFER_HPP
  26 #define SHARE_VM_CODE_ICBUFFER_HPP
  27 
  28 #include "code/stubs.hpp"
  29 #include "interpreter/bytecodes.hpp"
  30 #include "memory/allocation.hpp"
  31 
  32 //
  33 // For CompiledIC's:
  34 //
  35 // In cases where we do not have MT-safe state transformation,
  36 // we go to a transition state, using ICStubs. At a safepoint,
  37 // the inline caches are transferred from the transitional code:
  38 //
  39 //    instruction_address --> 01 set xxx_oop, Ginline_cache_klass
  40 //                            23 jump_to Gtemp, yyyy
  41 //                            4  nop
  42 
  43 class ICStub: public Stub {
  44  private:
  45   int                 _size;       // total size of the stub incl. code
  46   address             _ic_site;    // points at call instruction of owning ic-buffer
  47   /* stub code follows here */
  48  protected:
  49   friend class ICStubInterface;
  50   // This will be called only by ICStubInterface
  51   void    initialize(int size) { _size = size; _ic_site = NULL; }


 116  public:
 117 
 118     // Initialization; must be called before first usage
 119   static void initialize();
 120 
 121   // Access
 122   static bool contains(address instruction_address);
 123 
 124     // removes the ICStubs after backpatching
 125   static void update_inline_caches();
 126 
 127   // for debugging
 128   static bool is_empty();
 129 
 130 
 131   // New interface
 132   static void    create_transition_stub(CompiledIC *ic, oop cached_oop, address entry);
 133   static address ic_destination_for(CompiledIC *ic);
 134   static oop     cached_oop_for(CompiledIC *ic);
 135 };
 136 
 137 #endif // SHARE_VM_CODE_ICBUFFER_HPP