changeset 165:a51e5042a3d1

Bug 2976: [REFACTORING][JDK 9] Use const declarations for TBitMapMarker
author Yasumasa Suenaga <yasuenag@gmail.com>
date Thu, 02 Jun 2016 22:23:18 +0900
parents 765bf9000f5b
children 6872a12a8688
files agent/src/heapstats-engines/arch/arm/armBitMapMarker.cpp agent/src/heapstats-engines/arch/arm/armBitMapMarker.hpp agent/src/heapstats-engines/arch/arm/neon/neonBitMapMarker.hpp agent/src/heapstats-engines/arch/x86/avx/avxBitMapMarker.hpp agent/src/heapstats-engines/arch/x86/sse2/sse2BitMapMarker.hpp agent/src/heapstats-engines/arch/x86/x86BitMapMarker.cpp agent/src/heapstats-engines/arch/x86/x86BitMapMarker.hpp agent/src/heapstats-engines/bitMapMarker.cpp agent/src/heapstats-engines/bitMapMarker.hpp
diffstat 9 files changed, 34 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/heapstats-engines/arch/arm/armBitMapMarker.cpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/arm/armBitMapMarker.cpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file armBitMapMarker.cpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2015 Yasumasa Suenaga
+ * Copyright (C) 2015-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -26,7 +26,7 @@
  * \brief Mark GC-marked address in this bitmap.
  * \param addr [in] Oop address.
  */
