Cambridge University Press 052182060X - Modern Implementation in Java, Second Edition Andrew W. Appel Index More information

Index

abstract data type, 5 associative, nonassociative abstract syntax, see syntax, abstract attribute grammar, 12 access link, see static link available expressions, 356 activation record, 6, 116–125 Ada, 336, 348, 349 Baker’s algorithm, 274 addressing mode, 183, 188 basic block, 170, 172, 361, 365, 382 ADT, see abstract data type beta reduction, see inline expansion Aiken-Nicolau algorithm, 444–448, 459 binding, 103–110, see also precedence alias in type environment, 111 analysis, 357, 369–374, 392 blacklist, 281 see in coalescing register allocation, 234 block structure, function, nested blocking, 477–480, 482 alignment, see cache alignment branch prediction, 456–459 alloca, 197 buffered input, 33 allocation bypass datapaths, 442, 444 of activation records, 116, 118, 156 of arrays and records, 151 of heap data, 275 linking to, 153 register, see register allocation writing compiler for, 18, 90, 116, 117, alphabet, 18 122, 130, 139, 144–146, 150, 151, ambiguous grammar, see grammar 197, 322, 369, 371, 374, 377 analysis C++, 291, 336, 369 dataflow, see dataflow analysis cache, 464–467 liveness, see liveness alignment, 468–470 antidependence, see dependence, write-after- and garbage collection, 267, 480–481 read cache alignment, 481 approximation CALL, 162, 163, 168 dataflow analysis, 209, 212, 352 call in garbage collection, 257 by name, 322 of spill effect, 220 by need, 323 of strictness, 331 by reference, 123, 124 argument, see parameter callee-save, see register, callee-save array, 144, 146, 151 caller-save, see register, caller-save bounds check, 148, 391–395 Canon module, 163 Assem module, 191 canonical tree, see intermediate represen- associativity, see right-associative, left- tation, canonical

495

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

card marking, 270 dangling else, 68 CISC, 180, 187–190, 459 dangling reference, 122 class descriptor, 285–289, 292–297 data type, abstract, see abstract data type classless language, 293 dataflow, see also liveness, reaching defi- cloning, 293 nitions, available expressions, etc. closure analysis, 6 conversion, 316–317, 320 bit vector, 361 , 27, 28, 33 equations, 205–210, 352, 354, 356, 368, function, 301, 303, 331 372, 379 Kleene, 19, 39 iteration, see iteration algorithms of LR state, 60, 63 work-list algorithms, 363 coalescing, 223–240, 245, 320, 360 dead code, 312, 326, 360, 364, 365, 368, conservative, 223 369, 389, 394, 417, 426–428 of SSA variables, 428 dead state, 23 code generation, see def (of variable), 205 code-generator generator, 185 def-use chain, 399, 438 Codegen module, 196 deforestation, 327–328 coercion, 290 dependence coloring, see graph coloring control, see control dependence comma operator, see expression sequence data, 423, 442, 476 common-subexpression elimination, 356, loop-carried, 445 359 memory and array, 423–425, 445 commute, 164, 166–174 read-after-write, see dependence, data complex instruction set, see CISC write-after-read, 423, 441, 476 computer, see CISC and RISC write-after-write, 423, 441, 476 conditional jump, 140, 149, 162, 169 depth-first search conditional move, 454 for dataflow analysis, 207, 209, 362, conflict 363 in predictive parser, 46 garbage collection, 257, 268, 279 reduce-reduce, 68, 75 spanning tree, 410–411 resolution of, 72–75 derivation, 41 shift-reduce, 62, 67, 68, 72, 74 descriptor conservative approximation, see approxi- class, 276, 285–289, 292–297 mation level, 155 constant folding, 419 record, 276, 278 constant propagation, 356, 418–419 DFA, see finite automaton conditional, 419–422 display, 134 constraint, functional-unit, 441, 443 class hierarchy, 290, 295, 296 constructor, 8 dominance frontier, 404, 436 continuation, 304, 332 dominance property, see static single-assignment continuation-passing style, 435 form control dependence, 425–426 dominator, 379–382, 384, 392–395, 436 graph, 426 efficient calculation of, 410–416, 434 control flow, 170, see also flow graph dynamic programming control-flow graph, see flow graph for instruction selection, 182–186 coordinated induction variable, 388–392 for register allocation, 241–244 copy propagation, 359, 419, see also coa- dynamic scheduling, see out-of-order ex- lescing ecution

