Skip to content

Commit d9e3ba1

Browse files
committed
refresh the output in figures 7.15 and 7.10, fixing issue #198
1 parent c4b950f commit d9e3ba1

File tree

1 file changed

+205
-100
lines changed

1 file changed

+205
-100
lines changed

book.tex

Lines changed: 205 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
\def\racketEd{0}
2525
\def\pythonEd{1}
26-
\def\edition{0}
26+
\def\edition{1}
2727

2828
% material that is specific to the Racket edition of the book
2929
\newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -13144,23 +13144,40 @@ \section{Expose Allocation}
1314413144
{\if\edition\pythonEd\pythonColor
1314513145
\begin{lstlisting}
1314613146
v1 = begin:
13147-
init.514 = 42
13147+
init.1 = 42
1314813148
if (free_ptr + 16) < fromspace_end:
1314913149
else:
1315013150
collect(16)
13151-
alloc.513 = allocate(1,tuple[int])
13152-
alloc.513[0] = init.514
13153-
alloc.513
13151+
alloc.0 = allocate(1,tuple[int])
13152+
alloc.0[0] = init.1
13153+
alloc.0
1315413154
v2 = begin:
13155-
init.516 = v1
13155+
init.3 = v1
1315613156
if (free_ptr + 16) < fromspace_end:
1315713157
else:
1315813158
collect(16)
13159-
alloc.515 = allocate(1,tuple[tuple[int]])
13160-
alloc.515[0] = init.516
13161-
alloc.515
13159+
alloc.2 = allocate(1,tuple[tuple[int]])
13160+
alloc.2[0] = init.3
13161+
alloc.2
1316213162
print(v2[0][0])
1316313163
\end{lstlisting}
13164+
%% v1 = begin:
13165+
%% init.514 = 42
13166+
%% if (free_ptr + 16) < fromspace_end:
13167+
%% else:
13168+
%% collect(16)
13169+
%% alloc.513 = allocate(1,tuple[int])
13170+
%% alloc.513[0] = init.514
13171+
%% alloc.513
13172+
%% v2 = begin:
13173+
%% init.516 = v1
13174+
%% if (free_ptr + 16) < fromspace_end:
13175+
%% else:
13176+
%% collect(16)
13177+
%% alloc.515 = allocate(1,tuple[tuple[int]])
13178+
%% alloc.515[0] = init.516
13179+
%% alloc.515
13180+
%% print(v2[0][0])
1316413181
\fi}
1316513182
\end{tcolorbox}
1316613183
\caption{Output of the \code{expose\_allocation} pass.}
@@ -13732,119 +13749,207 @@ \section{Select Instructions and the \LangXGlobal{} Language}
1373213749
\begin{minipage}{0.5\textwidth}
1373313750
\begin{lstlisting}[basicstyle=\ttfamily\scriptsize]
1373413751
start:
13735-
init.514 = 42
13736-
tmp.517 = free_ptr
13737-
tmp.518 = (tmp.517 + 16)
13738-
tmp.519 = fromspace_end
13739-
if tmp.518 < tmp.519:
13740-
goto block.529
13752+
init.1 = 42
13753+
tmp.4 = (free_ptr + 16)
13754+
if tmp.4 < fromspace_end:
13755+
goto block.10
1374113756
else:
13742-
goto block.530
13757+
goto block.11
13758+
13759+
block.10:
13760+
alloc.0 = allocate(1,tuple[int])
13761+
alloc.0:tuple[int][0] = init.1
13762+
v1 = alloc.0
13763+
init.3 = v1
13764+
tmp.5 = (free_ptr + 16)
13765+
if tmp.5 < fromspace_end:
13766+
goto block.8
13767+
else:
13768+
goto block.9
13769+
13770+
block.8:
13771+
alloc.2 = allocate(1,tuple[tuple[int]])
13772+
alloc.2:tuple[tuple[int]][0] = init.3
13773+
v2 = alloc.2
13774+
tmp.6 = v2[0]
13775+
tmp.7 = tmp.6[0]
13776+
print(tmp.7)
13777+
return 0
1374313778

13744-
block.529:
13745-
goto block.528
13779+
block.9:
13780+
collect(16)
13781+
goto block.8
1374613782

