<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Nico.<br>
<br>
I don't think this is a bug. Decompiler creates Smalltalk code from
actual bytecode. Dead code had been removed when generating the
bytecode. Looks fine to me.<br>
<br>
Does it make sense to add some use of the 'a' variable, so it is
kept during compilation? I mean, it is difficult to imagine that
CodeCoverageTest can do something interesting with a method that had
all its code optimized out...<br>
<br>
Cheers,<br>
<br>
On 5/4/2025 1:49 PM, Nicolás Papagna Maldonado via Cuis-dev wrote:
<blockquote
cite="mid:CADGn7BPnKZg6_=A1+-eWqjgH0CqoFxCR0xfz_86iTZCmCyxdzg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi folks,
<div><br>
</div>
<div>I don't know if this is a bug or the expected behavior.</div>
<div><br>
</div>
<div>Today I ran the tests in <font face="monospace">BaseImageTests</font>
with the <font face="monospace">CodeCoverage</font> package (<a
moz-do-not-send="true"
href="https://github.com/npapagna/cuis-code-coverage">https://github.com/npapagna/cuis-code-coverage</a>)
loaded and one of the <span style="font-family: monospace;">DecompilerTests </span>failed.</div>
<div>The reason seems to be that <font face="monospace">Decompiler</font>
does not restore unused temporary variables.</div>
<div><br>
</div>
<div>In particular, <font face="monospace">DecompilerTests>>#testDecompilerInClassesCNtoCZ</font>
was failing on <font face="monospace">CodeCoverageTest
temporaryVariable</font>:<br>
<div>(For context: this method is needed to reproduce a test
scenario for the CodeCoverage tool)</div>
<div><br>
</div>
<div><font face="monospace">CodeCoverageTest >>
#temporaryVariable<br>
| a |<br>
a</font>.</div>
<div><font face="monospace"><br>
</font></div>
To reproduce without the CodeCoverage package, evaluate:
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">Object compile: 'm1 |a| a'.<br>
<br>
newCodeString := (Decompiler new<br>
decompile: #m1<br>
in: Object<br>
method: Object >> #m1) decompileString.</font></div>
</div>
<div><font face="monospace"><br>
</font></div>
Notice that <font face="monospace">newCodeString</font> is <font
face="monospace">'m1 ^ self.'</font> and it should be <font
face="monospace">'m1 |a| a'</font>(if this is really a bug).
<div><font face="monospace"><br>
</font></div>
<div>The code above was run on HEAD at the moment
(6c13d4eda2e9a8c56362ae3363d7b013917227c5).</div>
<div><br>
</div>
<div>Is this something that needs to be fixed?</div>
<div>
<div><font face="monospace"><br>
</font></div>
Best,<br>
Nico PM</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
<a class="moz-txt-link-freetext" href="https://independent.academia.edu/JuanVuletich">https://independent.academia.edu/JuanVuletich</a>
<a class="moz-txt-link-freetext" href="https://www.researchgate.net/profile/Juan-Vuletich">https://www.researchgate.net/profile/Juan-Vuletich</a>
<a class="moz-txt-link-freetext" href="https://patents.justia.com/inventor/juan-manuel-vuletich">https://patents.justia.com/inventor/juan-manuel-vuletich</a>
<a class="moz-txt-link-freetext" href="https://twitter.com/JuanVuletich">https://twitter.com/JuanVuletich</a></pre>
</body>
</html>