Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm answering this because i mostly just come here looking for (= &amp;finding =) answers to <em>my</em> questions &amp; tend not to bother giving much back in return. </p> <p>And your question is the only one that hasn't yet been pounced upon; probably because your code *still doesn't compile since you've not provided main.h</p> <p>And even then it would annoy most folks trying to help you because you make no mention of the <code>ico0.trace</code> file that is required to prevent the code from immediately exiting. lol</p> <p><br />You say <code>int min = treeArray[set]-&gt;root-&gt;findPLRU();</code> access violates.</p> <p>1) the value of <code>set</code> can never exceed the size <code>n</code> of your <code>treeArray</code> since you <code>&amp; n-1</code> the range of input values. </p> <p>2) since your <code>~Tree()</code> destructor is <em>never</em> called there will always be a <code>treeArray[set]-&gt;root</code></p> <p>3) since you *always create new <code>left</code> &amp; <code>right</code> nodes whenever <code>leftCacheLine = -1</code> or <code>rightCacheLine = -1</code> it cannot be due to recursive <code>findPLRU</code>s </p> <p><br />So. The pointer to the node is <em>not</em> being "lost" somewhere; it is being stomped on.</p> <p>try replacing:</p> <pre><code> int min = treeArray[set]-&gt;root-&gt;findPLRU(); c[min].tag = tag; c[min].access = access; </code></pre> <p>with:</p> <pre><code> int min = treeArray[set]-&gt;root-&gt;findPLRU(); if (min &gt;= k*n) { printf("ook\n"); } else { c[min].tag = tag; c[min].access = access; } </code></pre> <p>and i think you will discover what's doing the stomping ;)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload