Annotate bitwise013_2

This commit is contained in:
Matt Mascarenhas 2018-04-09 19:37:02 +01:00
parent 305275829a
commit 942acbebd8
1 changed files with 49 additions and 1 deletions

View File

@ -1,2 +1,50 @@
[video member=pervognsen stream_platform=twitch project=bitwise title="More Code Generation, Part 2" vod_platform=youtube id=PVnRVadB7g0 annotator=] [video member=pervognsen stream_platform=twitch project=bitwise title="More Code Generation, Part 2" vod_platform=youtube id=PVnRVadB7g0 annotator=Miblo]
[0:19][:Run it to find that it remains slower than before, and continue to investigate why][:performance]
[2:28][@badflydog][You enabled type checking, also check if you're in debug]
[2:44][Regenerate test3.ion and :run Ion on it]
[3:24][@praet_a51][Would capturing samples account for the drop in :performance?]
[3:33][Note that our total CPU time is lower][:performance :run]
[4:05][Consult our diff with the committed code, noting that the hash function has changed][:performance :research]
[5:28][Forget about the :performance regression for now, and determine to emit #line directives[ref
site="The C Preprocessor"
page="Line Control"
url=https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html] respecting the #include directive, to enable line-level debugging][:"code generation" :speech]
[9:03][Enable gen_stmt() to emit #line directives][:"code generation"]
[10:40][:Run it to see what that does to our test file][:"code generation"]
[11:24][Rename SrcLoc, curr_loc and prev_loc to SrcPos, curr_pos and prev_pos][:"code generation"]
[15:30][Make most all of the decl_*(), expr_*(), stmt_*() and typespec_*() functions take a SrcPos][:"code generation"]
[21:31][Add a SrcPos pos to the Token, CompoundField and StmtList structs for all the parse*() functions to use][:"code generation"]
[38:59][:Run it to see how much stuff got screwed up (spoiler: none)][:"code generation" :parsing]
[40:27][Introduce genpos() to perform our own line tracking and avoid inserting unnecessary #line directives][:"code generation"]
[44:03][:Run it and compare the line numbering of our Ion and generated C code][:"code generation"]
[45:50][Introduce a Sym **global_syms_list for finalize_syms() to use rather than a Map global_syms_map (renamed from global_syms) array][:"code generation"]
[48:42][:Run it to see that it generates consistent, if reordered, code][:"code generation"]
[49:34][Rename global_syms_list to global_syms_buf][:"code generation"]
[49:52][:Run it to confirm it still works][:"code generation"]
[50:00][Recap the day's work][:"code generation" :speech]
[51:31][Q&A][:speech]
[52:01][@pmttavara][You can use the code-aware rename tool (Ctrl-R-R) to change the name of the member of a data structure and VS will rename all references]
[52:38][@badflydog][@pervognsen Will we generate a main directly or generate a main wrapper?][:"code generation"]
[53:04][Add a func main in test1.ion, and some stock preamble code in gen.c][:"code generation"]
[55:10][Add support for extern functions, introducing sym_global_func() for init_global_syms to call on "putchar"][:"code generation"]
[59:15][Add a putc() call in test1.ion][:"code generation"]
[59:34][:Run it and crash in resolve_func_body()][:"code generation"]
[1:00:09][Fix finalize_syms() to only call finalize_sym() if(sym->decl), resolve_stmt() to handle the STMT_EXPR case, and test1.ion to call putchar()][:"code generation"]
[1:01:57][:Run it to find that it worked][:"code generation"]
[1:02:16][Pass "puts" to the sym_global_func() call in init_global_syms(), changing test1.ion to call puts() on "Hello, world!"][:"code generation"]
[1:03:20][Compile and :run Ion on test1.ion, to see our "Hello, world!"][:"code generation"]
[1:04:00][@pmttavara][@pervognsen Shouldn't you be able to right-click on the menu bar and enable the "Standard" view for quick switching between release and debug?]
[1:04:18][Setup a new test_project project using our generated test1.c][:admin :"code generation"]
[1:06:46][:Run it and try breaking in to our source test1.ion][:"code generation"]
[1:07:42][Recap the steps to get this line-stepping to work][:"code generation" :speech]
[1:09:05][Declare b as the result of example_test()][:"code generation"]
[1:09:33][Break on that declaration, and inspect the :asm][:run]
[1:10:03][@heasummn][@pervognsen Use the factorial?]
[1:10:10][Step in to that declaration of b, to see that it goes to the generated C code of example_test()][:run]
[1:11:22][Enable gen_func() to generate #line directives for declarations, renaming genpos() to gen_pos()][:"code generation"]
[1:12:03][:Run it, inspect the C file, and try successfully to step in to our example_test() call in the declaration of b][:"code generation"]
[1:13:15][@pmttavara][It seems like you ought to just print a #line statement on every line...][:"code generation"]
[1:14:27][@barubro][Q: Does Ion support #define?][:language]
[1:15:20][Step through our Ion code, enjoying it but lamenting the fact that we can't hover over stuff][:"code generation" :run]
[1:16:25][Turn off the stream][:speech]
[/video] [/video]