496

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

edge splitting, 408 nested, 117–118, 124–126, 131, 135, edge-split SSA, see static single-assignment 155, 298, 301–302, 369 form functional intermediate form, 430–435 else, dangling, 68 functional programming, 12, 104, 298–334, emission see also side effect in instruction selection phase, 183, 185 impure, 299–301 of assembly code, 5, 6, 198, 244 pure, 302–308 end-of-file marker, 45 symbol tables, 107–108 environment, 11, 103–111, 115, 284, 301, functional unit, 441, 442 317 multiple, 442 functional, 107 garbage collection, 151, 257–282, 321, 333 imperative, 106 and cache, 267, 480–481 multiple, 105 Baker’s algorithm, 274 equational reasoning, 298–302, 306, 321, compiler interface, 275–278 430 concurrent, 272 error message, 91 conservative, 281 error recovery, 53 copying, 264–269 escape, 124, 302, 321, 332, see also FindEscape cost, 259, 264, 268, 271, 275 ESEQ, 162–169 flip, 274 expression sequence, see also ESEQ generational, 269–271, 480 finite automaton, 18, 21–30 incremental, 272–275 deterministic, 22 mark-sweep, 257–262 minimization, 36 reference counts, 262–264 nondeterministic, 24 generic, 336, 348 Generic Java, 336 converting to DFA, 27 GJ, 336 FIRST set, 47–52, 63 grammar, 5, 40–45, see also syntax fixed point, 48, 206, 357, 374 ambiguous, 42, 50, 51, 67–68, 90, 185 least, 209, 218, 368, 419 attribute, 12 Flex, 34 factoring, 53 flow graph, 203 for intermediate representation, 7–9 reducible, 377 for parser generator, 89 flow, data, see dataflow hierarchy of classes, 66 FlowGraph module, 215 LALR, 66, 67 FOLLOW set, 48–50, 52, 54, 62 LL(1), 51 forward reference, see recursion, mutual of straight-line programs, 7 forwarding, 265–268 to specify instruction set, 183–186 fragmentation, 261 transformations, 51, 88, 90 frame, see activation record unambiguous, 51 Frame module, 127, 251 graph frame pointer, 118–120, 134, 143, 155, 197– coloring, 219–223, 250, 286, 360 198 optimistic, 221 on Pentium, 188 with coalescing, 223–240, 245, 320 freeze, 224, 233, 239 work-list algorithm, 232–240 function interference, see interference graph dead, 312 Graph module, 214 higher-order, 117, 298 graph, flow, see flow graph integration, see inline expansion leaf, 122 halting problem, 351, 374

497

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

hash table, 106, 114 liveness analysis, 206–207 hazard, 441, see also constraint, functional- LR parser construction, 60 unit minimization of finite automata, 36 reaching definitions, 355 IBM 360/91, 455 iterative modulo scheduling, see modulo induction variable, 385–391 scheduling coordinated, 388, 390, 392 linear, 387 Java, 336 inheritance, 283, 284 writing compiler for, 18, 90, 105, 145, multiple, 286 276, 282, 289, 290, 292, 297, 322, single, 285, 294, 295 370, 371, 392, 393 inline expansion, 276, 308–316, 332, 431 writing compiler in, 3, 9–11, 91 instanceof, 12, 93 JavaCC, 7, 68–89 instantiation of variable, 116 JavaCC parser generator, 89 instruction Jouette, 176–180, 192–195 fetch, 456, 470 Schizo, 184 Instr representation of, 191 Kleene closure, 19, 39 pipeline, see pipeline resource usage of, 442 label, 131 selection of, 6, 176–202 lambda calculus, 430 side effect of, 188, 196 lambda-calculus, 331 three-address, 188 landing pad, 435 two-address, 188, 193 lattice, 420 variable-length, 188 lazy evaluation, 321–327, 435 instruction set, see CISC and RISC leaf function, 122 instruction-level parallelism, 440 left-associative operator, 73, 74 Intel, see Pentium left-factoring, 53 interfaces, 5 left-recursion, 51 interference graph, 212–232, 244 Lengauer-Tarjan algorithm, 410–416, 434, construction of, 213, 216–217, 236 see also dominator for SSA form, 429 Lex, 6, 33 from SSA form, 429, 438 lexical analyzer, 6, 16–37, 93 intermediate representation, 6, 137–139, lexical scope, see function, nested see also Tree Lisp, 348 canonical, 162–169 live range, 203, 213 functional, 430–435 live-in, 205 interpreter, 91 live-out, 205 invariant, see loop invariant liveness, 6, 203–218, 236, 358, 360, 363, IR, see intermediate representation 365, 367, 368 item in SSA form, 429 LR(0), 59 of heap data, 257 LR(1), 63 LL(k), see parser, LL(k) iteration algorithms local variable, 116 alias analysis, 372 locality of reference, see cache dominators, 379 lookahead, 37 -closure, 28 loop, 376 efficient, 360–364 header, 376, 381–382 first and follow sets, 48 inner, 381 invention of, 374 interchange, 476–477

