Index: trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 105997)
+++ trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 105998)
@@ -2096,4 +2096,5 @@
     pReNative->Core.u64ArgVars             = UINT64_MAX;
 
+    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 23);
     pReNative->aidxUniqueLabels[0]         = UINT32_MAX;
     pReNative->aidxUniqueLabels[1]         = UINT32_MAX;
@@ -2119,10 +2120,4 @@
     pReNative->aidxUniqueLabels[21]        = UINT32_MAX;
     pReNative->aidxUniqueLabels[22]        = UINT32_MAX;
-#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
-    pReNative->aidxUniqueLabels[23]        = UINT32_MAX;
-    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 24);
-#else
-    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 23);
-#endif
 
     pReNative->idxLastCheckIrqCallNo       = UINT32_MAX;
@@ -8953,7 +8948,8 @@
         STR_CASE_CMN(NeedCsLimChecking);
         STR_CASE_CMN(CheckBranchMiss);
+#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
+        STR_CASE_CMN(ReturnSuccess);
+#else
         STR_CASE_CMN(Return);
-#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
-        STR_CASE_CMN(ReturnZero);
 #endif
         STR_CASE_CMN(ReturnBreak);
@@ -9792,8 +9788,7 @@
          * Emit the epilog code.
          */
-        aoffLabels[kIemNativeLabelType_ReturnZero] = off;
+        aoffLabels[kIemNativeLabelType_ReturnSuccess] = off;
         off = iemNativeEmitGprZero(pReNative, off, IEMNATIVE_CALL_RET_GREG);
-
-        aoffLabels[kIemNativeLabelType_Return] = off;
+        uint32_t const offReturnWithStatus = off;
         off = iemNativeEmitCoreEpilog(pReNative, off);
 
@@ -9883,9 +9878,16 @@
             off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)s_aSimpleTailLabels[i].pfnCallback);
 
-            /* jump back to the return sequence / generate a return sequence. */
-            if (!s_aSimpleTailLabels[i].fWithEpilog)
-                off = iemNativeEmitJmpToFixed(pReNative, off, aoffLabels[kIemNativeLabelType_Return]);
+            /* If the callback is supposed to return with a status code we inline the epilog
+               sequence for better speed.  Otherwise, if the callback shouldn't return because
+               it throws/longjmps, we just jump to the return sequence to be on the safe side.  */
+            if (s_aSimpleTailLabels[i].fWithEpilog)
+                off = iemNativeEmitCoreEpilog(pReNative, off);
             else
-                off = iemNativeEmitCoreEpilog(pReNative, off);
+            {
+# ifdef VBOX_STRICT
+                off = iemNativeEmitBrk(pReNative, off, 0x2201);
+# endif
+                off = iemNativeEmitJmpToFixed(pReNative, off, offReturnWithStatus);
+            }
         }
 
@@ -9894,5 +9896,5 @@
         /* Make sure we've generate code for all labels. */
         for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(aoffLabels); i++)
-            Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnZero);
+            Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnSuccess);
 # endif
     }
@@ -9933,5 +9935,5 @@
     for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(pCtx->apExitLabels); i++)
     {
-        Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnZero);
+        Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnSuccess);
         pCtx->apExitLabels[i] = &paFinalCommonCodeRx[aoffLabels[i]];
         Log10(("    apExitLabels[%u]=%p %s\n", i, pCtx->apExitLabels[i], iemNativeGetLabelName((IEMNATIVELABELTYPE)i, true)));
@@ -10207,5 +10209,5 @@
          */
         //off = iemNativeEmitBrk(pReNative, off, 0x1227);
-        off = iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnZero);
+        off = iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnSuccess);
 #endif
 
@@ -10298,5 +10300,6 @@
          */
 # ifndef RT_ARCH_AMD64
-        Assert(!(pReNative->bmLabelTypes & (RT_BIT_64(kIemNativeLabelType_Return) | RT_BIT_64(kIemNativeLabelType_Invalid))));
+        Assert(!(pReNative->bmLabelTypes & (  RT_BIT_64(kIemNativeLabelType_ReturnSuccess)
+                                            | RT_BIT_64(kIemNativeLabelType_Invalid) )));
         AssertCompile(kIemNativeLabelType_Invalid == 0);
         uint64_t fTailLabels = pReNative->bmLabelTypes & (RT_BIT_64(kIemNativeLabelType_LastTbExit + 1U) - 2U);
Index: trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
===================================================================
--- trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 105997)
+++ trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 105998)
@@ -502,13 +502,22 @@
     kIemNativeLabelType_NonZeroRetOrPassUp,
 #ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
-    kIemNativeLabelType_ReturnZero,             /**< Sets eax/w0 to zero and returns. */
-#endif
+    kIemNativeLabelType_ReturnSuccess,          /**< Sets eax/w0 to zero and returns. */
+#else
     kIemNativeLabelType_Return,
+#endif
     /** The last fixup for branches that can span almost the whole TB length.
      * @note Whether kIemNativeLabelType_Return needs to be one of these is
      *       a bit questionable, since nobody jumps to it except other tail code. */
+#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
+    kIemNativeLabelType_LastWholeTbBranch = kIemNativeLabelType_ReturnSuccess,
+#else
     kIemNativeLabelType_LastWholeTbBranch = kIemNativeLabelType_Return,
+#endif
     /** The last fixup for branches that exits the TB. */
+#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
+    kIemNativeLabelType_LastTbExit        = kIemNativeLabelType_ReturnSuccess,
+#else
     kIemNativeLabelType_LastTbExit        = kIemNativeLabelType_Return,
+#endif
 
     /** Loop-jump target. */