-void TARMBitMapMarker::setMark(void *addr) {
+void TARMBitMapMarker::setMark(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return;
@@ -60,7 +60,7 @@
  * \param addr [in] Oop address.
  * \return Designated pointer is marked.
  */
-bool TARMBitMapMarker::checkAndMark(void *addr) {
+bool TARMBitMapMarker::checkAndMark(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return false;
--- a/agent/src/heapstats-engines/arch/arm/armBitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/arm/armBitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file armBitMapMarker.hpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2015 Yasumasa Suenaga
+ * Copyright (C) 2015-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -36,7 +36,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TARMBitMapMarker(void *startAddr, size_t size)
+  TARMBitMapMarker(const void *startAddr, const size_t size)
       : TBitMapMarker(startAddr, size){};
 
   /*!
@@ -48,14 +48,14 @@
    * \brief Mark GC-marked address in this bitmap.
    * \param addr [in] Oop address.
    */
-  virtual void setMark(void *addr);
+  virtual void setMark(const void *addr);
 
   /*!
    * \brief Check address which is already marked and set mark.
    * \param addr [in] Oop address.
    * \return Designated pointer is marked.
    */
-  virtual bool checkAndMark(void *addr);
+  virtual bool checkAndMark(const void *addr);
 };
 
 #endif  // ARMBITMAPMARKER_HPP
--- a/agent/src/heapstats-engines/arch/arm/neon/neonBitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/arm/neon/neonBitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -2,7 +2,7 @@
  * \file neonBitMapMarker.hpp
  * \brief Storeing and Controlling G1 marking bitmap.
  *        This source is optimized for NEON instruction set.
- * Copyright (C) 2015 Yasumasa Suenaga
+ * Copyright (C) 2015-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -35,7 +35,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TNeonBitMapMarker(void *startAddr, size_t size)
+  TNeonBitMapMarker(const void *startAddr, const size_t size)
       : TARMBitMapMarker(startAddr, size){};
 
   /*!
--- a/agent/src/heapstats-engines/arch/x86/avx/avxBitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/x86/avx/avxBitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -2,7 +2,7 @@
  * \file avxBitMapMarker.hpp
  * \brief Storeing and Controlling G1 marking bitmap.
  *        This source is optimized for AVX instruction set.
- * Copyright (C) 2014 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -35,7 +35,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TAVXBitMapMarker(void *startAddr, size_t size)
+  TAVXBitMapMarker(const void *startAddr, const size_t size)
       : TSSE2BitMapMarker(startAddr, size){};
 
   /*!
--- a/agent/src/heapstats-engines/arch/x86/sse2/sse2BitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/x86/sse2/sse2BitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -2,7 +2,7 @@
  * \file sse2BitMapMarker.hpp
  * \brief Storeing and Controlling G1 marking bitmap.
  *        This source is optimized for SSE2 instruction set.
- * Copyright (C) 2014 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -35,7 +35,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TSSE2BitMapMarker(void *startAddr, size_t size)
+  TSSE2BitMapMarker(const void *startAddr, const size_t size)
       : TX86BitMapMarker(startAddr, size){};
 
   /*!
--- a/agent/src/heapstats-engines/arch/x86/x86BitMapMarker.cpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/x86/x86BitMapMarker.cpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file x86BitMapMarker.cpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2014 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -26,7 +26,7 @@
  * \brief Mark GC-marked address in this bitmap.
  * \param addr [in] Oop address.
  */
-void TX86BitMapMarker::setMark(void *addr) {
+void TX86BitMapMarker::setMark(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return;
@@ -60,7 +60,7 @@
  * \param addr [in] Targer pointer.
  * \return Designated pointer is marked.
  */
-bool TX86BitMapMarker::isMarked(void *addr) {
+bool TX86BitMapMarker::isMarked(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return false;
@@ -99,7 +99,7 @@
  * \param addr [in] Oop address.
  * \return Designated pointer is marked.
  */
-bool TX86BitMapMarker::checkAndMark(void *addr) {
+bool TX86BitMapMarker::checkAndMark(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return false;
--- a/agent/src/heapstats-engines/arch/x86/x86BitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/arch/x86/x86BitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file x86BitMapMarker.hpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2014-2015 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -34,7 +34,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TX86BitMapMarker(void *startAddr, size_t size)
+  TX86BitMapMarker(const void *startAddr, const size_t size)
       : TBitMapMarker(startAddr, size){};
 
   /*!
@@ -46,21 +46,21 @@
    * \brief Mark GC-marked address in this bitmap.
    * \param addr [in] Oop address.
    */
-  virtual void setMark(void *addr);
+  virtual void setMark(const void *addr);
 
   /*!
    * \brief Get marked flag of designated pointer.
    * \param addr [in] Targer pointer.
    * \return Designated pointer is marked.
    */
-  virtual bool isMarked(void *addr);
+  virtual bool isMarked(const void *addr);
 
   /*!
    * \brief Check address which is already marked and set mark.
    * \param addr [in] Oop address.
    * \return Designated pointer is marked.
    */
-  virtual bool checkAndMark(void *addr);
+  virtual bool checkAndMark(const void *addr);
 };
 
 #endif  // X86BITMAPMARKER_HPP
--- a/agent/src/heapstats-engines/bitMapMarker.cpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/bitMapMarker.cpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file bitMapMarker.cpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2016 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -30,7 +30,7 @@
  * \param startAddr [in] Start address of Java heap.
  * \param size      [in] Max Java heap size.
  */
-TBitMapMarker::TBitMapMarker(void *startAddr, size_t size) {
+TBitMapMarker::TBitMapMarker(const void *startAddr, const size_t size) {
   /* Sanity check. */
   if (unlikely(startAddr == NULL || size <= 0)) {
     throw - 1;
@@ -39,7 +39,7 @@
   /* Initialize setting. */
   size_t alignedSize = ALIGN_SIZE_UP(size, systemPageSize);
 
-  this->beginAddr = startAddr;
+  this->beginAddr = const_cast<void *>(startAddr);
   this->endAddr = incAddress(this->beginAddr, alignedSize);
   this->bitmapSize = ALIGN_SIZE_UP(alignedSize >> MEMALIGN_BIT, systemPageSize);
   this->bitmapAddr = mmap(NULL, this->bitmapSize, PROT_READ | PROT_WRITE,
@@ -70,7 +70,7 @@
  * \param addr [in] Targer pointer.
  * \return Designated pointer is marked.
  */
-bool TBitMapMarker::isMarked(void *addr) {
+bool TBitMapMarker::isMarked(const void *addr) {
   /* Sanity check. */
   if (unlikely(!this->isInZone(addr))) {
     return false;
--- a/agent/src/heapstats-engines/bitMapMarker.hpp	Thu Jun 02 22:23:04 2016 +0900
+++ b/agent/src/heapstats-engines/bitMapMarker.hpp	Thu Jun 02 22:23:18 2016 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file bitMapMarker.hpp
  * \brief This file is used to store and control of bit map.
- * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation
+ * Copyright (C) 2011-2016 Nippon Telegraph and Telephone Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -80,7 +80,7 @@
    * \param startAddr [in] Start address of Java heap.
    * \param size      [in] Max Java heap size.
    */
-  TBitMapMarker(void *startAddr, size_t size);
+  TBitMapMarker(const void *startAddr, const size_t size);
   /*!
    * \brief TBitMapMarker destructor.
    */
@@ -91,7 +91,7 @@
    * \param addr [in] Oop address.
    * \return Designated pointer is existing in bitmap.
    */
-  inline bool isInZone(void *addr) {
+  inline bool isInZone(const void *addr) {
     return (this->beginAddr <= addr) && (this->endAddr >= addr);
   }
 
@@ -99,21 +99,21 @@
    * \brief Mark GC-marked address in this bitmap.
    * \param addr [in] Oop address.
    */
-  virtual void setMark(void *addr) = 0;
+  virtual void setMark(const void *addr) = 0;
 
   /*!
    * \brief Get marked flag of designated pointer.
    * \param addr [in] Targer pointer.
    * \return Designated pointer is marked.
    */
-  virtual bool isMarked(void *addr);
+  virtual bool isMarked(const void *addr);
 
   /*!
    * \brief Check address which is already marked and set mark.
    * \param addr [in] Oop address.
    * \return Designated pointer is marked.
    */
-  virtual bool checkAndMark(void *addr) = 0;
+  virtual bool checkAndMark(const void *addr) = 0;
 
   /*!
    * \brief Clear bitmap flag.
@@ -138,7 +138,8 @@
    *                    The bit flag is expressing target pointer.
    * \param mask  [out] A bitmask for getting only flag of target pointer.
    */
-  inline void getBlockAndMask(void *addr, ptrdiff_t **block, ptrdiff_t *mask) {
+  inline void getBlockAndMask(const void *addr,
+                              ptrdiff_t **block, ptrdiff_t *mask) {
     /*
      * Calculate bitmap offset.
      * offset = (address offset from top of JavaHeap) / (pointer size)