498

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

invariant, 314, 326, 382, 384–389, 398 parallel processing, instruction-level, 440 natural, 381–382 parameter, see also view shift nested, 382 actual, 194, 312, 319 postbody, see postbody node address of, 122 scheduling, 444–456 allocating location of, 124 unrolling, 395, 444, 474 by-reference, 123, 369, 371 LR(k), see parser, LR(k) formal, 129, 162 l-value, 145–147 in frame, 122, 127, 128 lazy, 322 macro preprocessor, 17 outgoing, 120, 194, 252 Maximal Munch, 180 register, 121, 129, 132 memory allocation, see allocation and garbage static link, 132, 317 collection substitution, 311 method this, 283 instance, 283 type-checking, 113 lookup, 286, 294, 295 variable number of, 122 multi-, 295 parse tree, 42, 89 private, 292 parser, 6 replication, 296 dynamic programming, 185 static, 285 error recovery, 53 MiniJava abstract syntax, 98 generator, 68 MIPS, 442, 459 LL(1), 46–55 MIPS computer, 128, 129, 132 LL(k), 51, 55 ML, 90, 336, 348 LR(0), 58–62 writing compiler for, 105, 117, 124, LR(1), 56–58 135, 145, 299, 322, 332, 369, 370, LR(k), 55–58 374, 392, 393 predictive, 46–55 Modula-3, 90, 276, 336 construction, 50 modularity, 11, 93, 295 recursive-descent, 45–47, 50–55, 86 modulo scheduling, 448–456 SLR, 62–63 Motorola 68000, 184 Pascal, 90, 116, 117, 124, 135, 144–146, MOVE, 167 151, 276, 322, 369, 370 multimethod, 295 pattern, see tile negation, 148 Pentium, 128, 129, 188, 189, 196 NFA, see finite automaton persistent data structure, 14, 108 nonassociative operator, 74 phases nonterminal symbol, 40 of a compiler, 4 nullable symbol, 47–50, 52 order of, 5 φ-function, 400 object-oriented pipeline, 442 classless language, 293 software, see scheduling language, 145, 276, 283–297, 349 pointer programming style, 13, 15, 93–140 derived, 277 OpExp, 10 reversal, 260 out-of-order execution, 455, 471 polymorphism, 336 output dependence, see dependence, write- pos,91 after-write position in source code, 91 overloaded operator, 113 postbody node, 396, 397, 403, 435 overloading, 336, 348–349 postdominance, 425

499

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

