We are currently in the process of converting the website to the new design. Some pages, like this one, are still broken. We appreciate your patience.
Bitwise»Episode Guide
More Code Generation, Part 2
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:19Run it to find that it remains slower than before, and continue to investigate why
🏃
0:19Run it to find that it remains slower than before, and continue to investigate why
🏃
0:19Run it to find that it remains slower than before, and continue to investigate why
🏃
2:28badflydog You enabled type checking, also check if you're in debug
🗪
2:28badflydog You enabled type checking, also check if you're in debug
🗪
2:28badflydog You enabled type checking, also check if you're in debug
🗪
2:44Regenerate test3.ion and run Ion on it
🏃
2:44Regenerate test3.ion and run Ion on it
🏃
2:44Regenerate test3.ion and run Ion on it
🏃
3:24praet_a51 Would capturing samples account for the drop in performance?
🗪
3:24praet_a51 Would capturing samples account for the drop in performance?
🗪
3:24praet_a51 Would capturing samples account for the drop in performance?
🗪
3:33Note that our total CPU time is lower
🏃
3:33Note that our total CPU time is lower
🏃
3:33Note that our total CPU time is lower
🏃
4:05Consult our diff with the committed code, noting that the hash function has changed
📖
4:05Consult our diff with the committed code, noting that the hash function has changed
📖
4:05Consult our diff with the committed code, noting that the hash function has changed
📖
5:28Forget about the performance regression for now, and determine to emit #line directives1 respecting the #include directive, to enable line-level debugging
🗩
5:28Forget about the performance regression for now, and determine to emit #line directives1 respecting the #include directive, to enable line-level debugging
🗩
5:28Forget about the performance regression for now, and determine to emit #line directives1 respecting the #include directive, to enable line-level debugging
🗩
9:03Enable gen_stmt() to emit #line directives
9:03Enable gen_stmt() to emit #line directives
9:03Enable gen_stmt() to emit #line directives
10:40Run it to see what that does to our test file
🏃
10:40Run it to see what that does to our test file
🏃
10:40Run it to see what that does to our test file
🏃
11:24Rename SrcLoc, curr_loc and prev_loc to SrcPos, curr_pos and prev_pos
11:24Rename SrcLoc, curr_loc and prev_loc to SrcPos, curr_pos and prev_pos
11:24Rename SrcLoc, curr_loc and prev_loc to SrcPos, curr_pos and prev_pos
15:30Make most all of the decl_*(), expr_*(), stmt_*() and typespec_*() functions take a SrcPos
15:30Make most all of the decl_*(), expr_*(), stmt_*() and typespec_*() functions take a SrcPos
15:30Make most all of the decl_*(), expr_*(), stmt_*() and typespec_*() functions take a SrcPos
21:31Add a SrcPos pos to the Token, CompoundField and StmtList structs for all the parse*() functions to use
21:31Add a SrcPos pos to the Token, CompoundField and StmtList structs for all the parse*() functions to use
21:31Add a SrcPos pos to the Token, CompoundField and StmtList structs for all the parse*() functions to use
38:59Run it to see how much stuff got screwed up (spoiler: none)
🏃
38:59Run it to see how much stuff got screwed up (spoiler: none)
🏃
38:59Run it to see how much stuff got screwed up (spoiler: none)
🏃
40:27Introduce genpos() to perform our own line tracking and avoid inserting unnecessary #line directives
40:27Introduce genpos() to perform our own line tracking and avoid inserting unnecessary #line directives
40:27Introduce genpos() to perform our own line tracking and avoid inserting unnecessary #line directives
44:03Run it and compare the line numbering of our Ion and generated C code
🏃
44:03Run it and compare the line numbering of our Ion and generated C code
🏃
44:03Run it and compare the line numbering of our Ion and generated C code
🏃
45:50Introduce a Sym **global_syms_list for finalize_syms() to use rather than a Map global_syms_map (renamed from global_syms) array
45:50Introduce a Sym **global_syms_list for finalize_syms() to use rather than a Map global_syms_map (renamed from global_syms) array
45:50Introduce a Sym **global_syms_list for finalize_syms() to use rather than a Map global_syms_map (renamed from global_syms) array
48:42Run it to see that it generates consistent, if reordered, code
🏃
48:42Run it to see that it generates consistent, if reordered, code
🏃
48:42Run it to see that it generates consistent, if reordered, code
🏃
49:34Rename global_syms_list to global_syms_buf
49:34Rename global_syms_list to global_syms_buf
49:34Rename global_syms_list to global_syms_buf
49:52Run it to confirm it still works
🏃
49:52Run it to confirm it still works
🏃
49:52Run it to confirm it still works
🏃
50:00Recap the day's work
🗩
50:00Recap the day's work
🗩
50:00Recap the day's work
🗩
51:31Q&A
🗩
51:31Q&A
🗩
51:31Q&A
🗩
52:01pmttavara 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:01pmttavara 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:01pmttavara 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:38badflydog pervognsen Will we generate a main directly or generate a main wrapper?
🗪
52:38badflydog pervognsen Will we generate a main directly or generate a main wrapper?
🗪
52:38badflydog pervognsen Will we generate a main directly or generate a main wrapper?
🗪
53:04Add a func main in test1.ion, and some stock preamble code in gen.c
53:04Add a func main in test1.ion, and some stock preamble code in gen.c
53:04Add a func main in test1.ion, and some stock preamble code in gen.c
55:10Add support for extern functions, introducing sym_global_func() for init_global_syms to call on "putchar"
55:10Add support for extern functions, introducing sym_global_func() for init_global_syms to call on "putchar"
55:10Add support for extern functions, introducing sym_global_func() for init_global_syms to call on "putchar"
59:15Add a putc() call in test1.ion
59:15Add a putc() call in test1.ion
59:15Add a putc() call in test1.ion
59:34Run it and crash in resolve_func_body()
🏃
59:34Run it and crash in resolve_func_body()
🏃
59:34Run it and crash in resolve_func_body()
🏃
1:00:09Fix finalize_syms() to only call finalize_sym() if(sym->decl), resolve_stmt() to handle the STMT_EXPR case, and test1.ion to call putchar()
1:00:09Fix finalize_syms() to only call finalize_sym() if(sym->decl), resolve_stmt() to handle the STMT_EXPR case, and test1.ion to call putchar()
1:00:09Fix finalize_syms() to only call finalize_sym() if(sym->decl), resolve_stmt() to handle the STMT_EXPR case, and test1.ion to call putchar()
1:01:57Run it to find that it worked
🏃
1:01:57Run it to find that it worked
🏃
1:01:57Run it to find that it worked
🏃
1:02:16Pass "puts" to the sym_global_func() call in init_global_syms(), changing test1.ion to call puts() on "Hello, world!"
1:02:16Pass "puts" to the sym_global_func() call in init_global_syms(), changing test1.ion to call puts() on "Hello, world!"
1:02:16Pass "puts" to the sym_global_func() call in init_global_syms(), changing test1.ion to call puts() on "Hello, world!"
1:03:20Compile and run Ion on test1.ion, to see our "Hello, world!"
🏃
1:03:20Compile and run Ion on test1.ion, to see our "Hello, world!"
🏃
1:03:20Compile and run Ion on test1.ion, to see our "Hello, world!"
🏃
1:04:00pmttavara 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:00pmttavara 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:00pmttavara 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:18Setup a new test_project project using our generated test1.c
🗹
1:04:18Setup a new test_project project using our generated test1.c
🗹
1:04:18Setup a new test_project project using our generated test1.c
🗹
1:06:46Run it and try breaking in to our source test1.ion
🏃
1:06:46Run it and try breaking in to our source test1.ion
🏃
1:06:46Run it and try breaking in to our source test1.ion
🏃
1:07:42Recap the steps to get this line-stepping to work
🗩
1:07:42Recap the steps to get this line-stepping to work
🗩
1:07:42Recap the steps to get this line-stepping to work
🗩
1:09:05Declare b as the result of example_test()
1:09:05Declare b as the result of example_test()
1:09:05Declare b as the result of example_test()
1:09:33Break on that declaration, and inspect the asm
🏃
1:09:33Break on that declaration, and inspect the asm
🏃
1:09:33Break on that declaration, and inspect the asm
🏃
1:10:03heasummn pervognsen Use the factorial?
🗪
1:10:03heasummn pervognsen Use the factorial?
🗪
1:10:03heasummn pervognsen Use the factorial?
🗪
1:10:10Step in to that declaration of b, to see that it goes to the generated C code of example_test()
🏃
1:10:10Step in to that declaration of b, to see that it goes to the generated C code of example_test()
🏃
1:10:10Step in to that declaration of b, to see that it goes to the generated C code of example_test()
🏃
1:11:22Enable gen_func() to generate #line directives for declarations, renaming genpos() to gen_pos()
1:11:22Enable gen_func() to generate #line directives for declarations, renaming genpos() to gen_pos()
1:11:22Enable gen_func() to generate #line directives for declarations, renaming genpos() to gen_pos()
1:12:03Run it, inspect the C file, and try successfully to step in to our example_test() call in the declaration of b
🏃
1:12:03Run it, inspect the C file, and try successfully to step in to our example_test() call in the declaration of b
🏃
1:12:03Run it, inspect the C file, and try successfully to step in to our example_test() call in the declaration of b
🏃
1:13:15pmttavara It seems like you ought to just print a #line statement on every line...
🗪
1:13:15pmttavara It seems like you ought to just print a #line statement on every line...
🗪
1:13:15pmttavara It seems like you ought to just print a #line statement on every line...
🗪
1:14:27barubro Q: Does Ion support #define?
🗪
1:14:27barubro Q: Does Ion support #define?
🗪
1:14:27barubro Q: Does Ion support #define?
🗪
1:15:20Step through our Ion code, enjoying it but lamenting the fact that we can't hover over stuff
🏃
1:15:20Step through our Ion code, enjoying it but lamenting the fact that we can't hover over stuff
🏃
1:15:20Step through our Ion code, enjoying it but lamenting the fact that we can't hover over stuff
🏃
1:16:25Turn off the stream
🗩
1:16:25Turn off the stream
🗩
1:16:25Turn off the stream
🗩