Shark clearout

Gary Benson gbenson at redhat.com
Tue Jun 9 05:59:36 PDT 2009


Hi all,

My commits over the past week have replaced all constant pool accesses
in Shark.  This commit removes the constant pool access code itself,
and some hacks that were required to support it.

Cheers,
Gary

-- 
http://gbenson.net/
-------------- next part --------------
diff -r d55dfba8404f -r ff13b7d6e330 ChangeLog
--- a/ChangeLog	Tue Jun 09 06:22:07 2009 -0400
+++ b/ChangeLog	Tue Jun 09 08:53:57 2009 -0400
@@ -1,3 +1,17 @@
+2009-06-09  Gary Benson  <gbenson at redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::scan_for_traps): Removed unused code.
+
+	* ports/hotspot/src/share/vm/shark/sharkConstantPool.hpp: Removed.
+	* ports/hotspot/src/share/vm/shark/sharkConstantPool.cpp: Likewise.
+
+	* patches/hotspot/default/icedtea-shark.patch
+	(ciInstanceKlass::is_cache_entry_resolved): Removed.
+	(ciInstanceKlass::constant_pool_tag_at): Likewise.
+
+	* ports/hotspot/src/share/vm/includeDB_shark: Updated.	
+
 2009-06-09  Gary Benson  <gbenson at redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
diff -r d55dfba8404f -r ff13b7d6e330 patches/hotspot/default/icedtea-shark.patch
--- a/patches/hotspot/default/icedtea-shark.patch	Tue Jun 09 06:22:07 2009 -0400
+++ b/patches/hotspot/default/icedtea-shark.patch	Tue Jun 09 08:53:57 2009 -0400
@@ -337,46 +337,40 @@
  }
  
  // ------------------------------------------------------------------
-diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
---- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Mon Dec 15 15:32:37 2008 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Tue Apr 21 09:47:27 2009 +0100
-@@ -548,3 +548,23 @@
-   }
-   return impl;
+diff -r 12c97e7e55eb -r e6fef2ef2fea openjdk/hotspot/src/share/vm/ci/ciMethod.cpp
+--- openjdk/hotspot/src/share/vm/ci/ciMethod.cpp	Tue Jun 09 09:17:11 2009 +0100
++++ openjdk/hotspot/src/share/vm/ci/ciMethod.cpp	Tue Jun 09 10:04:02 2009 +0100
+@@ -229,6 +229,20 @@
  }
-+
+ 
+ 
 +#ifdef SHARK
 +// ------------------------------------------------------------------
-+// ciInstanceKlass::constant_pool_tag_at
++// ciMethod::itable_index
 +//
-+// What is in this constant pool slot?
-+constantTag ciInstanceKlass::constant_pool_tag_at(int index) {
++// Get the position of this method's entry in the itable, if any.
++int ciMethod::itable_index() {
++  check_is_loaded();
++  assert(holder()->is_linked(), "must be linked");
 +  VM_ENTRY_MARK;
-+  return get_instanceKlass()->constants()->tag_at(index);
-+}
-+
-+// ------------------------------------------------------------------
-+// ciInstanceKlass::is_cache_entry_resolved
-+//
-+// Is this entry in the constant pool cache resolved?
-+bool ciInstanceKlass::is_cache_entry_resolved(int index, Bytecodes::Code opcode) {
-+  VM_ENTRY_MARK;
-+  return get_instanceKlass()->constants()->cache()->entry_at(index)->is_resolved(opcode);
++  return klassItable::compute_itable_index(get_methodOop());
 +}
 +#endif // SHARK
-diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
---- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Mon Dec 15 15:32:37 2008 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Tue Apr 21 09:47:27 2009 +0100
-@@ -198,4 +198,12 @@
-   // What kind of ciObject is this?
-   bool is_instance_klass() { return true; }
-   bool is_java_klass()     { return true; }
 +
++
+ // ------------------------------------------------------------------
+ // ciMethod::native_entry
+ //
+diff -r 12c97e7e55eb -r e6fef2ef2fea openjdk/hotspot/src/share/vm/ci/ciMethod.hpp
+--- openjdk/hotspot/src/share/vm/ci/ciMethod.hpp	Tue Jun 09 09:17:11 2009 +0100
++++ openjdk/hotspot/src/share/vm/ci/ciMethod.hpp	Tue Jun 09 10:04:02 2009 +0100
+@@ -139,6 +139,9 @@
+ 
+   // Runtime information.
+   int           vtable_index();
 +#ifdef SHARK
-+  // What is in this constant pool slot?
-+  constantTag constant_pool_tag_at(int index);
-+
-+  // Is this entry in the constant pool cache resolved?
-+  bool is_cache_entry_resolved(int index, Bytecodes::Code opcode);
++  int           itable_index();
 +#endif // SHARK
- };
+   address       native_entry();
+   address       interpreter_entry();
+ 
diff -r d55dfba8404f -r ff13b7d6e330 ports/hotspot/src/share/vm/includeDB_shark
--- a/ports/hotspot/src/share/vm/includeDB_shark	Tue Jun 09 06:22:07 2009 -0400
+++ b/ports/hotspot/src/share/vm/includeDB_shark	Tue Jun 09 08:53:57 2009 -0400
@@ -170,24 +170,6 @@
 sharkConstant.hpp                       sharkBuilder.hpp
 sharkConstant.hpp                       sharkValue.hpp
 
