< prev index next >

src/hotspot/share/prims/jvmtiEnter.xsl

Print this page
rev 47794 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47796 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp


  28 <xsl:import href="jvmtiLib.xsl"/>
  29 
  30 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
  31 
  32 <xsl:param name="trace"></xsl:param>
  33 <xsl:param name="interface"></xsl:param>
  34 
  35 
  36 <xsl:template match="specification">
  37   <xsl:call-template name="sourceHeader"/>
  38   <xsl:text>
  39 # include "precompiled.hpp"
  40 # include "memory/resourceArea.hpp"
  41 # include "utilities/macros.hpp"
  42 #if INCLUDE_JVMTI
  43 # include "logging/log.hpp"
  44 # include "oops/oop.inline.hpp"
  45 # include "prims/jvmtiEnter.hpp"
  46 # include "prims/jvmtiRawMonitor.hpp"
  47 # include "prims/jvmtiUtil.hpp"

  48 
  49 </xsl:text>
  50 
  51   <xsl:if test="$trace = 'Trace'">
  52    <xsl:text>
  53 #ifdef JVMTI_TRACE
  54 </xsl:text>
  55   </xsl:if>
  56 
  57  <xsl:if test="$trace != 'Trace'">
  58     <xsl:text>
  59 
  60 // Error names
  61 const char* JvmtiUtil::_error_names[] = {
  62 </xsl:text>
  63     <xsl:call-template name="fillEntityName"> 
  64       <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
  65     </xsl:call-template>
  66     <xsl:text>
  67 };


 752     <xsl:apply-templates select=".." mode="traceError">     
 753       <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
 754       <xsl:with-param name="comment"> - raw monitor is NULL</xsl:with-param>
 755     </xsl:apply-templates>
 756     <xsl:text>
 757   }
 758   if (!rmonitor->is_valid()) {
 759 </xsl:text>
 760     <xsl:apply-templates select=".." mode="traceError">     
 761       <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
 762       <xsl:with-param name="comment"> - not a raw monitor " PTR_FORMAT "</xsl:with-param>
 763       <xsl:with-param name="extraValue">, p2i(rmonitor)</xsl:with-param>
 764     </xsl:apply-templates>
 765     <xsl:text>
 766   }
 767 </xsl:text>
 768 </xsl:template>
 769 
 770 <xsl:template match="jthread" mode="dochecksbody">
 771   <xsl:param name="name"/>
 772     <xsl:text>    oop thread_oop = JNIHandles::resolve_external_guard(</xsl:text>
 773     <xsl:value-of select="$name"/>
 774     <xsl:text>);
 775     if (thread_oop == NULL) {
 776 </xsl:text>
 777     <xsl:apply-templates select=".." mode="traceError">     
 778       <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
 779       <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = " PTR_FORMAT "</xsl:with-param>
 780       <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
 781     </xsl:apply-templates>
 782     <xsl:text>
 783     }
 784     if (!thread_oop-&gt;is_a(SystemDictionary::Thread_klass())) {
 785 </xsl:text>
 786     <xsl:apply-templates select=".." mode="traceError">     
 787       <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param>
 788       <xsl:with-param name="comment"> - oop is not a thread - jthread = " PTR_FORMAT "</xsl:with-param>
 789       <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
 790     </xsl:apply-templates>
 791     <xsl:text>
 792     }
 793     java_thread = java_lang_Thread::thread(thread_oop); 
 794     if (java_thread == NULL) {
 795 </xsl:text>
 796     <xsl:apply-templates select=".." mode="traceError">     
 797       <xsl:with-param name="err">
 798         <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text>
 799       </xsl:with-param>
 800       <xsl:with-param name="comment"> - not a Java thread - jthread = " PTR_FORMAT "</xsl:with-param>
 801       <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
 802     </xsl:apply-templates>
 803     <xsl:text>
 804     }
 805 </xsl:text>  
 806 </xsl:template>
 807 
 808 <xsl:template match="jthread" mode="dochecks">
 809   <xsl:param name="name"/>
 810   <!-- If we convert and test threads -->
 811   <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
 812     <xsl:text>  JavaThread* java_thread;

 813 </xsl:text>
 814     <xsl:choose>
 815       <xsl:when test="count(@null)=0">
 816         <xsl:apply-templates select="." mode="dochecksbody">
 817           <xsl:with-param name="name" select="$name"/>
 818         </xsl:apply-templates>
 819       </xsl:when>
 820       <xsl:otherwise>
 821         <xsl:text>  if (</xsl:text>
 822         <xsl:value-of select="$name"/>
 823         <xsl:text> == NULL) {
 824     java_thread = current_thread;
 825   } else {
 826 </xsl:text>
 827         <xsl:apply-templates select="." mode="dochecksbody">
 828           <xsl:with-param name="name" select="$name"/>
 829         </xsl:apply-templates>
 830         <xsl:text>  }
 831 </xsl:text>
 832       </xsl:otherwise>




  28 <xsl:import href="jvmtiLib.xsl"/>
  29 
  30 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
  31 
  32 <xsl:param name="trace"></xsl:param>
  33 <xsl:param name="interface"></xsl:param>
  34 
  35 
  36 <xsl:template match="specification">
  37   <xsl:call-template name="sourceHeader"/>
  38   <xsl:text>
  39 # include "precompiled.hpp"
  40 # include "memory/resourceArea.hpp"
  41 # include "utilities/macros.hpp"
  42 #if INCLUDE_JVMTI
  43 # include "logging/log.hpp"
  44 # include "oops/oop.inline.hpp"
  45 # include "prims/jvmtiEnter.hpp"
  46 # include "prims/jvmtiRawMonitor.hpp"
  47 # include "prims/jvmtiUtil.hpp"
  48 # include "runtime/threadSMR.hpp"
  49 
  50 </xsl:text>
  51 
  52   <xsl:if test="$trace = 'Trace'">
  53    <xsl:text>
  54 #ifdef JVMTI_TRACE
  55 </xsl:text>
  56   </xsl:if>
  57 
  58  <xsl:if test="$trace != 'Trace'">
  59     <xsl:text>
  60 
  61 // Error names
  62 const char* JvmtiUtil::_error_names[] = {
  63 </xsl:text>
  64     <xsl:call-template name="fillEntityName"> 
  65       <xsl:with-param name="entities" select="errorsection/errorcategory/errorid"/>
  66     </xsl:call-template>
  67     <xsl:text>
  68 };


 753     <xsl:apply-templates select=".." mode="traceError">     
 754       <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
 755       <xsl:with-param name="comment"> - raw monitor is NULL</xsl:with-param>
 756     </xsl:apply-templates>
 757     <xsl:text>
 758   }
 759   if (!rmonitor->is_valid()) {
 760 </xsl:text>
 761     <xsl:apply-templates select=".." mode="traceError">     
 762       <xsl:with-param name="err">JVMTI_ERROR_INVALID_MONITOR</xsl:with-param>
 763       <xsl:with-param name="comment"> - not a raw monitor " PTR_FORMAT "</xsl:with-param>
 764       <xsl:with-param name="extraValue">, p2i(rmonitor)</xsl:with-param>
 765     </xsl:apply-templates>
 766     <xsl:text>
 767   }
 768 </xsl:text>
 769 </xsl:template>
 770 
 771 <xsl:template match="jthread" mode="dochecksbody">
 772   <xsl:param name="name"/>
 773     <xsl:text>    err = JvmtiExport::cv_external_thread_to_JavaThread(tlh.list(), </xsl:text>
 774     <xsl:value-of select="$name"/>
 775     <xsl:text>, &amp;java_thread, NULL);
 776     if (err != JVMTI_ERROR_NONE) {
 777 </xsl:text>
 778     <xsl:apply-templates select=".." mode="traceError">     
 779       <xsl:with-param name="err">err</xsl:with-param>
 780       <xsl:with-param name="comment"> - jthread did not convert to a JavaThread - jthread = " PTR_FORMAT "</xsl:with-param>
 781       <xsl:with-param name="extraValue">, p2i(<xsl:value-of select="$name"/>)</xsl:with-param>
 782     </xsl:apply-templates>
 783     <xsl:text>
 784     }

 785 </xsl:text>




















 786 </xsl:template>
 787 
 788 <xsl:template match="jthread" mode="dochecks">
 789   <xsl:param name="name"/>
 790   <!-- If we convert and test threads -->
 791   <xsl:if test="count(@impl)=0 or not(contains(@impl,'noconvert'))">
 792     <xsl:text>  JavaThread* java_thread = NULL;
 793   ThreadsListHandle tlh(this_thread);
 794 </xsl:text>
 795     <xsl:choose>
 796       <xsl:when test="count(@null)=0">
 797         <xsl:apply-templates select="." mode="dochecksbody">
 798           <xsl:with-param name="name" select="$name"/>
 799         </xsl:apply-templates>
 800       </xsl:when>
 801       <xsl:otherwise>
 802         <xsl:text>  if (</xsl:text>
 803         <xsl:value-of select="$name"/>
 804         <xsl:text> == NULL) {
 805     java_thread = current_thread;
 806   } else {
 807 </xsl:text>
 808         <xsl:apply-templates select="." mode="dochecksbody">
 809           <xsl:with-param name="name" select="$name"/>
 810         </xsl:apply-templates>
 811         <xsl:text>  }
 812 </xsl:text>
 813       </xsl:otherwise>


< prev index next >