< prev index next >

src/share/vm/prims/jvmtiEnter.xsl

Print this page




 477   <xsl:text>  return JVMTI_ERROR_NOT_AVAILABLE; &#xA;</xsl:text>
 478   <xsl:text>#else &#xA;</xsl:text>
 479   </xsl:if>
 480 
 481   <xsl:apply-templates select="." mode="traceSetUp"/>
 482   <xsl:choose>
 483     <xsl:when test="count(@phase)=0 or contains(@phase,'live')">
 484       <xsl:text>  if(!JvmtiEnv::is_vm_live()) {
 485 </xsl:text>
 486     <xsl:if test="$trace='Trace'">
 487       <xsl:text>    if (trace_flags) {
 488           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 489                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 490     }
 491 </xsl:text>
 492     </xsl:if>
 493     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 494   }</xsl:text>  
 495 
 496       <xsl:text>  
 497   Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
 498 
 499       <xsl:apply-templates select="." mode="transition"/>
 500     </xsl:when>
 501     <xsl:otherwise>
 502       <xsl:if test="contains(@phase,'onload')">
 503         <xsl:text>  if(JvmtiEnv::get_phase()!=JVMTI_PHASE_ONLOAD</xsl:text>
 504         <xsl:if test="not(contains(@phase,'onloadOnly'))">
 505           <xsl:text> &amp;&amp; JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE</xsl:text>
 506         </xsl:if>
 507         <xsl:text>) {
 508 </xsl:text>
 509     <xsl:if test="$trace='Trace'">
 510       <xsl:text>    if (trace_flags) {
 511           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 512                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 513     }
 514 </xsl:text>
 515     </xsl:if>
 516     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 517   }</xsl:text>
 518       </xsl:if>
 519       <xsl:if test="contains(@phase,'start')">
 520         <xsl:text>  if(JvmtiEnv::get_phase()!=JVMTI_PHASE_START &amp;&amp; JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE) {
 521 </xsl:text>
 522     <xsl:if test="$trace='Trace'">
 523       <xsl:text>    if (trace_flags) {
 524           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 525                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 526     }
 527 </xsl:text>
 528     </xsl:if>
 529     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 530   }
 531   Thread* this_thread = (Thread*)ThreadLocalStorage::thread(); </xsl:text>
 532       <xsl:apply-templates select="." mode="transition"/>
 533       </xsl:if>
 534     </xsl:otherwise>
 535   </xsl:choose>
 536 
 537   <xsl:text>
 538   JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env);
 539   if (!jvmti_env->is_valid()) {
 540 </xsl:text>
 541     <xsl:if test="$trace='Trace'">
 542       <xsl:text>    if (trace_flags) {
 543           tty->print_cr("JVMTI [%s] %s %s  env=" PTR_FORMAT,  curr_thread_name, func_name, 
 544                     JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env));
 545     }
 546 </xsl:text>
 547     </xsl:if>
 548     <xsl:text>    return JVMTI_ERROR_INVALID_ENVIRONMENT;
 549   }
 550 </xsl:text>
 551 
 552   <xsl:apply-templates select="capabilities/required"/>
 553   
 554   <xsl:text>  jvmtiError err;
 555 </xsl:text>
 556   <xsl:choose>
 557     <xsl:when test="count(@phase)=1 and not(contains(@phase,'live')) and not(contains(@phase,'start'))">    
 558       <xsl:choose>
 559         <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
 560           <xsl:text>  if (Threads::number_of_threads() != 0) {
 561     Thread* this_thread = (Thread*)ThreadLocalStorage::thread();</xsl:text>
 562         </xsl:when>
 563         <xsl:otherwise>
 564 
 565           <xsl:text>  Thread* this_thread = NULL;
 566   bool transition;
 567   if (Threads::number_of_threads() == 0) {
 568     transition = false;
 569   } else {
 570     this_thread = (Thread*)ThreadLocalStorage::thread();
 571     transition = ((this_thread != NULL) &amp;&amp; !this_thread->is_VM_thread() &amp;&amp; !this_thread->is_ConcurrentGC_thread());
 572   }
 573   if (transition) {</xsl:text>
 574         </xsl:otherwise>
 575 
 576       </xsl:choose>
 577       <!-- we allow use in early phases but there are threads now, -->
 578       <!-- so do thread transition -->
 579       <xsl:apply-templates select="." mode="transition">
 580           <xsl:with-param name="space">
 581             <xsl:text>
 582     </xsl:text>
 583           </xsl:with-param>
 584       </xsl:apply-templates>
 585       <xsl:text>
 586   </xsl:text>
 587       <xsl:apply-templates select="." mode="doCall"/>     
 588       <xsl:text>  } else {
 589   </xsl:text>
 590       <!-- we are pre-thread - no thread transition code -->




 477   <xsl:text>  return JVMTI_ERROR_NOT_AVAILABLE; &#xA;</xsl:text>
 478   <xsl:text>#else &#xA;</xsl:text>
 479   </xsl:if>
 480 
 481   <xsl:apply-templates select="." mode="traceSetUp"/>
 482   <xsl:choose>
 483     <xsl:when test="count(@phase)=0 or contains(@phase,'live')">
 484       <xsl:text>  if(!JvmtiEnv::is_vm_live()) {
 485 </xsl:text>
 486     <xsl:if test="$trace='Trace'">
 487       <xsl:text>    if (trace_flags) {
 488           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 489                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 490     }
 491 </xsl:text>
 492     </xsl:if>
 493     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 494   }</xsl:text>  
 495 
 496       <xsl:text>  
 497   Thread* this_thread = Thread::current_or_null(); </xsl:text>
 498 
 499       <xsl:apply-templates select="." mode="transition"/>
 500     </xsl:when>
 501     <xsl:otherwise>
 502       <xsl:if test="contains(@phase,'onload')">
 503         <xsl:text>  if(JvmtiEnv::get_phase()!=JVMTI_PHASE_ONLOAD</xsl:text>
 504         <xsl:if test="not(contains(@phase,'onloadOnly'))">
 505           <xsl:text> &amp;&amp; JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE</xsl:text>
 506         </xsl:if>
 507         <xsl:text>) {
 508 </xsl:text>
 509     <xsl:if test="$trace='Trace'">
 510       <xsl:text>    if (trace_flags) {
 511           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 512                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 513     }
 514 </xsl:text>
 515     </xsl:if>
 516     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 517   }</xsl:text>
 518       </xsl:if>
 519       <xsl:if test="contains(@phase,'start')">
 520         <xsl:text>  if(JvmtiEnv::get_phase()!=JVMTI_PHASE_START &amp;&amp; JvmtiEnv::get_phase()!=JVMTI_PHASE_LIVE) {
 521 </xsl:text>
 522     <xsl:if test="$trace='Trace'">
 523       <xsl:text>    if (trace_flags) {
 524           tty->print_cr("JVMTI [-] %s %s",  func_name, 
 525                     JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE));
 526     }
 527 </xsl:text>
 528     </xsl:if>
 529     <xsl:text>    return JVMTI_ERROR_WRONG_PHASE;
 530   }
 531   Thread* this_thread = Thread::current_or_null(); </xsl:text>
 532       <xsl:apply-templates select="." mode="transition"/>
 533       </xsl:if>
 534     </xsl:otherwise>
 535   </xsl:choose>
 536 
 537   <xsl:text>
 538   JvmtiEnv* jvmti_env = JvmtiEnv::JvmtiEnv_from_jvmti_env(env);
 539   if (!jvmti_env->is_valid()) {
 540 </xsl:text>
 541     <xsl:if test="$trace='Trace'">
 542       <xsl:text>    if (trace_flags) {
 543           tty->print_cr("JVMTI [%s] %s %s  env=" PTR_FORMAT,  curr_thread_name, func_name, 
 544                     JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env));
 545     }
 546 </xsl:text>
 547     </xsl:if>
 548     <xsl:text>    return JVMTI_ERROR_INVALID_ENVIRONMENT;
 549   }
 550 </xsl:text>
 551 
 552   <xsl:apply-templates select="capabilities/required"/>
 553   
 554   <xsl:text>  jvmtiError err;
 555 </xsl:text>
 556   <xsl:choose>
 557     <xsl:when test="count(@phase)=1 and not(contains(@phase,'live')) and not(contains(@phase,'start'))">    
 558       <xsl:choose>
 559         <xsl:when test="count(@callbacksafe)=0 or not(contains(@callbacksafe,'safe'))">
 560           <xsl:text>  if (Threads::number_of_threads() != 0) {
 561     Thread* this_thread = Thread::current_or_null();</xsl:text>
 562         </xsl:when>
 563         <xsl:otherwise>
 564 
 565           <xsl:text>  Thread* this_thread = NULL;
 566   bool transition;
 567   if (Threads::number_of_threads() == 0) {
 568     transition = false;
 569   } else {
 570     this_thread = Thread::current_or_null();
 571     transition = ((this_thread != NULL) &amp;&amp; !this_thread->is_VM_thread() &amp;&amp; !this_thread->is_ConcurrentGC_thread());
 572   }
 573   if (transition) {</xsl:text>
 574         </xsl:otherwise>
 575 
 576       </xsl:choose>
 577       <!-- we allow use in early phases but there are threads now, -->
 578       <!-- so do thread transition -->
 579       <xsl:apply-templates select="." mode="transition">
 580           <xsl:with-param name="space">
 581             <xsl:text>
 582     </xsl:text>
 583           </xsl:with-param>
 584       </xsl:apply-templates>
 585       <xsl:text>
 586   </xsl:text>
 587       <xsl:apply-templates select="." mode="doCall"/>     
 588       <xsl:text>  } else {
 589   </xsl:text>
 590       <!-- we are pre-thread - no thread transition code -->


< prev index next >