13747-
block.530:
13783+
block.11:
1374813784
collect(16)
13749-
goto block.528
13750-
13751-
block.528:
13752-
alloc.513 = allocate(1,tuple[int])
13753-
alloc.513:tuple[int][0] = init.514
13754-
v1 = alloc.513
13755-
init.516 = v1
13756-
tmp.520 = free_ptr
13757-
tmp.521 = (tmp.520 + 16)
13758-
tmp.522 = fromspace_end
13759-
if tmp.521 < tmp.522:
13760-
goto block.526
13761-
else:
13762-
goto block.527
13785+
goto block.10
13786+
\end{lstlisting}
13787+
%% start:
13788+
%% init.514 = 42
13789+
%% tmp.517 = free_ptr
13790+
%% tmp.518 = (tmp.517 + 16)
13791+
%% tmp.519 = fromspace_end
13792+
%% if tmp.518 < tmp.519:
13793+
%% goto block.529
13794+
%% else:
13795+
%% goto block.530
13796+
13797+
%% block.529:
13798+
%% goto block.528
13799+
13800+
%% block.530:
13801+
%% collect(16)
13802+
%% goto block.528
13803+
13804+
%% block.528:
13805+
%% alloc.513 = allocate(1,tuple[int])
13806+
%% alloc.513:tuple[int][0] = init.514
13807+
%% v1 = alloc.513
13808+
%% init.516 = v1
13809+
%% tmp.520 = free_ptr
13810+
%% tmp.521 = (tmp.520 + 16)
13811+
%% tmp.522 = fromspace_end
13812+
%% if tmp.521 < tmp.522:
13813+
%% goto block.526
13814+
%% else:
13815+
%% goto block.527
1376313816

13764-
block.526:
13765-
goto block.525
13817+
%% block.526:
13818+
%% goto block.525
1376613819

13767-
block.527:
13768-
collect(16)
13769-
goto block.525
13820+
%% block.527:
13821+
%% collect(16)
13822+
%% goto block.525
1377013823