-sharkConstantPool.cpp                   allocation.hpp
-sharkConstantPool.cpp                   constantPoolOop.hpp
-sharkConstantPool.cpp                   cpCacheOop.hpp
-sharkConstantPool.cpp                   debug.hpp
-sharkConstantPool.cpp                   llvmHeaders.hpp
-sharkConstantPool.cpp                   llvmValue.hpp
-sharkConstantPool.cpp                   methodOop.hpp
-sharkConstantPool.cpp                   sharkBuilder.hpp
-sharkConstantPool.cpp                   sharkConstantPool.hpp
-sharkConstantPool.cpp                   sharkState.inline.hpp
-sharkConstantPool.cpp                   sharkType.hpp
-sharkConstantPool.cpp                   sharkValue.hpp
-
-sharkConstantPool.hpp                   allocation.hpp
-sharkConstantPool.hpp                   llvmHeaders.hpp
-sharkConstantPool.hpp                   sharkBuilder.hpp
-sharkConstantPool.hpp                   sharkTopLevelBlock.hpp
-
 sharkEntry.cpp                          sharkEntry.hpp
 
 sharkEntry.hpp                          llvmHeaders.hpp
@@ -316,7 +298,6 @@
 sharkTopLevelBlock.cpp                  sharkTopLevelBlock.hpp
 sharkTopLevelBlock.cpp                  sharkBuilder.hpp
 sharkTopLevelBlock.cpp                  sharkConstant.hpp
-sharkTopLevelBlock.cpp                  sharkConstantPool.hpp
 sharkTopLevelBlock.cpp                  sharkInliner.hpp
 sharkTopLevelBlock.cpp                  sharkRuntime.hpp
 sharkTopLevelBlock.cpp                  sharkState.inline.hpp