precedence, 44 RISC, 132, 180 precedence directive, 72–75 roots of garbage-collected heap, 257, 264, predicated execution, 454 266, 269, 281 prediction, see branch prediction rule priority, 20, 30 predictive parser, see parser runtime system, 152 prefetching, 470–475, 480, 481 preheader, 313–314, 382, 388, 392, 396, SableCC, 7, 68–89 398, 435, 457 scalar replacement, 478, 482 preprocessor, 17 scanner, see lexical analyzer procedure, see function scheduling, 444–456, 471 profile-based optimization, 458, 460 modulo, see modulo scheduling pure functional language, see functional Scheme, 117, 135, 299, 332 programming, pure Schizo-Jouette, 184 scope, 103–108, 123, 131, 430 quadruple, 353, 430 lexical, see function, nested RAW, see dependence, data nested, 155 reachable data, 257 search tree, 14 reaching definitions, 294, 354, 369 balanced, 14 reaching expressions, 358 semantic recursion action, 86–93, 101 mutual, 90 analysis, 6, 103 tail, see tail recursion value, 18, 41, 88, 89 recursive descent, see parser semantics, 12, 89 red-black tree, 108 semidominator, 412 reduce-reduce conflict, see conflict sentinel, 34 reduced instruction set, see RISC Sethi-Ullman algorithm, 242 reducible flow graph, 377 shift of view, see view shift reference counts, 262–264 shift-reduce conflict, see conflict reference parameter, see call by reference side effect, 12, 298 RegAlloc module, 216 of instruction, 188, 196 register significant degree, 220, 223–233, 248 allocation, 6, 189, 360 Simula, 295 for SSA form, 428 Sparc, 128, 129, 132 for trees, 241–244 sparse conditional constant, see constant Sethi-Ullman algorithm, 242 propagation callee-save, 120–121, 156, 157, 200, spill, 189, 219–221, 223, 226, 243, 251 227–228, 251, 277, 319, 332 cost, 217, 244 caller-save, 120–121, 133, 196, 228, potential, 220, 224, 226, 247, 248 320 work list, 233–235 classes of, 183, 187, 188 splitting, see edge splitting windows, 122, 128, 129 SSA, see static single-assignment form zero, 200 stack regular expression, 18–21, 33 frame, see activation record converting to NFA, 25–26 illustration of, 119 remembered set, 270, 280 of activation records, 118–120 reservation table, 452, 472 pointer, 118–120, 156, 197, 198, 200 reserved word, 17 on Pentium, 188 return address, 200 state right-associative operator, 73, 74, 299 LR(0), 61

500

© Cambridge University Press www.cambridge.org Cambridge University Press 052182060X - Modern Compiler Implementation in Java, Second Edition Andrew W. Appel Index More information

INDEX

LR(1), 63 data structures, 7 static link, 125, 134, 155, 156, 199 intermediate representation, 6 static single-assignment form, 399–402 parse, see parse tree converting from, 428–429 pattern, see tile converting to, 402–408 pattern matching, 186 data structures for, 417 red-black, 108 dominance property, 404, 422, 429 register allocation for, 241–244 edge-split, 409, 422 search, see search tree optimizations using, 417–423 Tree intermediate represention, 137–139, size of, 437, 438 250 unique successor or predecessor prop- Tree module, 138, 166 erty, 408, 422 type straight-line program, 7–8 checking, 114, 339 interpreter, 11 hierarchy analysis, 294 strength reduction, 385, 388–389 propagation, 294 strictness analysis, 328–331 substitution, 341 string literal, 150 substitution, 321, see also type substitu- union-find, 434 tion unique successor or predecessor property, superscalar, 441 428 Symbol module, 109, 110 unreachable code, 394, 419 symbol table, see environment unroll and jam, 479, 482 symbol, grammar, 40 unrolling, see loop unrolling syntax, 38, see also grammar use (of variable), 205 abstract, 5, 6, 89–98 use-def chain, 438 of MiniJava, 98 factored, 434 of straight-line programs, 8 useless variable, 389 tree, 90 value numbering, 365, 374, 400, 434 concrete, 89 varargs, 122 vs. semantics, 75 variable table compression, 33 free, 316 tableau, 447 in frame, 123 tail recursion, 319–320 live, see liveness Temp module, 131, 198 local, 116 template, 336 useless, 389 temporary variable, 131 view shift, 128, 129, 250 terminal symbol, 40 VLIW, 459 thunk, 322–325, 328, 332 WAR, see dependence, write-after-read tile, 176–190, 194, 241–243 WAW, see dependence, write-after-write cost, 182 work-list algorithms, 233, 363, 407, 418, optimum vs. optimal, 179 421 tools, compiler generation, 5, 185 trace, 171–173 Yacc, 6 trace scheduling, 455, 459 Translate module, 140 tree canonical, see intermediate represen- tation, canonical

501

© Cambridge University Press www.cambridge.org