13771-
block.525:
13772-
alloc.515 = allocate(1,tuple[tuple[int]])
13773-
alloc.515:tuple[tuple[int]][0] = init.516
13774-
v2 = alloc.515
13775-
tmp.523 = v2[0]
13776-
tmp.524 = tmp.523[0]
13777-
print(tmp.524)
13778-
return 0
13779-
\end{lstlisting}
13824+
%% block.525:
13825+
%% alloc.515 = allocate(1,tuple[tuple[int]])
13826+
%% alloc.515:tuple[tuple[int]][0] = init.516
13827+
%% v2 = alloc.515
13828+
%% tmp.523 = v2[0]
13829+
%% tmp.524 = tmp.523[0]
13830+
%% print(tmp.524)
13831+
%% return 0
1378013832
\end{minipage}
1378113833
&$\Rightarrow$&
1378213834
\begin{minipage}{0.4\textwidth}
13783-
\begin{lstlisting}[basicstyle=\ttfamily\scriptsize]
13835+
\begin{lstlisting}[basicstyle=\ttfamily\scriptsize]
1378413836
start:
13785-
movq $42, init.514
13786-
movq free_ptr(%rip), tmp.517
13787-
movq tmp.517, tmp.518
13788-
addq $16, tmp.518
13789-
movq fromspace_end(%rip), tmp.519
13790-
cmpq tmp.519, tmp.518
13791-
jl block.529
13792-
jmp block.530
13793-
13794-
block.529:
13795-
jmp block.528
13796-
13797-
block.530:
13798-
movq %r15, %rdi
13799-
movq $16, %rsi
13800-
callq collect
13801-
jmp block.528
13802-
13803-
block.528:
13837+
movq $42, init.1
13838+
movq free_ptr(%rip), tmp.4
13839+
addq $16, tmp.4
13840+
cmpq fromspace_end(%rip), tmp.4
13841+
jl block.10
13842+
jmp block.11
13843+
13844+
block.10:
1380413845
movq free_ptr(%rip), %r11
1380513846
addq $16, free_ptr(%rip)
1380613847
movq $3, 0(%r11)
13807-
movq %r11, alloc.513
13808-
movq alloc.513, %r11
13809-
movq init.514, 8(%r11)
13810-
movq alloc.513, v1
13811-
movq v1, init.516
13812-
movq free_ptr(%rip), tmp.520
13813-
movq tmp.520, tmp.521
13814-
addq $16, tmp.521
13815-
movq fromspace_end(%rip), tmp.522
13816-
cmpq tmp.522, tmp.521
13817-
jl block.526
13818-
jmp block.527
13819-
13820-
block.526:
13821-
jmp block.525
13822-
13823-
block.527:
13824-
movq %r15, %rdi
13825-
movq $16, %rsi
13826-
callq collect
13827-
jmp block.525
13828-
13829-
block.525:
13848+
movq %r11, alloc.0
13849+
movq alloc.0, %r11
13850+
movq init.1, 8(%r11)
13851+
movq alloc.0, v1
13852+
movq v1, init.3
13853+
movq free_ptr(%rip), tmp.5
13854+
addq $16, tmp.5
13855+
cmpq fromspace_end(%rip), tmp.5
13856+
jl block.8
13857+
jmp block.9
13858+
13859+
block.8:
1383013860
movq free_ptr(%rip), %r11
1383113861
addq $16, free_ptr(%rip)
1383213862
movq $131, 0(%r11)
13833-
movq %r11, alloc.515
13834-
movq alloc.515, %r11
13835-
movq init.516, 8(%r11)
13836-
movq alloc.515, v2
13863+
movq %r11, alloc.2
13864+
movq alloc.2, %r11
13865+
movq init.3, 8(%r11)
13866+
movq alloc.2, v2
1383713867
movq v2, %r11
13838-
movq 8(%r11), %r11
13839-
movq %r11, tmp.523
13840-
movq tmp.523, %r11
13841-
movq 8(%r11), %r11
13842-
movq %r11, tmp.524
13843-
movq tmp.524, %rdi
13868+
movq 8(%r11), tmp.6
13869+
movq tmp.6, %r11
13870+
movq 8(%r11), tmp.7
13871+
movq tmp.7, %rdi
1384413872
callq print_int
1384513873
movq $0, %rax
1384613874
jmp conclusion
13875+
13876+
block.9:
13877+
movq %r15, %rdi
13878+
movq $16, %rsi
13879+
callq collect
13880+
jmp block.8
13881+
13882+
block.11:
13883+
movq %r15, %rdi
13884+
movq $16, %rsi
13885+
callq collect
13886+
jmp block.10
1384713887
\end{lstlisting}
13888+
13889+
%% start:
13890+
%% movq $42, init.514
13891+
%% movq free_ptr(%rip), tmp.517
13892+
%% movq tmp.517, tmp.518
13893+
%% addq $16, tmp.518
13894+
%% movq fromspace_end(%rip), tmp.519
13895+
%% cmpq tmp.519, tmp.518
13896+
%% jl block.529
13897+
%% jmp block.530
13898+
13899+
%% block.529:
13900+
%% jmp block.528
13901+
13902+
%% block.530:
13903+
%% movq %r15, %rdi
13904+
%% movq $16, %rsi
13905+
%% callq collect
13906+
%% jmp block.528
13907+
13908+
%% block.528:
13909+
%% movq free_ptr(%rip), %r11
13910+
%% addq $16, free_ptr(%rip)
13911+
%% movq $3, 0(%r11)
13912+
%% movq %r11, alloc.513
13913+
%% movq alloc.513, %r11
13914+
%% movq init.514, 8(%r11)
13915+
%% movq alloc.513, v1
13916+
%% movq v1, init.516
13917+
%% movq free_ptr(%rip), tmp.520
13918+
%% movq tmp.520, tmp.521
13919+
%% addq $16, tmp.521
13920+
%% movq fromspace_end(%rip), tmp.522
13921+
%% cmpq tmp.522, tmp.521
13922+
%% jl block.526
13923+
%% jmp block.527
13924+
13925+
%% block.526:
13926+
%% jmp block.525
13927+
13928+
%% block.527:
13929+
%% movq %r15, %rdi
13930+
%% movq $16, %rsi
13931+
%% callq collect
13932+
%% jmp block.525
13933+
13934+
%% block.525:
13935+
%% movq free_ptr(%rip), %r11
13936+
%% addq $16, free_ptr(%rip)
13937+
%% movq $131, 0(%r11)
13938+
%% movq %r11, alloc.515
13939+
%% movq alloc.515, %r11
13940+
%% movq init.516, 8(%r11)
13941+
%% movq alloc.515, v2
13942+
%% movq v2, %r11
13943+
%% movq 8(%r11), %r11
13944+
%% movq %r11, tmp.523
13945+
%% movq tmp.523, %r11
13946+
%% movq 8(%r11), %r11
13947+
%% movq %r11, tmp.524
13948+
%% movq tmp.524, %rdi
13949+
%% callq print_int
13950+
%% movq $0, %rax
13951+
%% jmp conclusion
13952+
1384813953
\end{minipage}
1384913954
\end{tabular}
1385013955
\fi}

0 commit comments

Comments
 (0)