> Alternatively, there is a way to display where the operations come
from, but only during testing. <br><br>I did this; which was good advice, as it generated several errors that the ordinary compiler doesn't flag.<br><br>After fixing those up, I get the following (paraphrased):<br><br>
pop__AccessDirect_None:46 setarrayitem_gc(p30, Const(0), Const(* None), descr=<Descr "4, 'r'">)<br>pop__AccessDirect_None:46 setarrayitem_gc(p30, Const(1), Const(* None), descr=<Descr "4, 'r'">)<br>
compare__AccessDirect_None:34 i138 = uint_lt(i137, Const(10000))<br>compare__AccessDirect_None:38 guard_true(i138, ...<br>ll_contains__dicttablePtr_Signed:10 i139 = call(Const(<AddressAsInt * fn ll_dict_lookup__dicttablePtr_Signed_Signed>), Const(*dicttable), Const(21), Const(21), descr=<Descr "0, 'i', E">)<br>
ll_contains__dicttablePtr_Signed:10 guard_no_exception(...<br>ll_contains__dicttablePtr_Signed:14 i40 = int_and(i139, Const(-2147483684))<br>ll_contains__dicttablePtr_Signed:17 141 = int_is_true(140)<br><br>followed by much more dicttable stuff. So that doesn't really help me pinpoint the problem, unless *dicttable is some magic constant? What do the offsets reference - they don't correspond to line numbers.<br>
<br>Here's my compare function for what it's worth. Note that there is an implicit downcast in order to get intValue. In the above loop, the klass's of both objects is Int, which the JIT is able to deduce.<br>
<br>class Frame:<br> # ...<br> def compare(self, a, b):<br> """ Compares two values using the builting comparison operator. <br>Returns -1, 0, 1 or -99, where -99 means NaN comparison, otherwise such that (a op b) iff (result op 0)"""<br>
import math<br> if a.klass == Int and b.klass == Int:<br> if a.intValue < b.intValue:<br> return -1<br> elif a.intValue > b.intValue:<br> return 1<br>
else:<br> return 0<br> #elif a.klass in (Int, Uint, Number) and b.klass in (Int, Uint, Number):<br> # aValue = self.space.toNumber(a)<br> # bValue = self.space.toNumber(b)<br>
# if math.isnan(aValue):<br> # return -99<br> # if math.isnan(bValue):<br> # return -99<br> # if aValue < bValue:<br> # return -1<br> # elif aValue > bValue:<br>
# return 1<br> # else:<br> # return 0<br><br> raise StandardError("Not implemented")<br><br><br><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>