diff -r d55dfba8404f -r ff13b7d6e330 ports/hotspot/src/share/vm/shark/sharkConstantPool.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkConstantPool.cpp	Tue Jun 09 06:22:07 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkConstantPool.cpp.incl"
-
-using namespace llvm;
-
-Value *SharkConstantPool::constants()
-{
-  Value *m = method();
-  if (m != _constants_method) {
-    _constants = builder()->CreateValueOfStructEntry(
-      m, methodOopDesc::constants_offset(),
-      SharkType::oop_type(), "constants");
-    _constants_method = m;
-  }
-  return _constants;
-}
-
-Value *SharkConstantPool::tags()
-{
-  Value *cp = constants();
-  if (cp != _tags_constants) {
-    _tags = builder()->CreateValueOfStructEntry(
-      cp, in_ByteSize(constantPoolOopDesc::tags_offset_in_bytes()),
-      SharkType::oop_type(), "tags");
-    _tags_constants = cp;
-  }
-  return _tags;
-}
-
-Value *SharkConstantPool::cache()
-{
-  Value *cp = constants();
-  if (cp != _cache_constants) {
-    _cache = builder()->CreateValueOfStructEntry(
-      cp, in_ByteSize(constantPoolOopDesc::cache_offset_in_bytes()),
-      SharkType::oop_type(), "cache");
-    _cache_constants = cp;
-  }
-  return _cache;
-}
-
-Value *SharkConstantPool::object_at(int which)
-{
-  return builder()->CreateLoad(
-    builder()->CreateArrayAddress(
-      constants(),
-      T_OBJECT, in_ByteSize(sizeof(constantPoolOopDesc)),
-      LLVMValue::jint_constant(which)));
-}
-
-Value *SharkConstantPool::tag_at(int which)
-{
-  return builder()->CreateLoad(
-    builder()->CreateArrayAddress(
-      tags(), T_BYTE, LLVMValue::jint_constant(which)));
-}
-
-Value *SharkConstantPool::cache_entry_at(int which)
-{
-  // Takes a constant pool cache index in byte-swapped byte order
-  // (which comes from the bytecodes after rewriting).  This is a
-  // bizarre hack but it's the same as
-  // constantPoolOopDesc::field_or_method_at().
-  which = Bytes::swap_u2(which);
-  assert(target()->holder()->is_cache_entry_resolved(which, block()->bc()),
-         "should be");
-
-  return builder()->CreateIntToPtr(
-    builder()->CreateAdd(
-      builder()->CreatePtrToInt(
-        cache(), SharkType::intptr_type()),
-      LLVMValue::intptr_constant(
-        in_bytes(constantPoolCacheOopDesc::base_offset()) +
-        which * sizeof(ConstantPoolCacheEntry))),
-    SharkType::cpCacheEntry_type());
-}
-
-Value *SharkConstantPool::java_mirror()
-{
-  Value *cp = constants();
-
-  Value *pool_holder = builder()->CreateValueOfStructEntry(
-    cp,
-    in_ByteSize(constantPoolOopDesc::pool_holder_offset_in_bytes()),
-    SharkType::oop_type(),
-    "pool_holder");
-
-  Value *klass_part = builder()->CreateAddressOfStructEntry(
-    pool_holder,
-    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
-    SharkType::klass_type(),
-    "klass_part");
-
-  // XXX should there be a memory barrier before this load?
-  return builder()->CreateValueOfStructEntry(
-    klass_part,
-    in_ByteSize(Klass::java_mirror_offset_in_bytes()),
-    SharkType::oop_type(),
-    "java_mirror");
-}
diff -r d55dfba8404f -r ff13b7d6e330 ports/hotspot/src/share/vm/shark/sharkConstantPool.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkConstantPool.hpp	Tue Jun 09 06:22:07 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkConstantPool : public StackObj {
- public:
-  SharkConstantPool(SharkTopLevelBlock* block)
-    : _block(block),
-      _constants_method(NULL),
-      _tags_constants(NULL),
-      _cache_constants(NULL) {}
-
- private:
-  SharkTopLevelBlock* _block;
-
- private:
-  SharkTopLevelBlock* block() const
-  {
-    return _block;
-  }
-  SharkBuilder* builder() const
-  {
-    return block()->builder();
-  }
-  ciMethod* target() const
-  {
-    return block()->target();
-  }
-  llvm::Value* method() const
-  {
-    return block()->method();
-  }
-
- private:
-  llvm::Value* _constants;        // The constant pool, a constantPoolOop
-  llvm::Value* _constants_method; // The method _constants was loaded from
-
-  llvm::Value* _tags;             // The tags array, a typeArrayOop
-  llvm::Value* _tags_constants;   // The constantPoolOop _tags is in
-
-  llvm::Value* _cache;            // The cache, a constantPoolCacheOop
-  llvm::Value* _cache_constants;  // The constantPoolCacheOop _cache is in
-
- private:
-  llvm::Value* constants();
-  llvm::Value* tags();
-  llvm::Value* cache();
-
- public:
-  llvm::Value* object_at(int which);
-  llvm::Value* tag_at(int which);
-  llvm::Value* cache_entry_at(int which);
-  llvm::Value* java_mirror();
-};
diff -r d55dfba8404f -r ff13b7d6e330 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Tue Jun 09 06:22:07 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Tue Jun 09 08:53:57 2009 -0400
@@ -43,8 +43,6 @@
     ciInstanceKlass *klass;
     bool will_link;
     bool is_field;
-
-    int index = -1;
 
     switch (bc()) {
     case Bytecodes::_ldc:
@@ -140,18 +138,6 @@
         return;
       }
       break;
-    }
-
-    // If we found a constant pool access on this bytecode then check it
-    if (index != -1) {
-      if (!target()->holder()->is_cache_entry_resolved(
-             Bytes::swap_u2(index), bc())) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_uninitialized,
-            Deoptimization::Action_reinterpret), bci());
-        return;
-      }
     }
   }
   


More information about the distro-pkg-dev mailing list