diff options
Diffstat (limited to 'thesis/storing-pc.tex')
-rw-r--r-- | thesis/storing-pc.tex | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/thesis/storing-pc.tex b/thesis/storing-pc.tex index 98b03ae..b642ee9 100644 --- a/thesis/storing-pc.tex +++ b/thesis/storing-pc.tex @@ -83,7 +83,7 @@ Only after that can we check if its constructor is \abc{_Nil} (the empty list), Evaluating the argument is done by jumping to the subroutine indicated by the node entry of that argument. Hence, we store the PC, jump to that address, and continue with \abc{eq_desc _Nil 0 0} when the node has been evaluated to head normal form. -The ARM code for pattern matching is: +The ARM code for the pattern match is: \begin{minted}{ual} sisEmpty_P1: @@ -100,8 +100,8 @@ The ARM code for pattern matching is: \end{minted} We can see here - (a) that evaluating a node requires a \abc{jsr_eval} ABC instruction, and - (b) that \abc{jsr} ABC instructions require storing the PC in ARM assembly. + that evaluating a node requires a \abc{jsr_eval} ABC instruction, and + that \abc{jsr} ABC instructions require storing the PC in ARM assembly. Of course, evaluating nodes is something that happens throughout the source code and has to be done all the time during the execution of a Clean program. We therefore need a fast, small Thumb alternative for the ARM code. @@ -142,9 +142,19 @@ It is an easier solution to have the caller responsible for storing the return a and why we continue along these lines for the Thumb backend. \subsection{Comparison} -To be done. %TODO - -For every occurrence: +1 word code size; -for every function call: +1 instruction. +Assuming the worst case, that all instructions in the jump block are wide, we need four more bytes in Thumb than in ARM. +As a benchmark, the Clean compiler has 41,006 jumps of this kind in 1,253,978 instructions, a rough 3.27\%. +The four extra bytes in Thumb mean a size increase of $41006\cdot4\approx160$KiB on the 5.3MiB file, an increase of 3.00\%. + +As for the time complexity: every jump requires an extra instruction cycle. +In particular, every reduction needs an extra cycle. +It is hard to tell what effect this has on Clean programs in general, + and it may well be very dependent on the kind of program. +A general comparison of running time under ARM and Thumb is made in \cref{sec:results:time}. + +% pi@rasppi:~/clean/exe$ objdump -d cocl | grep -E '^\s+[0123456789abcdef]{5,8}:\s+[0123456789abcdef]{8}\s+push\s+\{pc\}' | wc -l +% 41006 +% pi@rasppi:~/clean/exe$ objdump -d cocl | grep -E '^\s+[0123456789abcdef]{5,8}:\s+[0123456789abcdef]{8}' | wc -l +% 1253978 \end{multicols} |