CINXE.COM
Changeset 106313 – Oracle VirtualBox
<!DOCTYPE html> <html lang="en-US"> <head> <!-- # block head (placeholder in theme.html) --> <!-- # block head (content inherited from layout.html) --> <title> Changeset 106313 – Oracle VirtualBox </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!--[if IE]><script> if (/^#__msie303:/.test(window.location.hash)) window.location.replace(window.location.hash.replace(/^#__msie303:/, '#')); </script><![endif]--> <link rel="search" href="/search" /> <link rel="prev" href="/changeset/106312/vbox" title="Changeset 106312" /> <link rel="last" href="/changeset/108198/vbox" title="Changeset 108198" /> <link rel="help" href="/wiki/TracGuide" /> <link rel="alternate" class="diff" href="?format=diff&new=106313" title="Unified Diff" type="text/plain" /> <link rel="alternate" class="zip" href="?format=zip&new=106313" title="Zip Archive" type="application/zip" /> <link rel="next" href="/changeset/106314/vbox" title="Changeset 106314" /> <link rel="start" href="/wiki" /> <link rel="stylesheet" href="/chrome/common/css/trac.css" type="text/css" /> <link rel="stylesheet" href="/chrome/common/css/changeset.css" type="text/css" /> <link rel="stylesheet" href="/chrome/common/css/diff.css" type="text/css" /> <link rel="stylesheet" href="/chrome/common/css/code.css" type="text/css" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="first" href="/changeset/1/vbox" title="Changeset 1" /> <noscript> <style> .trac-noscript { display: none !important } </style> </noscript> <link type="application/opensearchdescription+xml" rel="search" href="/search/opensearch" title="Search Oracle VirtualBox"/> <script src="/chrome/common/js/jquery.js"></script> <script src="/chrome/common/js/jquery-migrate.js"></script> <script src="/chrome/common/js/babel.js"></script> <script src="/chrome/common/js/trac.js"></script> <script src="/chrome/common/js/search.js"></script> <script src="/chrome/common/js/folding.js"></script> <script src="/chrome/common/js/diff.js"></script> <script> jQuery(function($) { $(".trac-autofocus").focus(); $(".trac-target-new").attr("target", "_blank"); if ($.ui) { /* is jquery-ui added? */ $(".trac-datepicker:not([readonly])") .prop("autocomplete", "off").datepicker(); // Input current date when today is pressed. var _goToToday = $.datepicker._gotoToday; $.datepicker._gotoToday = function(id) { _goToToday.call(this, id); this._selectDate(id) }; $(".trac-datetimepicker:not([readonly])") .prop("autocomplete", "off").datetimepicker(); $("#main").addClass("trac-nodatetimehint"); } $(".trac-disable").disableSubmit(".trac-disable-determinant"); setTimeout(function() { $(".trac-scroll").scrollToTop() }, 1); $(".trac-disable-on-submit").disableOnSubmit(); }); </script> <!-- # include 'site_head.html' (layout.html) --> <link rel="stylesheet" type="text/css" href="/chrome/site/style.css"/> <script> jQuery(function($) { var $ntg = $("#newticketguide"); if ($ntg.length) $("#propertyform").prepend($ntg.detach()); }); </script> <script> jQuery(function($) { var $content = $("#content"); var $opener = $("#opener"); if ($("#opener").length) $content.toggleClass('narrow'); }); </script> <!-- end of site_head.html --> <!-- # endblock head (content inherited from layout.html) --> <script> jQuery(function($) { $(".trac-toggledeleted").show().click(function() { $(this).siblings().find(".trac-deleted").toggle(); return false; }).click(); $("#content").find("li.entry h2 a").parent() .addAnchor(_("Link to this diff")); }); </script> <!-- # endblock head (placeholder in theme.html) --> </head> <body> <!-- # block body (content inherited from theme.html) --> <!-- # include 'site_header.html' (theme.html) --> <!-- Add site-specific header --> <div id="vboxstring"> <img src="/graphics/vboxlogodown.png" alt="VirtualBox"/> </div> <div id="center"> <!-- end of site_header.html --> <div id="banner"> <form id="search" action="/search" method="get"> <div> <label for="proj-search">Search:</label> <input type="text" id="proj-search" name="q" size="18" value="" /> <input type="submit" value="Search" /> </div> </form> </div> <div id="mainnav" class="nav"> <ul><li class="active last first"><a href="/browser">Browse Source</a></li></ul> </div> <div id="main" > <div id="ctxtnav"> <li> <a id="logo" href="https://www.virtualbox.org/"><img alt="Oracle VirtualBox" src="/graphics/vbox-new-logo.png"></a> </li> <ul> <li><a href="https://www.virtualbox.org/">Home</a></li> <li><a href="/wiki/Downloads">Download</a></li> <li><a href="/wiki/Documentation">Documentation</a></li> <li><a href="/wiki/Community">Community</a></li> <li class="first"> <a id="profile" href="/login"><img src="/graphics/user.png" alt="User profile icon"></a> </li> <form style="text-align: right" action="/search" method="get"> <div> <input id="vboxsearch" type="text" name="q" size="10" accesskey="f" value="Search:" onblur="if(this.value=='') this.value='Search:';" onfocus="if(this.value=='Search:') this.value='';"> <input type="hidden" name="wiki" value="on"> <input type="hidden" name="changeset" value="on"> <input type="hidden" name="ticket" value="on"> </div> </form> </li> </ul> </div> <!-- # block content (placeholder in theme.html) --> <div id="content" class="changeset"> <div id="title"> <h1> Changeset 106313 in vbox </h1> </div> <form id="prefs" action="#"> <div> <label for="style">View differences</label> <select id="style" name="style"> <option selected="selected" value="inline">inline</option> <option value="sidebyside">side by side</option> </select> <div class="field"> <label> <input type="radio" name="contextall" value="0" checked="checked"/> Show</label> <label> <input type="text" name="contextlines" id="contextlines" size="2" maxlength="3" value="2"/> lines around each change</label> <br/> <label><input type="radio" name="contextall" value="1" /> Show the changes in full context</label> </div> <fieldset id="ignore"> <legend>Ignore:</legend> <div class="field"> <input type="checkbox" id="ignoreblanklines" name="ignoreblanklines" /> <label for="ignoreblanklines">Blank lines</label> </div> <div class="field"> <input type="checkbox" id="ignorecase" name="ignorecase" /> <label for="ignorecase">Case changes</label> </div> <div class="field"> <input type="checkbox" id="ignorewhitespace" name="ignorewhitespace" /> <label for="ignorewhitespace">White space changes</label> </div> </fieldset> <div class="buttons"> <input type="submit" name="update" value="Update" /> </div> </div> </form> <dl id="overview"> <dt class="property time">Timestamp:</dt> <dd class="time"> Oct 14, 2024 10:45:56 PM (<a class="timeline" href="/timeline?from=2024-10-14T22%3A45%3A56Z&precision=second" title="See timeline at Oct 14, 2024 10:45:56 PM">4 months</a> ago) </dd> <dt class="property author">Author:</dt> <dd class="author"><span class="trac-author">vboxsync</span></dd> <dt class="property message">Message:</dt> <dd class="message searchable"> <p> VMM/IEM: Back off earlier if chunks or the allocator is very full, don't waste time finding the last free location. Reduces the pointless full chunk bitmap search quite a bit. bugref:10720<br /> </p> </dd> <dt class="property location">Location:</dt> <dd class="searchable" ><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll?rev=106313">trunk/src/VBox/VMM/VMMAll</a></dd> <dt class="property files"> Files: </dt> <dd class="files"> <div class="legend" id="file-legend"> <dl> <dt class="mod"></dt><dd> 2 edited</dd> </dl> </div> <br /> <ul> <li> <div class="mod"> </div> <a title="Show entry in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313"> IEMAllN8veExecMem.cpp </a> <span class="comment">(modified)</span> (<a title="Show differences" href="#file0">10 diffs</a>) </li> <li> <div class="mod"> </div> <a title="Show entry in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp?rev=106313"> IEMAllThrdRecompiler.cpp </a> <span class="comment">(modified)</span> (<a title="Show differences" href="#file1">1 diff</a>) </li> </ul> </dd> </dl> <div class="diff"> <div class="legend" id="diff-legend"> <h3>Legend:</h3> <dl> <dt class="unmod"></dt><dd>Unmodified</dd> <dt class="add"></dt><dd>Added</dd> <dt class="rem"></dt><dd>Removed</dd> </dl> </div> <div class="diff"> <ul class="entries"> <li class="entry"> <h2 id="file0"> <a href="/changeset/106313/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp" title="Show the changeset 106313 restricted to trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp">trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="Revision 106310"> <a title="Show revision 106310 of this file in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L294" >r106310</a> </th> <th title="Revision 106313"> <a title="Show revision 106313 of this file in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L294" >r106313</a> </th> <td> </td> </tr> </thead> <tbody class="unmod"> <tr> <th>294</th><th>294</th><td class="l"><span> /** Total amount of memory not being usable currently due to IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SIZE. */</span></td> </tr> <tr> <th>295</th><th>295</th><td class="l"><span> uint64_t cbUnusable;</span></td> </tr> </tbody> <tbody class="add"> <tr class="first"> <th> </th><th>296</th><td class="r"><ins> /** Allocation size distribution (in alloc units; 0 is the slop bucket). */</ins></td> </tr> <tr class="last"> <th> </th><th>297</th><td class="r"><ins> STAMCOUNTER aStatSizes[16];</ins></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>296</th><th>298</th><td class="l"><span>#endif</span></td> </tr> <tr> <th>297</th><th>299</th><td class="l"><span></span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L501">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L503">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>501</th><th>503</th><td class="l"><span> *</span></td> </tr> <tr> <th>502</th><th>504</th><td class="l"><span> * The complicated code below is a bit faster on arm. Reducing the per TB cost</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>503</th><th> </th><td class="l"><span> * from 4255ns to 4106ns (best run out of 10). On win/<del>x86 the gain isn't so</del></span></td> </tr> <tr> <th>504</th><th> </th><td class="l"><span> * <del>marked, despite more full bitmap scans</del>.</span></td> </tr> <tr> <th> </th><th>505</th><td class="r"><span> * from 4255ns to 4106ns (best run out of 10). On win/<ins>amd64 there isn't an</ins></span></td> </tr> <tr class="last"> <th> </th><th>506</th><td class="r"><span> * <ins>obvious gain here, at least not with the data currently being profiled</ins>.</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>505</th><th>507</th><td class="l"><span> */</span></td> </tr> <tr> <th>506</th><th>508</th><td class="l"><span>#if 1</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L639">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L641">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>639</th><th>641</th><td class="l"><span> }</span></td> </tr> <tr> <th>640</th><th>642</th><td class="l"><span></span></td> </tr> </tbody> <tbody class="add"> <tr class="first"> <th> </th><th>643</th><td class="r"><ins> /*</ins></td> </tr> <tr class=""> <th> </th><th>644</th><td class="r"><ins> * If we get down here, we have a word that isn't UINT64_MAX.</ins></td> </tr> <tr class="last"> <th> </th><th>645</th><td class="r"><ins> */</ins></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>641</th><th>646</th><td class="l"><span> if (uWord != 0)</span></td> </tr> <tr> <th>642</th><th>647</th><td class="l"><span> {</span></td> </tr> <tr> <th>643</th><th>648</th><td class="l"><span> /*</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>644</th><th> </th><td class="l"><span> * Fend of large request we cannot satisfy before <del>firs</del>t.</span></td> </tr> <tr class="last"> <th> </th><th>649</th><td class="r"><span> * Fend of large request we cannot satisfy before <ins>the first set bi</ins>t.</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>645</th><th>650</th><td class="l"><span> */</span></td> </tr> <tr> <th>646</th><th>651</th><td class="l"><span> if (!a_fBig || cReqUnits < 64 + cPrevLeadingZeros)</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L648">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L653">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>648</th><th>653</th><td class="l"><span>#ifdef __GNUC__</span></td> </tr> <tr> <th>649</th><th>654</th><td class="l"><span> unsigned cZerosInWord = __builtin_popcountl(~uWord);</span></td> </tr> </tbody> <tbody class="add"> <tr class="first"> <th> </th><th>655</th><td class="r"><ins>#elif defined(_MSC_VER) && defined(RT_ARCH_AMD64)</ins></td> </tr> <tr class=""> <th> </th><th>656</th><td class="r"><ins> unsigned cZerosInWord = __popcnt64(~uWord);</ins></td> </tr> <tr class=""> <th> </th><th>657</th><td class="r"><ins>#elif defined(_MSC_VER) && defined(RT_ARCH_ARM64)</ins></td> </tr> <tr class="last"> <th> </th><th>658</th><td class="r"><ins> unsigned cZerosInWord = _CountOneBits64(~uWord);</ins></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>650</th><th>659</th><td class="l"><span>#else</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>651</th><th> </th><td class="l"><span># ifdef RT_ARCH_AMD64</span></td> </tr> <tr> <th>652</th><th> </th><td class="l"><span> unsigned cZerosInWord = __popcnt64(~uWord);</span></td> </tr> <tr> <th>653</th><th> </th><td class="l"><span># elif defined(RT_ARCH_ARM64)</span></td> </tr> <tr> <th>654</th><th> </th><td class="l"><span> unsigned cZerosInWord = _CountOneBits64(~uWord);</span></td> </tr> <tr> <th>655</th><th> </th><td class="l"><span># else</span></td> </tr> <tr> <th>656</th><th> </th><td class="l"><span># pragma message("need popcount intrinsic or something...") /** @todo port me: Win/ARM. */</span></td> </tr> <tr class="last"> <th> </th><th>660</th><td class="r"><span># pragma message("need popcount intrinsic or something...")</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>657</th><th>661</th><td class="l"><span> unsigned cZerosInWord = 0;</span></td> </tr> <tr> <th>658</th><th>662</th><td class="l"><span> for (uint64_t uTmp = ~uWords; uTmp; cZerosInWord++)</span></td> </tr> <tr> <th>659</th><th>663</th><td class="l"><span> uTmp &= uTmp - 1; /* Clears the least significant bit set. */</span></td> </tr> </tbody> <tbody class="rem"> <tr class="last first"> <th>660</th><th> </th><td class="l"><del># endif</del></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>661</th><th>664</th><td class="l"><span>#endif</span></td> </tr> <tr> <th>662</th><th>665</th><td class="l"><span> if (cZerosInWord + cPrevLeadingZeros >= cReqUnits)</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L737">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L740">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>737</th><th>740</th><td class="l"><span> if RT_CONSTEXPR_IF(!a_fBig)</span></td> </tr> <tr> <th>738</th><th>741</th><td class="l"><span> return off * 64 - cPrevLeadingZeros;</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>739</th><th> </th><td class="l"><span> else<del></del></span></td> </tr> <tr class="last"> <th> </th><th>742</th><td class="r"><span> else<ins> /* keep else */</ins></span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>740</th><th>743</th><td class="l"><span> {</span></td> </tr> <tr> <th>741</th><th>744</th><td class="l"><span> if (cPrevLeadingZeros + 64 >= cReqUnits)</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L890">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L893">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>890</th><th>893</th><td class="l"><span> RT_ALIGN_32(idxHint + cReqUnits, 64*4)),</span></td> </tr> <tr> <th>891</th><th>894</th><td class="l"><span> cReqUnits, idxChunk, pTb, (void **)ppaExec, ppChunkCtx);</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>892</th><th> </th><td class="l"><span> if (!pvRet)</span></td> </tr> <tr> <th>893</th><th> </th><td class="l"><span> pExecMemAllocator->cFruitlessChunkScans += 1;</span></td> </tr> <tr> <th>894</th><th> </th><td class="l"><span> return (PIEMNATIVEINSTR)pvRet;</span></td> </tr> <tr> <th>895</th><th> </th><td class="l"><span>}</span></td> </tr> <tr> <th>896</th><th> </th><td class="l"><span></span></td> </tr> <tr> <th>897</th><th> </th><td class="l"><span></span></td> </tr> <tr> <th>898</th><th> </th><td class="l"><span>DECL_FORCE_INLINE(PIEMNATIVEINSTR)</span></td> </tr> <tr> <th>899</th><th> </th><td class="l"><span>iemExecMemAllocatorAllocUnitsInChunk(PIEMEXECMEMALLOCATOR pExecMemAllocator, uint32_t idxChunk, uint32_t cReqUnits, PIEMTB pTb,</span></td> </tr> <tr> <th>900</th><th> </th><td class="l"><span> PIEMNATIVEINSTR *ppaExec, PCIEMNATIVEPERCHUNKCTX *ppChunkCtx)</span></td> </tr> <tr> <th>901</th><th> </th><td class="l"><span>{</span></td> </tr> <tr> <th>902</th><th> </th><td class="l"><span> if (cReqUnits <= pExecMemAllocator->aChunks[idxChunk].cFreeUnits)</span></td> </tr> <tr> <th>903</th><th> </th><td class="l"><span> return iemExecMemAllocatorAllocUnitsInChunkInner(pExecMemAllocator, idxChunk, cReqUnits, pTb, ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th> </th><th>895</th><td class="r"><span> if (pvRet)</span></td> </tr> <tr> <th> </th><th>896</th><td class="r"><span> return (PIEMNATIVEINSTR)pvRet;</span></td> </tr> <tr> <th> </th><th>897</th><td class="r"><span></span></td> </tr> <tr class="last"> <th> </th><th>898</th><td class="r"><span> pExecMemAllocator->cFruitlessChunkScans += 1;</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>904</th><th>899</th><td class="l"><span> return NULL;</span></td> </tr> <tr> <th>905</th><th>900</th><td class="l"><span>}</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L910">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L905">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>910</th><th>905</th><td class="l"><span> PIEMNATIVEINSTR *ppaExec)</span></td> </tr> <tr> <th>911</th><th>906</th><td class="l"><span>{</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>912</th><th> </th><td class="l"><span> return iemExecMemAllocatorAllocUnitsInChunk(pExecMemAllocator, idxChunk, iemExecMemAllocBytesToUnits(cbReq), NULL /*pTb*/,</span></td> </tr> <tr> <th>913</th><th> </th><td class="l"><span> ppaExec, NULL /*ppChunkCtx*/);</span></td> </tr> <tr> <th> </th><th>907</th><td class="r"><span> uint32_t const cReqUnits = iemExecMemAllocBytesToUnits(cbReq);</span></td> </tr> <tr> <th> </th><th>908</th><td class="r"><span> if (cReqUnits <= pExecMemAllocator->aChunks[idxChunk].cFreeUnits)</span></td> </tr> <tr> <th> </th><th>909</th><td class="r"><span> return iemExecMemAllocatorAllocUnitsInChunkInner(pExecMemAllocator, idxChunk, cReqUnits, NULL /*pTb*/,</span></td> </tr> <tr> <th> </th><th>910</th><td class="r"><span> ppaExec, NULL /*ppChunkCtx*/);</span></td> </tr> <tr class="last"> <th> </th><th>911</th><td class="r"><span> return NULL;</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>914</th><th>912</th><td class="l"><span>}</span></td> </tr> <tr> <th>915</th><th>913</th><td class="l"><span></span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L938">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L936">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>938</th><th>936</th><td class="l"><span></span></td> </tr> <tr> <th>939</th><th>937</th><td class="l"><span> uint32_t const cReqUnits = iemExecMemAllocBytesToUnits(cbReq);</span></td> </tr> </tbody> <tbody class="add"> <tr class="last first"> <th> </th><th>938</th><td class="r"><ins> STAM_COUNTER_INC(&pExecMemAllocator->aStatSizes[cReqUnits < RT_ELEMENTS(pExecMemAllocator->aStatSizes) ? cReqUnits : 0]);</ins></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>940</th><th>939</th><td class="l"><span> for (unsigned iIteration = 0;; iIteration++)</span></td> </tr> <tr> <th>941</th><th>940</th><td class="l"><span> {</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>942</th><th> </th><td class="l"><span> if (cbReq <= pExecMemAllocator->cbFree)</span></td> </tr> <tr> <th> </th><th>941</th><td class="r"><span> if ( cbReq * 2 <= pExecMemAllocator->cbFree</span></td> </tr> <tr class="last"> <th> </th><th>942</th><td class="r"><span> || (cReqUnits == 1 || pExecMemAllocator->cbFree >= IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SIZE) )</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>943</th><th>943</th><td class="l"><span> {</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>944</th><th> </th><td class="l"><span> uint32_t const cChunks = pExecMemAllocator->cChunks;</span></td> </tr> <tr> <th>945</th><th> </th><td class="l"><span> uint32_t const idxChunkHint = pExecMemAllocator->idxChunkHint < cChunks ? pExecMemAllocator->idxChunkHint : 0;</span></td> </tr> <tr> <th>946</th><th> </th><td class="l"><span> for (uint32_t idxChunk = idxChunkHint; idxChunk < cChunks; idxChunk++)</span></td> </tr> <tr> <th> </th><th>944</th><td class="r"><span> uint32_t const cChunks = pExecMemAllocator->cChunks;</span></td> </tr> <tr> <th> </th><th>945</th><td class="r"><span> uint32_t const idxChunkHint = pExecMemAllocator->idxChunkHint < cChunks ? pExecMemAllocator->idxChunkHint : 0;</span></td> </tr> <tr> <th> </th><th>946</th><td class="r"><span></span></td> </tr> <tr> <th> </th><th>947</th><td class="r"><span> /*</span></td> </tr> <tr> <th> </th><th>948</th><td class="r"><span> * We do two passes here, the first pass we skip chunks with fewer than cReqUnits * 16,</span></td> </tr> <tr> <th> </th><th>949</th><td class="r"><span> * the 2nd pass we skip chunks. The second pass checks the one skipped in the first pass.</span></td> </tr> <tr> <th> </th><th>950</th><td class="r"><span> */</span></td> </tr> <tr class="last"> <th> </th><th>951</th><td class="r"><span> for (uint32_t cMinFreePass = cReqUnits == 1 ? cReqUnits : cReqUnits * 16, cMaxFreePass = UINT32_MAX;;)</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>947</th><th>952</th><td class="l"><span> {</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>948</th><th> </th><td class="l"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunk(pExecMemAllocator, idxChunk, cReqUnits, pTb,</span></td> </tr> <tr> <th>949</th><th> </th><td class="l"><span> ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th>950</th><th> </th><td class="l"><span> if (pRet)</span></td> </tr> <tr> <th>951</th><th> </th><td class="l"><span> {</span></td> </tr> <tr> <th>952</th><th> </th><td class="l"><span> STAM_PROFILE_STOP(&pExecMemAllocator->StatAlloc, a);</span></td> </tr> <tr> <th> </th><th>953</th><td class="r"><span> for (uint32_t idxChunk = idxChunkHint; idxChunk < cChunks; idxChunk++)</span></td> </tr> <tr> <th> </th><th>954</th><td class="r"><span> if ( pExecMemAllocator->aChunks[idxChunk].cFreeUnits >= cMinFreePass</span></td> </tr> <tr> <th> </th><th>955</th><td class="r"><span> && pExecMemAllocator->aChunks[idxChunk].cFreeUnits <= cMaxFreePass)</span></td> </tr> <tr> <th> </th><th>956</th><td class="r"><span> {</span></td> </tr> <tr> <th> </th><th>957</th><td class="r"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunkInner(pExecMemAllocator, idxChunk,</span></td> </tr> <tr> <th> </th><th>958</th><td class="r"><span> cReqUnits, pTb, ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th> </th><th>959</th><td class="r"><span> if (pRet)</span></td> </tr> <tr> <th> </th><th>960</th><td class="r"><span> {</span></td> </tr> <tr class="last"> <th> </th><th>961</th><td class="r"><span> STAM_PROFILE_STOP(&pExecMemAllocator->StatAlloc, a);</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>953</th><th>962</th><td class="l"><span>#ifdef VBOX_WITH_STATISTICS</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>954</th><th> </th><td class="l"><span> pExecMemAllocator->cbUnusable += (cReqUnits << IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT) - cbReq;</span></td> </tr> <tr> <th>955</th><th> </th><td class="l"><span>#endif</span></td> </tr> <tr> <th>956</th><th> </th><td class="l"><span> return pRet;</span></td> </tr> <tr> <th>957</th><th> </th><td class="l"><span> }</span></td> </tr> <tr> <th>958</th><th> </th><td class="l"><span> }</span></td> </tr> <tr> <th>959</th><th> </th><td class="l"><span> for (uint32_t idxChunk = 0; idxChunk < idxChunkHint; idxChunk++)</span></td> </tr> <tr> <th>960</th><th> </th><td class="l"><span> {</span></td> </tr> <tr> <th>961</th><th> </th><td class="l"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunk(pExecMemAllocator, idxChunk, cReqUnits, pTb,</span></td> </tr> <tr> <th>962</th><th> </th><td class="l"><span> ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th>963</th><th> </th><td class="l"><span> if (pRet)</span></td> </tr> <tr> <th>964</th><th> </th><td class="l"><span> {</span></td> </tr> <tr> <th>965</th><th> </th><td class="l"><span> STAM_PROFILE_STOP(&pExecMemAllocator->StatAlloc, a);</span></td> </tr> <tr> <th> </th><th>963</th><td class="r"><span> pExecMemAllocator->cbUnusable += (cReqUnits << IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT) - cbReq;</span></td> </tr> <tr> <th> </th><th>964</th><td class="r"><span>#endif</span></td> </tr> <tr> <th> </th><th>965</th><td class="r"><span> return pRet;</span></td> </tr> <tr> <th> </th><th>966</th><td class="r"><span> }</span></td> </tr> <tr> <th> </th><th>967</th><td class="r"><span> }</span></td> </tr> <tr> <th> </th><th>968</th><td class="r"><span> for (uint32_t idxChunk = 0; idxChunk < idxChunkHint; idxChunk++)</span></td> </tr> <tr> <th> </th><th>969</th><td class="r"><span> if ( pExecMemAllocator->aChunks[idxChunk].cFreeUnits >= cMinFreePass</span></td> </tr> <tr> <th> </th><th>970</th><td class="r"><span> && pExecMemAllocator->aChunks[idxChunk].cFreeUnits <= cMaxFreePass)</span></td> </tr> <tr> <th> </th><th>971</th><td class="r"><span> {</span></td> </tr> <tr> <th> </th><th>972</th><td class="r"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunkInner(pExecMemAllocator, idxChunk,</span></td> </tr> <tr> <th> </th><th>973</th><td class="r"><span> cReqUnits, pTb, ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th> </th><th>974</th><td class="r"><span> if (pRet)</span></td> </tr> <tr> <th> </th><th>975</th><td class="r"><span> {</span></td> </tr> <tr class="last"> <th> </th><th>976</th><td class="r"><span> STAM_PROFILE_STOP(&pExecMemAllocator->StatAlloc, a);</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>966</th><th>977</th><td class="l"><span>#ifdef VBOX_WITH_STATISTICS</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>967</th><th> </th><td class="l"><span> pExecMemAllocator->cbUnusable += (cReqUnits << IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT) - cbReq;</span></td> </tr> <tr> <th>968</th><th> </th><td class="l"><span>#endif</span></td> </tr> <tr> <th>969</th><th> </th><td class="l"><span> return pRet;</span></td> </tr> <tr> <th>970</th><th> </th><td class="l"><span> }</span></td> </tr> <tr> <th> </th><th>978</th><td class="r"><span> pExecMemAllocator->cbUnusable += (cReqUnits << IEMEXECMEM_ALT_SUB_ALLOC_UNIT_SHIFT) - cbReq;</span></td> </tr> <tr> <th> </th><th>979</th><td class="r"><span>#endif</span></td> </tr> <tr> <th> </th><th>980</th><td class="r"><span> return pRet;</span></td> </tr> <tr> <th> </th><th>981</th><td class="r"><span> }</span></td> </tr> <tr> <th> </th><th>982</th><td class="r"><span> }</span></td> </tr> <tr> <th> </th><th>983</th><td class="r"><span> if (cMinFreePass <= cReqUnits * 2)</span></td> </tr> <tr> <th> </th><th>984</th><td class="r"><span> break;</span></td> </tr> <tr> <th> </th><th>985</th><td class="r"><span> cMaxFreePass = cMinFreePass - 1;</span></td> </tr> <tr class="last"> <th> </th><th>986</th><td class="r"><span> cMinFreePass = cReqUnits * 2;</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>971</th><th>987</th><td class="l"><span> }</span></td> </tr> <tr> <th>972</th><th>988</th><td class="l"><span> }</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L981">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L997">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>981</th><th>997</th><td class="l"><span></span></td> </tr> <tr> <th>982</th><th>998</th><td class="l"><span> uint32_t const idxChunk = pExecMemAllocator->cChunks - 1;</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>983</th><th> </th><td class="l"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunk<del></del>(pExecMemAllocator, idxChunk, cReqUnits, pTb,</span></td> </tr> <tr> <th>984</th><th> </th><td class="l"><span> <del></del>ppaExec, ppChunkCtx);</span></td> </tr> <tr> <th> </th><th>999</th><td class="r"><span> PIEMNATIVEINSTR const pRet = iemExecMemAllocatorAllocUnitsInChunk<ins>Inner</ins>(pExecMemAllocator, idxChunk, cReqUnits, pTb,</span></td> </tr> <tr class="last"> <th> </th><th>1000</th><td class="r"><span> <ins> </ins>ppaExec, ppChunkCtx);</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>985</th><th>1001</th><td class="l"><span> if (pRet)</span></td> </tr> <tr> <th>986</th><th>1002</th><td class="l"><span> {</span></td> </tr> </tbody> <tbody class="skipped"> <tr> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106310#L2124">…</a></th> <th><a href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllN8veExecMem.cpp?rev=106313#L2140">…</a></th> <td> </td> </tr> </tbody> <tbody class="unmod"> <tr> <th>2124</th><th>2140</th><td class="l"><span> STAMR3RegisterFU(pUVM, &pExecMemAllocator->StatAlloc, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL,</span></td> </tr> <tr> <th>2125</th><th>2141</th><td class="l"><span> "Profiling the allocator", "/IEM/CPU%u/re/ExecMem/ProfAlloc", pVCpu->idCpu);</span></td> </tr> </tbody> <tbody class="add"> <tr class="first"> <th> </th><th>2142</th><td class="r"><ins> for (unsigned i = 1; i < RT_ELEMENTS(pExecMemAllocator->aStatSizes); i++)</ins></td> </tr> <tr class=""> <th> </th><th>2143</th><td class="r"><ins> STAMR3RegisterFU(pUVM, &pExecMemAllocator->aStatSizes[i], STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,</ins></td> </tr> <tr class=""> <th> </th><th>2144</th><td class="r"><ins> "Number of allocations of this number of allocation units",</ins></td> </tr> <tr class=""> <th> </th><th>2145</th><td class="r"><ins> "/IEM/CPU%u/re/ExecMem/aSize%02u", pVCpu->idCpu, i);</ins></td> </tr> <tr class=""> <th> </th><th>2146</th><td class="r"><ins> STAMR3RegisterFU(pUVM, &pExecMemAllocator->aStatSizes[0], STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,</ins></td> </tr> <tr class="last"> <th> </th><th>2147</th><td class="r"><ins> "Number of allocations 16 units or larger", "/IEM/CPU%u/re/ExecMem/aSize16OrLarger", pVCpu->idCpu);</ins></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>2126</th><th>2148</th><td class="l"><span>#endif</span></td> </tr> <tr> <th>2127</th><th>2149</th><td class="l"><span>#ifdef IEMEXECMEM_ALT_SUB_WITH_ALT_PRUNING</span></td> </tr> </tbody> </table> </li> <li class="entry"> <h2 id="file1"> <a href="/changeset/106313/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp" title="Show the changeset 106313 restricted to trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp">trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="Revision 106296"> <a title="Show revision 106296 of this file in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp?rev=106296#L3191" >r106296</a> </th> <th title="Revision 106313"> <a title="Show revision 106313 of this file in browser" href="/browser/vbox/trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp?rev=106313#L3191" >r106313</a> </th> <td> </td> </tr> </thead> <tbody class="unmod"> <tr> <th>3191</th><th>3191</th><td class="l"><span> pTb = pTb->pNext)</span></td> </tr> <tr> <th>3192</th><th>3192</th><td class="l"><span> {</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>3193</th><th> </th><td class="l"><span> PIEMTB pTbCopy = iemThreadedTbDuplicate(pVM, pVCpu, pTb<del>Head</del>);</span></td> </tr> <tr class="last"> <th> </th><th>3193</th><td class="r"><span> PIEMTB pTbCopy = iemThreadedTbDuplicate(pVM, pVCpu, pTb<ins></ins>);</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>3194</th><th>3194</th><td class="l"><span> if (!pTbCopy)</span></td> </tr> <tr> <th>3195</th><th>3195</th><td class="l"><span> break;</span></td> </tr> </tbody> </table> </li> </ul> </div><div class="trac-help"> <strong>Note:</strong> See <a href="/wiki/TracChangeset">TracChangeset</a> for help on using the changeset viewer. </div> </div> </div> <!-- # block content (content inherited from layout.html) --> <div id="altlinks"> <h3>Download in other formats:</h3> <ul> <li class="first"> <a rel="nofollow" href="?format=diff&new=106313" class="diff"> Unified Diff</a> </li> <li class="last"> <a rel="nofollow" href="?format=zip&new=106313" class="zip"> Zip Archive</a> </li> </ul> </div> <!-- # endblock content (content inherited from layout.html) --> <!-- # endblock content (placeholder in theme.html) --> </div> <div id="footer"><hr/> <a id="tracpowered" href="https://trac.edgewall.org/" ><img src="/chrome/common/trac_logo_mini.png" height="30" width="107" alt="Trac Powered"/></a> <p class="left"> Powered by <a href="/about"><strong>Trac 1.4.3.2</strong></a> <br /> By <a href="http://www.edgewall.org/">Edgewall Software</a> . </p> <p class="right"></p> </div> <!-- # include 'site_footer.html' (theme.html) --> </div><!-- center --> <div id="vboxfooter"> <p style="text-align:center"> <a href="https://www.oracle.com"><span style="background-image: url(/graphics/oracle-logo-new.svg); width: 100px; height: 24px; background-repeat: no-repeat; background-position: 0 11px; background-size: 100% 100%; display: inline-block"></span> © 2024 Oracle</a> <a href="https://www.oracle.com/virtualization/virtualbox/#rc30category-support-services">Support</a> <a href="https://www.oracle.com/html/privacy.html">Privacy </a> / <a href="https://www.oracle.com/legal/privacy/privacy-choices.html"> Do Not Sell My Info</a> <a href="https://www.oracle.com/html/terms.html">Terms of Use</a> <a href="https://www.oracle.com/legal/trademarks.html">Trademark Policy</a> <a href="/wiki/AutomatedAccessEtiquette">Automated Access Etiquette</a> </p> </div> <!-- end of site_footer.html --> <!-- # endblock body (content inherited from theme.html) --> </body> </html>