Mercurial > repos > tabletprog
diff modules/x86.tp @ 350:a3b06d53bcb9
Make il and x86 modules cope with dict hash instead of dict linear for the program definition
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 10 Apr 2015 01:19:46 -0700 |
parents | a840e9a068a2 |
children | 0b4d4f06bf91 |
line wrap: on
line diff
--- a/modules/x86.tp Fri Apr 10 01:19:10 2015 -0700 +++ b/modules/x86.tp Fri Apr 10 01:19:46 2015 -0700 @@ -764,9 +764,7 @@ { //call arguments <- inst args - cur <- (arguments length) - 1 - while: { cur >= 0 } do: { - src <- (arguments get: cur) + arguments foldr: (arguments length) - 1 with: :cur src { if: cur < (_argregs length) { dst <- _argregs get: cur if: (not: dst = src) { @@ -778,12 +776,19 @@ } else: { outarr append: (push: src) } - cur <- cur - 1 + cur - 1 } + toCall <- inst target if: (toCall isString?) { //TODO: Handle call to undefined label - toCall <- labels get: toCall + toCall <- labels get: toCall else: { + print: "Could not find label " . toCall . "\nDefined labels:\n" + foreach: labels :key _ { + print: "\t" . key . "\n" + } + false + } } outarr append: (call: toCall) }