< prev index next >

src/hotspot/share/classfile/bytecodeAssembler.cpp

Print this page




  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 #include "precompiled.hpp"
  26 
  27 #include "classfile/bytecodeAssembler.hpp"
  28 #include "interpreter/bytecodes.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "oops/constantPool.hpp"

  31 #include "utilities/bytes.hpp"
  32 
  33 u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe) {
  34   u2 index;
  35   u2* probe = _indices.get(bcpe);
  36   if (probe == NULL) {
  37     index = _entries.length();
  38     _entries.append(bcpe);
  39     _indices.put(bcpe, index);
  40   } else {
  41     index = *probe;
  42   }
  43   return index + _orig->length();
  44 }
  45 
  46 ConstantPool* BytecodeConstantPool::create_constant_pool(TRAPS) const {
  47   if (_entries.length() == 0) {
  48     return _orig;
  49   }
  50 




  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 #include "precompiled.hpp"
  26 
  27 #include "classfile/bytecodeAssembler.hpp"
  28 #include "interpreter/bytecodes.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "oops/constantPool.hpp"
  31 #include "runtime/handles.inline.hpp"
  32 #include "utilities/bytes.hpp"
  33 
  34 u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe) {
  35   u2 index;
  36   u2* probe = _indices.get(bcpe);
  37   if (probe == NULL) {
  38     index = _entries.length();
  39     _entries.append(bcpe);
  40     _indices.put(bcpe, index);
  41   } else {
  42     index = *probe;
  43   }
  44   return index + _orig->length();
  45 }
  46 
  47 ConstantPool* BytecodeConstantPool::create_constant_pool(TRAPS) const {
  48   if (_entries.length() == 0) {
  49     return _orig;
  50   }
  51 


< prev index next >