summaryrefslogtreecommitdiff
path: root/usr/austin/eval/compiler.go
AgeCommit message (Collapse)AuthorFilesLines
2009-10-14move austin/eval and austin/ogle to exp/eval and exp/ogleRuss Cox1-97/+0
R=r OCL=35736 CL=35746
2009-09-24Fix declared and not used errors and unused import errors inAustin Clements1-1/+0
the interpreter and update code to use ast.BasicDecl and multi-type switch. There are still a lot of "switch _ := x.(type)" that should make use of the new type switch syntax, but those will be a different CL. R=rsc APPROVED=rsc DELTA=58 (16 added, 23 deleted, 19 changed) OCL=34853 CL=34963
2009-09-03convert testing to World.Russ Cox1-1/+2
start on Decl, but not working yet R=austin DELTA=762 (201 added, 205 deleted, 356 changed) OCL=34335 CL=34349
2009-09-02convenience wrapperRuss Cox1-0/+1
R=austin DELTA=142 (128 added, 4 deleted, 10 changed) OCL=34275 CL=34284
2009-08-28Split decls.go up, taking advantage of whole-packageAustin Clements1-0/+11
compilation to put the definitions in reasonable places. No code changes, just movement. R=rsc APPROVED=rsc DELTA=479 (232 added, 247 deleted, 0 changed) OCL=34067 CL=34069
2009-08-27Make the statement compiler not use the AST visitor.Austin Clements1-1/+8
In the process, I made error handling in the statement compiler much saner. Instead of separately tracking various error flags with weird relations, I just track if any error messages have been produced. R=rsc APPROVED=rsc DELTA=308 (98 added, 135 deleted, 75 changed) OCL=33870 CL=33961
2009-08-25Make the expression compiler not use the AST visitor. TheAustin Clements1-12/+0
statement compiler will be fixed in a later CL. The input and output of the expression compiler are now clearly distinguished. In the process, I made the individual expression compilers operate on the compiled form of their children instead of AST nodes. As a result, there are now fewer places where I hand-craft intermediate expression nodes. The diff looks scarier than it is, mostly because exprCompiler has been split into the input and output types, resulting in lots of little renames. R=rsc APPROVED=rsc DELTA=774 (204 added, 199 deleted, 371 changed) OCL=33851 CL=33851
2009-08-12Convert interpreter to whole-package compilation.Austin Clements1-24/+0
R=rsc APPROVED=rsc DELTA=334 (110 added, 211 deleted, 13 changed) OCL=33135 CL=33137
2009-08-05Implement struct types, selector expressions, and typeAustin Clements1-0/+1
declarations. R=rsc APPROVED=rsc DELTA=587 (519 added, 21 deleted, 47 changed) OCL=32754 CL=32788
2009-07-30Implement labels, goto, labeled break, and labeled continue.Austin Clements1-7/+26
Return checking is now done as a general flow check at the end of function compilation, since break and goto complicated the way I was doing return checking before. Goto-over-declaration checking is also done as a final flow check. Temporary variables used for effect extraction are now actually temporary. Otherwise "op=", "++", and "--" appear as declarations that cannot be jumped over. R=rsc APPROVED=rsc DELTA=421 (344 added, 38 deleted, 39 changed) OCL=32527 CL=32535
2009-07-29Flatten the Frame tree. Now each function call produces aAustin Clements1-10/+7
single frame and non-overlapping variables reuse frame slots. As a result, entering and exiting blocks no longer requires code execution, which means jumps across block boundaries should be doable now. Frame slot initialization happens at definition time now, instead of at frame creation time. As an added bonus, Scope's are now exclusively compile-time objects and we no longer need to specially track the function activation frame for access to out vars. R=rsc APPROVED=rsc DELTA=313 (102 added, 90 deleted, 121 changed) OCL=32416 CL=32420
2009-07-28Implement if, for (modulo ranges), break, continue, increment,Austin Clements1-2/+16
and decrement. blockCompilers now form a tree the mimics the nesting of scopes and provide convenient ways to enter and exit scopes. blockCompilers also track the break and continue PC for the current block. The statement testing interface now works in lists of statements, which simplifies a bunch of things. R=rsc APPROVED=rsc DELTA=401 (335 added, 44 deleted, 22 changed) OCL=32308 CL=32317
2009-07-27Implement multi-valued functions, multi-valued return, andAustin Clements1-1/+5
unpacking for assignments, call arguments, and returns. This change revamps the whole assignment compilation system to be multi-valued, using the new MultiType type and multiV value. Function calls, returns, and assignments now share a lot of code and produce very consistent error messages. R=rsc APPROVED=rsc DELTA=510 (335 added, 74 deleted, 101 changed) OCL=32248 CL=32258
2009-07-27Implement single-valued, non-variadic function literals andAustin Clements1-0/+79
function calling. Implement a type compiler and named types. Implement a universal scope containing built-in named types, and some built-in constants. Implement a simple virtual machine for executing statements and single-valued return. Fix many places that incorrectly dealt with named types. In particular, the Type.Zero methods now use the type's bit count to determine the appropriate value representation. As a result, a bit count of 0 now means architecture-dependent and bounded types use unsafe.Sizeof to determine the correct bounds. Previously, the bounds on a 32-bit machine would have been wrong. Eliminated Type.compatible, since the implementation is equivalent for all types. Added Type.rep that shallowly strips named types. Replaced almost all uses of Type.literal with Type.rep. Fix implementation of assign-op's so it only evaluates the left side once. As part of this, there is now a generic way to separate out the effect and value of an expression. R=rsc APPROVED=rsc DELTA=1530 (1244 added, 68 deleted, 218 changed) OCL=32184 CL=32230