WEBVTT

1
00:00:02.080 --> 00:00:07.100
<00:00:02.080>So, <00:00:02.207>we <00:00:02.334>have <00:00:02.461>Gaurab <00:00:02.589>with <00:00:02.716>us, <00:00:02.843>staff <00:00:02.970>software <00:00:03.098>engineer <00:00:03.225>at <00:00:03.352>INS <00:00:03.480>Cloud.

2
00:00:07.560 --> 00:00:12.740
<00:00:07.560>There's <00:00:07.793>a <00:00:08.026>silent <00:00:08.260>presentation <00:00:08.493>so <00:00:08.726>that <00:00:08.959>you'll

3
00:00:12.740 --> 00:00:15.500
<00:00:12.740>need <00:00:12.973>a <00:00:13.206>headphone <00:00:13.440>to <00:00:13.673>hear <00:00:13.906>yourself <00:00:14.140>out.

4
00:00:15.760 --> 00:00:21.100
<00:00:15.760>And <00:00:15.833>if <00:00:15.907>you <00:00:15.981>have <00:00:16.054>any <00:00:16.128>question, <00:00:16.202>just <00:00:16.275>please <00:00:16.349>feel <00:00:16.423>free <00:00:16.496>to <00:00:16.570>post <00:00:16.644>them <00:00:16.717>on <00:00:16.791>the <00:00:16.865>app <00:00:16.938>and <00:00:17.012>we <00:00:17.086>can <00:00:17.160>check

5
00:00:21.100 --> 00:00:21.700
<00:00:21.100>them <00:00:21.370>out <00:00:21.640>later.

6
00:00:34.753 --> 00:00:38.313
<00:00:34.753>OK, <00:00:34.835>I <00:00:34.917>hope <00:00:35.000>you <00:00:35.082>can <00:00:35.164>hear <00:00:35.247>me <00:00:35.329>because <00:00:35.411>I <00:00:35.494>have <00:00:35.576>no <00:00:35.658>idea <00:00:35.741>if <00:00:35.823>you <00:00:35.905>guys <00:00:35.988>can <00:00:36.070>hear <00:00:36.153>me.

7
00:00:39.013 --> 00:00:39.933
<00:00:39.013>This <00:00:39.289>is <00:00:39.565>so <00:00:39.841>weird.

8
00:00:42.613 --> 00:00:43.853
<00:00:42.613>OK, <00:00:42.985>let's <00:00:43.357>get <00:00:43.729>started.

9
00:00:43.993 --> 00:00:49.013
<00:00:43.993>I <00:00:44.133>hope <00:00:44.273>the <00:00:44.413>font <00:00:44.553>is <00:00:44.693>visible <00:00:44.833>and <00:00:44.973>if <00:00:45.113>everything <00:00:45.253>is <00:00:45.393>OK,

10
00:00:49.193 --> 00:00:51.753
<00:00:49.193>I <00:00:49.367>will <00:00:49.543>zoom <00:00:49.718>in <00:00:49.893>if <00:00:50.068>required, <00:00:50.242>but <00:00:50.418>I <00:00:50.593>hope

11
00:00:51.753 --> 00:00:53.353
<00:00:51.753>it's <00:00:51.953>not <00:00:52.153>hurting <00:00:52.353>your <00:00:52.553>eyes <00:00:52.753>and <00:00:52.953>it's <00:00:53.153>visible.

12
00:00:56.147 --> 00:01:01.227
<00:00:56.147>this <00:00:56.254>is <00:00:56.362>so <00:00:56.470>weird. <00:00:56.577>All <00:00:56.685>right. <00:00:56.793>So <00:00:56.900>I'll <00:00:57.008>be <00:00:57.116>talking <00:00:57.223>about <00:00:57.331>WebAssembly. <00:00:57.439>It's <00:00:57.547>a

13
00:01:01.227 --> 00:01:01.967
<00:01:01.227>small <00:01:01.559>project <00:01:01.893>that

14
00:01:01.967 --> 00:01:06.987
<00:01:01.967>I <00:01:02.074>did <00:01:02.182>for <00:01:02.290>fun <00:01:02.397>and <00:01:02.505>learning. <00:01:02.613>And <00:01:02.720>let's <00:01:02.828>jump <00:01:02.936>right <00:01:03.043>in. <00:01:03.151>My <00:01:03.259>name <00:01:03.367>is

15
00:01:06.987 --> 00:01:08.607
<00:01:06.987>Gaurav. <00:01:07.336>I'm <00:01:07.687>a <00:01:08.036>staff <00:01:08.387>engineer

16
00:01:08.607 --> 00:01:13.367
<00:01:08.607>with <00:01:08.689>Ionus <00:01:08.771>Cloud. <00:01:08.854>I <00:01:08.936>recently <00:01:09.018>moved <00:01:09.101>to <00:01:09.183>Berlin, <00:01:09.265>so <00:01:09.348>I'm <00:01:09.430>super <00:01:09.512>new. <00:01:09.595>And <00:01:09.677>I'm <00:01:09.759>liking <00:01:09.842>it <00:01:09.924>so <00:01:10.007>far.

17
00:01:13.907 --> 00:01:19.207
<00:01:13.907>I <00:01:14.000>do <00:01:14.093>have <00:01:14.187>Twitter <00:01:14.280>or <00:01:14.373>X, <00:01:14.467>whatever <00:01:14.560>you <00:01:14.653>call <00:01:14.747>it, <00:01:14.840>but <00:01:14.933>I <00:01:15.027>don't <00:01:15.120>really <00:01:15.213>tweet. <00:01:15.307>This

18
00:01:19.207 --> 00:01:19.767
<00:01:19.207>is <00:01:19.458>my <00:01:19.711>GitHub

19
00:01:19.767 --> 00:01:23.427
<00:01:19.767>handle, <00:01:19.883>and <00:01:20.000>I'm <00:01:20.116>a <00:01:20.233>maintainer <00:01:20.350>for <00:01:20.467>Akri, <00:01:20.583>which <00:01:20.700>is <00:01:20.817>a <00:01:20.933>CNCF <00:01:21.050>sandbox <00:01:21.167>project.

20
00:01:24.221 --> 00:01:29.281
<00:01:24.221>It's <00:01:24.361>about <00:01:24.501>making <00:01:24.641>your <00:01:24.781>edge <00:01:24.921>devices <00:01:25.061>available <00:01:25.201>inside <00:01:25.341>the <00:01:25.481>Kubernetes <00:01:25.621>cluster

21
00:01:29.281 --> 00:01:30.461
<00:01:29.281>just <00:01:29.812>so <00:01:30.343>you

22
00:01:30.461 --> 00:01:35.741
<00:01:30.461>can <00:01:30.561>use <00:01:30.661>them <00:01:30.761>or <00:01:30.861>request <00:01:30.961>them <00:01:31.061>very <00:01:31.161>much <00:01:31.261>like <00:01:31.361>you <00:01:31.461>request <00:01:31.561>CPU, <00:01:31.661>RAM, <00:01:31.761>and <00:01:31.861>all

23
00:01:35.741 --> 00:01:36.061
<00:01:35.741>those <00:01:36.029>things.

24
00:01:36.461 --> 00:01:38.661
<00:01:36.461>I'm <00:01:36.661>also <00:01:36.861>working <00:01:37.061>on <00:01:37.261>a <00:01:37.461>project <00:01:37.661>called <00:01:37.861>KubeDRA.

25
00:01:38.861 --> 00:01:44.261
<00:01:38.860>It's <00:01:39.016>about <00:01:39.172>writing <00:01:39.327>device <00:01:39.483>plug <00:01:39.638>-in <00:01:39.794>dynamic <00:01:39.949>resource <00:01:40.105>allocation <00:01:40.261>drivers

26
00:01:44.261 --> 00:01:45.341
<00:01:44.261>in <00:01:45.233>Rust.

27
00:01:45.881 --> 00:01:50.341
<00:01:45.881>And <00:01:45.963>if <00:01:46.045>you <00:01:46.128>know <00:01:46.210>about <00:01:46.292>it, <00:01:46.375>it's <00:01:46.457>a <00:01:46.539>provisioning <00:01:46.622>engine <00:01:46.704>that <00:01:46.786>I <00:01:46.869>contributed <00:01:46.951>to <00:01:47.033>a <00:01:47.116>few <00:01:47.198>years <00:01:47.281>ago.

28
00:01:50.341 --> 00:01:52.221
So

29
00:01:52.295 --> 00:01:54.035
<00:01:52.295>So <00:01:52.645>let's <00:01:52.995>get <00:01:53.345>it <00:01:53.695>started.

30
00:01:54.695 --> 00:01:57.795
<00:01:54.695>So <00:01:54.895>WebAssembly <00:01:55.095>is <00:01:55.294>actually <00:01:55.494>neither <00:01:55.695>web <00:01:55.895>nor <00:01:56.095>assembly.

31
00:01:58.215 --> 00:01:59.175
<00:01:58.215>Why <00:01:58.647>is <00:01:59.079>that?

32
00:01:59.435 --> 00:02:04.375
<00:01:59.435>Because <00:01:59.522>it <00:01:59.610>was <00:01:59.697>initially <00:01:59.785>started <00:01:59.872>as <00:01:59.960>a <00:02:00.047>project <00:02:00.135>that <00:02:00.222>was <00:02:00.310>aimed <00:02:00.397>to <00:02:00.485>only <00:02:00.572>deal <00:02:00.660>with <00:02:00.747>web, <00:02:00.835>but

33
00:02:04.375 --> 00:02:09.395
<00:02:04.375>eventually <00:02:04.482>turned <00:02:04.590>out <00:02:04.698>that <00:02:04.805>it's <00:02:04.913>super <00:02:05.021>useful <00:02:05.128>and <00:02:05.236>it's <00:02:05.344>super <00:02:05.451>tiny <00:02:05.559>that <00:02:05.667>it's <00:02:05.775>got

34
00:02:09.395 --> 00:02:10.395
<00:02:09.395>more <00:02:10.295>and

35
00:02:10.395 --> 00:02:12.415
<00:02:10.395>more <00:02:10.675>adoption <00:02:10.955>and <00:02:11.235>towards <00:02:11.515>edge <00:02:11.795>specifically.

36
00:02:12.975 --> 00:02:18.035
<00:02:12.975>It's <00:02:13.075>not <00:02:13.174>assembly <00:02:13.275>as <00:02:13.375>well, <00:02:13.475>because <00:02:13.575>what <00:02:13.674>we <00:02:13.775>do <00:02:13.875>with <00:02:13.975>web <00:02:14.075>when <00:02:14.174>we <00:02:14.275>write <00:02:14.375>some

37
00:02:18.035 --> 00:02:18.695
<00:02:18.035>code <00:02:18.233>in <00:02:18.430>a <00:02:18.629>higher

38
00:02:18.695 --> 00:02:20.135
<00:02:18.695>language, <00:02:19.019>in <00:02:19.343>a <00:02:19.667>higher <00:02:19.991>language.

39
00:02:20.369 --> 00:02:25.649
<00:02:20.369>It <00:02:20.469>then <00:02:20.569>compiles <00:02:20.669>into <00:02:20.769>a <00:02:20.869>byte <00:02:20.969>code <00:02:21.069>which <00:02:21.169>eventually <00:02:21.269>can <00:02:21.369>run <00:02:21.469>on <00:02:21.569>any <00:02:21.669>platform, <00:02:21.769>any

40
00:02:25.649 --> 00:02:26.689
<00:02:25.649>operating <00:02:26.584>system

41
00:02:26.689 --> 00:02:27.289
<00:02:26.689>and <00:02:26.869>all <00:02:27.048>that <00:02:27.228>stuff.

42
00:02:27.429 --> 00:02:31.449
<00:02:27.429>So, <00:02:27.569>it's <00:02:27.709>not <00:02:27.849>something <00:02:27.989>that <00:02:28.129>you <00:02:28.269>run <00:02:28.409>directly <00:02:28.549>on <00:02:28.689>your <00:02:28.829>machine.

43
00:02:32.529 --> 00:02:37.269
<00:02:32.529>Let's <00:02:32.611>take <00:02:32.693>a <00:02:32.776>closer <00:02:32.858>look <00:02:32.940>and <00:02:33.023>everything <00:02:33.105>will <00:02:33.187>start <00:02:33.270>to <00:02:33.352>fit <00:02:33.434>in <00:02:33.517>and <00:02:33.599>make <00:02:33.681>sense <00:02:33.764>when <00:02:33.846>we <00:02:33.929>look

44
00:02:37.269 --> 00:02:38.989
<00:02:37.269>at <00:02:37.502>an <00:02:37.735>example <00:02:37.969>with, <00:02:38.202>let's <00:02:38.435>say, <00:02:38.669>Java.

45
00:02:39.589 --> 00:02:43.729
<00:02:39.589>So, <00:02:39.764>Java <00:02:39.939>has <00:02:40.114>been <00:02:40.289>known <00:02:40.464>for <00:02:40.639>its <00:02:40.814>JVM <00:02:40.989>environment.

46
00:02:43.729 --> 00:02:47.469
<00:02:43.728>What <00:02:43.828>you <00:02:43.928>do <00:02:44.029>is <00:02:44.129>you <00:02:44.228>write <00:02:44.328>Java <00:02:44.428>code, <00:02:44.529>you <00:02:44.629>compile <00:02:44.728>it, <00:02:44.828>and <00:02:44.928>it <00:02:45.029>gets <00:02:45.129>into...

47
00:02:48.443 --> 00:02:51.203
<00:02:48.442>into <00:02:48.582>a <00:02:48.722>bytecode <00:02:48.862>format <00:02:49.003>which <00:02:49.142>you <00:02:49.283>can <00:02:49.422>run <00:02:49.563>with <00:02:49.702>a <00:02:49.843>JVM.

48
00:02:51.603 --> 00:02:55.343
<00:02:51.603>The <00:02:51.836>same <00:02:52.069>idea <00:02:52.303>was <00:02:52.536>taken <00:02:52.769>and <00:02:53.003>borrowed,

49
00:02:55.543 --> 00:02:58.743
<00:02:55.543>so <00:02:55.743>you <00:02:55.943>write <00:02:56.143>a <00:02:56.343>program <00:02:56.543>in <00:02:56.743>any <00:02:56.943>language,

50
00:02:58.963 --> 00:03:02.223
<00:02:58.963>be <00:02:59.090>it <00:02:59.217>Go, <00:02:59.344>be <00:02:59.472>it <00:02:59.599>Rust, <00:02:59.726>be <00:02:59.853>it <00:02:59.981>C, <00:03:00.108>ZIG, <00:03:00.235>or <00:03:00.363>whatever.

51
00:03:02.663 --> 00:03:04.883
<00:03:02.663>You <00:03:02.896>compile <00:03:03.129>it <00:03:03.363>into <00:03:03.596>a <00:03:03.829>WASM <00:03:04.063>bytecode.

52
00:03:05.023 --> 00:03:08.863
<00:03:05.023>Now, <00:03:05.222>this <00:03:05.423>bytecode <00:03:05.623>cannot <00:03:05.823>run <00:03:06.023>directly <00:03:06.222>onto <00:03:06.423>hardware,

53
00:03:09.103 --> 00:03:10.443
<00:03:09.103>so <00:03:09.404>you <00:03:09.706>need <00:03:10.007>a <00:03:10.309>runtime.

54
00:03:10.803 --> 00:03:14.863
<00:03:10.803>That <00:03:10.978>runtime <00:03:11.153>could <00:03:11.328>either <00:03:11.503>work <00:03:11.678>in <00:03:11.853>an <00:03:12.028>interpreter <00:03:12.203>mode,

55
00:03:14.923 --> 00:03:15.883
<00:03:14.923>which <00:03:15.355>WISP <00:03:15.787>does.

56
00:03:16.517 --> 00:03:18.137
<00:03:16.517>It <00:03:16.797>could <00:03:17.077>also <00:03:17.357>do <00:03:17.637>JIT <00:03:17.917>compilation.

57
00:03:18.977 --> 00:03:21.617
<00:03:18.977>There <00:03:19.210>is <00:03:19.443>some <00:03:19.677>called <00:03:19.910>optimized <00:03:20.143>JIT <00:03:20.377>compilation.

58
00:03:21.817 --> 00:03:22.897
<00:03:21.817>It <00:03:22.060>could <00:03:22.303>also <00:03:22.546>do <00:03:22.789>AOT.

59
00:03:23.297 --> 00:03:25.597
<00:03:23.297>And <00:03:23.530>then <00:03:23.763>you <00:03:23.997>execute <00:03:24.230>the <00:03:24.463>same <00:03:24.697>code

60
00:03:25.597 --> 00:03:27.337
<00:03:25.597>that <00:03:25.797>you <00:03:25.997>wrote <00:03:26.197>in <00:03:26.397>a <00:03:26.597>higher <00:03:26.797>language, <00:03:26.997>eventually,

61
00:03:27.557 --> 00:03:30.557
<00:03:27.557>as <00:03:27.684>there <00:03:27.811>was <00:03:27.938>a <00:03:28.066>module <00:03:28.193>on <00:03:28.320>any <00:03:28.447>architecture <00:03:28.575>with <00:03:28.702>R1 <00:03:28.829>or <00:03:28.957>X64.

62
00:03:30.897 --> 00:03:33.377
<00:03:30.897>So <00:03:31.072>it's <00:03:31.247>the <00:03:31.422>same <00:03:31.596>idea <00:03:31.772>that <00:03:31.947>JVM <00:03:32.122>was <00:03:32.297>carrying,

63
00:03:33.557 --> 00:03:35.977
<00:03:33.557>but <00:03:33.907>it's <00:03:34.257>sandboxed <00:03:34.607>by <00:03:34.957>default.

64
00:03:36.137 --> 00:03:39.477
<00:03:36.137>When <00:03:36.277>you <00:03:36.417>write <00:03:36.557>a <00:03:36.697>Java <00:03:36.837>program, <00:03:36.977>compile <00:03:37.117>it <00:03:37.257>to <00:03:37.397>a <00:03:37.537>bytecode,

65
00:03:39.597 --> 00:03:40.617
<00:03:39.597>it's <00:03:39.903>open <00:03:40.209>by <00:03:40.515>default.

66
00:03:40.797 --> 00:03:43.177
<00:03:40.797>But <00:03:41.030>WebAssembly <00:03:41.263>gives <00:03:41.497>you <00:03:41.730>closed <00:03:41.963>by <00:03:42.197>default.

67
00:03:44.591 --> 00:03:46.471
<00:03:44.591>So <00:03:44.791>everything <00:03:44.991>in <00:03:45.191>a <00:03:45.391>Wasm <00:03:45.591>module <00:03:45.791>is <00:03:45.991>denied.

68
00:03:46.551 --> 00:03:49.651
<00:03:46.551>You <00:03:46.726>only <00:03:46.900>get <00:03:47.076>access <00:03:47.250>when <00:03:47.426>you <00:03:47.601>really <00:03:47.775>need <00:03:47.951>it.

69
00:03:51.091 --> 00:03:52.991
<00:03:51.091>So <00:03:51.441>it's <00:03:51.791>just <00:03:52.141>another <00:03:52.491>bytecode.

70
00:03:53.171 --> 00:03:55.031
<00:03:53.171>It's <00:03:53.451>not <00:03:53.731>specifically <00:03:54.011>designed <00:03:54.291>for <00:03:54.571>web.

71
00:03:55.231 --> 00:03:57.531
<00:03:55.231>It <00:03:55.511>was <00:03:55.791>started <00:03:56.071>in <00:03:56.351>that <00:03:56.631>idea.

72
00:03:57.951 --> 00:04:01.491
<00:03:57.951>But <00:03:58.106>it's <00:03:58.262>a <00:03:58.417>bytecode <00:03:58.573>that <00:03:58.728>can <00:03:58.884>run <00:03:59.039>on <00:03:59.195>any <00:03:59.351>platform.

73
00:04:01.711 --> 00:04:03.071
<00:04:01.711>It's <00:04:02.119>secured <00:04:02.527>by <00:04:02.935>default.

74
00:04:03.211 --> 00:04:04.951
<00:04:03.211>Like <00:04:03.444>I <00:04:03.677>said, <00:04:03.911>it's <00:04:04.144>sandbox, <00:04:04.377>which <00:04:04.611>means

75
00:04:04.951 --> 00:04:07.271
<00:04:04.951>it's <00:04:05.301>not <00:04:05.650>accessing <00:04:06.001>your <00:04:06.351>host.

76
00:04:07.331 --> 00:04:10.991
<00:04:07.331>It's <00:04:07.564>not <00:04:07.797>accessing <00:04:08.030>anything <00:04:08.264>outside <00:04:08.497>the <00:04:08.731>boundary

77
00:04:10.991 --> 00:04:12.291
<00:04:10.991>of <00:04:11.381>that <00:04:11.771>Wasm <00:04:12.161>module.

78
00:04:12.664 --> 00:04:17.844
<00:04:12.664>It <00:04:12.763>only <00:04:12.863>and <00:04:12.964>only <00:04:13.064>sends <00:04:13.164>requests <00:04:13.263>to <00:04:13.363>the <00:04:13.464>host <00:04:13.564>and <00:04:13.664>if <00:04:13.763>the <00:04:13.863>host <00:04:13.964>permits <00:04:14.064>that

79
00:04:17.844 --> 00:04:19.044
<00:04:17.844>you <00:04:18.204>can <00:04:18.563>do <00:04:18.923>that.

80
00:04:19.184 --> 00:04:24.404
<00:04:19.184>For <00:04:19.284>example, <00:04:19.384>let's <00:04:19.484>say <00:04:19.584>if <00:04:19.684>my <00:04:19.784>module <00:04:19.884>wants <00:04:19.984>to <00:04:20.084>write <00:04:20.184>to <00:04:20.284>a <00:04:20.384>file, <00:04:20.484>it <00:04:20.584>cannot

81
00:04:24.404 --> 00:04:25.224
<00:04:24.404>do <00:04:24.772>it <00:04:25.142>until

82
00:04:25.224 --> 00:04:30.104
<00:04:25.224>and <00:04:25.317>unless <00:04:25.410>it <00:04:25.503>has <00:04:25.597>some <00:04:25.690>functions <00:04:25.784>that <00:04:25.877>are <00:04:25.970>provided <00:04:26.063>by <00:04:26.157>the <00:04:26.250>host, <00:04:26.344>which <00:04:26.437>is <00:04:26.530>the <00:04:26.623>runtime,

83
00:04:30.924 --> 00:04:33.204
<00:04:30.924>and <00:04:31.099>only <00:04:31.274>then <00:04:31.448>it <00:04:31.623>can <00:04:31.799>write <00:04:31.974>to <00:04:32.149>that <00:04:32.323>file.

84
00:04:34.444 --> 00:04:39.544
<00:04:34.444>In <00:04:34.537>terms <00:04:34.630>of <00:04:34.724>performance, <00:04:34.817>it's <00:04:34.910>near <00:04:35.004>native, <00:04:35.097>but <00:04:35.190>it's <00:04:35.284>only <00:04:35.377>near <00:04:35.470>native <00:04:35.564>when <00:04:35.657>it <00:04:35.750>comes <00:04:35.844>to

85
00:04:39.544 --> 00:04:40.504
AOT.

86
00:04:40.738 --> 00:04:46.218
<00:04:40.738>or <00:04:40.854>JIT <00:04:40.971>compile, <00:04:41.088>because <00:04:41.204>the <00:04:41.321>penalty <00:04:41.438>that <00:04:41.554>you <00:04:41.671>take <00:04:41.788>in <00:04:41.904>terms <00:04:42.021>of <00:04:42.138>compilation

87
00:04:46.218 --> 00:04:47.398
<00:04:46.218>is <00:04:46.749>higher <00:04:47.280>as

88
00:04:47.398 --> 00:04:52.118
<00:04:47.398>compared <00:04:47.538>to <00:04:47.678>the <00:04:47.818>runtime <00:04:47.958>penalty, <00:04:48.098>which <00:04:48.238>is <00:04:48.378>higher <00:04:48.518>in <00:04:48.658>interpretation <00:04:48.798>mode.

89
00:04:52.778 --> 00:04:53.678
<00:04:52.778>It's <00:04:53.588>polyglot.

90
00:04:53.758 --> 00:04:58.798
<00:04:53.758>Of <00:04:53.845>course, <00:04:53.933>you <00:04:54.020>can <00:04:54.108>write <00:04:54.195>in <00:04:54.282>any <00:04:54.370>language <00:04:54.457>and <00:04:54.545>that <00:04:54.633>it <00:04:54.720>compiles <00:04:54.808>to <00:04:54.895>WASM <00:04:54.983>bytecode, <00:04:55.070>and <00:04:55.157>eventually

91
00:04:58.798 --> 00:05:00.238
<00:04:58.798>that <00:04:59.014>can <00:04:59.230>be <00:04:59.446>done <00:04:59.662>using <00:04:59.878>any <00:05:00.094>runtime.

92
00:05:00.538 --> 00:05:05.698
<00:05:00.538>A <00:05:00.638>few <00:05:00.738>famous <00:05:00.838>ones <00:05:00.938>are <00:05:01.038>WASM <00:05:01.138>time, <00:05:01.238>WASM <00:05:01.338>cloud, <00:05:01.438>then <00:05:01.538>we <00:05:01.638>also <00:05:01.738>have <00:05:01.838>spin <00:05:01.938>cube,

93
00:05:05.878 --> 00:05:06.738
<00:05:05.878>which <00:05:06.265>is <00:05:06.652>again

94
00:05:06.738 --> 00:05:08.158
<00:05:06.738>built <00:05:06.993>on <00:05:07.249>top <00:05:07.504>of <00:05:07.760>WASM <00:05:08.016>time.

95
00:05:08.812 --> 00:05:11.432
<00:05:08.812>I <00:05:09.092>think <00:05:09.372>WOSM <00:05:09.652>Timers, <00:05:09.932>WOSM <00:05:10.212>Cloud.

96
00:05:12.952 --> 00:05:13.832
<00:05:12.952>Portability, <00:05:13.348>of <00:05:13.744>course.

97
00:05:13.992 --> 00:05:18.012
<00:05:13.992>You <00:05:14.092>can <00:05:14.192>write <00:05:14.292>in <00:05:14.392>any <00:05:14.492>language, <00:05:14.592>and <00:05:14.692>your <00:05:14.792>code <00:05:14.892>can <00:05:14.992>eventually <00:05:15.092>run <00:05:15.192>on <00:05:15.292>any <00:05:15.392>platform.

98
00:05:18.112 --> 00:05:19.372
<00:05:18.112>So <00:05:18.338>we <00:05:18.565>do <00:05:18.792>have <00:05:19.019>the <00:05:19.246>portability.

99
00:05:19.652 --> 00:05:24.772
<00:05:19.652>But <00:05:19.759>again, <00:05:19.867>I'll <00:05:19.975>show <00:05:20.082>in <00:05:20.190>the <00:05:20.298>demo <00:05:20.405>that <00:05:20.513>the <00:05:20.621>modules <00:05:20.728>are <00:05:20.836>super <00:05:20.944>thin, <00:05:21.051>they

100
00:05:24.772 --> 00:05:25.472
<00:05:24.772>are <00:05:25.087>super <00:05:25.402>light,

101
00:05:25.792 --> 00:05:28.852
<00:05:25.792>and <00:05:25.992>it's <00:05:26.192>very <00:05:26.392>easy <00:05:26.592>to <00:05:26.792>move <00:05:26.992>them <00:05:27.192>around.

102
00:05:31.612 --> 00:05:35.452
<00:05:31.612>So <00:05:31.712>WebAssembly <00:05:31.812>comes <00:05:31.912>in <00:05:32.012>two <00:05:32.112>flavors, <00:05:32.212>or <00:05:32.312>you <00:05:32.412>can <00:05:32.512>say <00:05:32.612>two <00:05:32.712>formats, <00:05:32.812>what <00:05:32.912>you <00:05:33.012>see.

103
00:05:35.592 --> 00:05:36.812
<00:05:35.592>This <00:05:35.866>is <00:05:36.141>the <00:05:36.415>text <00:05:36.690>form.

104
00:06:06.220 --> 00:06:11.880
<00:06:06.220>that's <00:06:06.347>how <00:06:06.474>they <00:06:06.601>call <00:06:06.729>it <00:06:06.856>this <00:06:06.983>is <00:06:07.110>a <00:06:07.238>this <00:06:07.365>is <00:06:07.492>a <00:06:07.620>repository

105
00:06:11.880 --> 00:06:12.880
<00:06:11.880>which <00:06:12.105>provides <00:06:12.330>you <00:06:12.555>a <00:06:12.780>lot

106
00:06:12.880 --> 00:06:17.740
<00:06:12.880>of <00:06:12.962>tools <00:06:13.044>so <00:06:13.127>you <00:06:13.209>can <00:06:13.291>use <00:06:13.374>what <00:06:13.456>to <00:06:13.538>awesome <00:06:13.621>so <00:06:13.703>you <00:06:13.785>can <00:06:13.868>write <00:06:13.950>a <00:06:14.032>module <00:06:14.115>in <00:06:14.197>what <00:06:14.280>just

107
00:06:17.740 --> 00:06:21.840
<00:06:17.740>for <00:06:17.833>learning <00:06:17.926>purpose <00:06:18.020>and <00:06:18.113>you <00:06:18.206>can <00:06:18.300>also <00:06:18.393>use <00:06:18.486>wasm <00:06:18.580>to <00:06:18.673>what <00:06:18.766>which <00:06:18.860>you <00:06:18.953>can <00:06:19.046>have <00:06:19.140>a

108
00:06:21.840 --> 00:06:24.700
<00:06:21.840>web <00:06:21.979>assembly <00:06:22.119>model <00:06:22.260>convert <00:06:22.400>into <00:06:22.539>the <00:06:22.679>texture <00:06:22.820>presentation <00:06:22.960>and <00:06:23.099>see <00:06:23.239>what's

109
00:06:24.700 --> 00:06:29.400
<00:06:24.700>happening <00:06:24.807>behind <00:06:24.915>the <00:06:25.023>scenes <00:06:25.130>it's <00:06:25.238>super <00:06:25.346>useful <00:06:25.453>but <00:06:25.561>you <00:06:25.669>don't <00:06:25.776>do <00:06:25.884>it <00:06:25.992>by <00:06:26.099>hand

110
00:06:29.400 --> 00:06:32.960
<00:06:29.400>usually <00:06:29.750>well <00:06:30.099>what <00:06:30.450>you <00:06:30.799>do

111
00:06:33.034 --> 00:06:38.234
<00:06:33.034>see <00:06:33.150>is <00:06:33.267>more <00:06:33.384>like <00:06:33.500>this <00:06:33.617>where <00:06:33.734>you <00:06:33.850>have <00:06:33.967>a <00:06:34.084>program <00:06:34.200>that <00:06:34.317>is <00:06:34.433>written

112
00:06:38.234 --> 00:06:39.074
<00:06:38.234>in <00:06:38.611>a <00:06:38.990>higher

113
00:06:39.074 --> 00:06:44.894
<00:06:39.074>language <00:06:39.181>and <00:06:39.289>then <00:06:39.397>it's <00:06:39.504>compiled <00:06:39.612>into <00:06:39.720>a <00:06:39.827>wasm <00:06:39.935>which <00:06:40.043>is <00:06:40.150>a <00:06:40.258>byte <00:06:40.366>sequence <00:06:40.474>now

114
00:06:44.894 --> 00:06:45.314
it's

115
00:06:45.314 --> 00:06:50.654
<00:06:45.314>at <00:06:45.441>first <00:06:45.568>it <00:06:45.695>seems <00:06:45.823>to <00:06:45.950>be <00:06:46.077>like <00:06:46.204>something <00:06:46.332>gibberish <00:06:46.459>and <00:06:46.586>it <00:06:46.714>does

116
00:06:50.654 --> 00:06:51.454
<00:06:50.654>not <00:06:51.014>have <00:06:51.374>any

117
00:06:51.454 --> 00:06:55.814
<00:06:51.454>structure <00:06:51.554>to <00:06:51.654>itself <00:06:51.754>but <00:06:51.854>it <00:06:51.954>actually <00:06:52.054>does <00:06:52.154>and <00:06:52.254>we <00:06:52.354>will <00:06:52.454>see <00:06:52.554>what <00:06:52.654>the <00:06:52.754>structure <00:06:52.854>of

118
00:06:55.814 --> 00:07:00.814
<00:06:55.814>those <00:06:55.941>these <00:06:56.068>bytes <00:06:56.195>form <00:06:56.323>because <00:06:56.450>it's <00:06:56.577>compact <00:06:56.704>structure <00:06:56.832>and <00:06:56.959>that's <00:06:57.086>why <00:06:57.214>it's

119
00:07:02.028 --> 00:07:04.368
<00:07:02.028>It <00:07:02.308>adds <00:07:02.588>to <00:07:02.868>its <00:07:03.148>fastness, <00:07:03.428>basically.

120
00:07:05.648 --> 00:07:08.948
<00:07:05.648>So <00:07:05.848>every <00:07:06.048>Wasm <00:07:06.248>module <00:07:06.448>starts <00:07:06.648>with <00:07:06.848>a <00:07:07.048>header.

121
00:07:09.148 --> 00:07:10.888
<00:07:09.148>And <00:07:09.303>we <00:07:09.459>will <00:07:09.614>touch <00:07:09.770>the <00:07:09.925>header <00:07:10.081>in <00:07:10.236>just <00:07:10.392>a <00:07:10.548>bit.

122
00:07:11.168 --> 00:07:13.648
<00:07:11.168>But <00:07:11.448>every <00:07:11.728>Wasm <00:07:12.008>module <00:07:12.288>has <00:07:12.568>sections.

123
00:07:13.928 --> 00:07:19.048
<00:07:13.928>It's <00:07:14.068>like <00:07:14.207>different <00:07:14.348>layers <00:07:14.488>put <00:07:14.628>together <00:07:14.768>and <00:07:14.908>eventually <00:07:15.048>forming <00:07:15.188>a <00:07:15.328>Wasm

124
00:07:19.048 --> 00:07:19.328
module.

125
00:07:19.928 --> 00:07:25.468
<00:07:19.928>A <00:07:20.044>Wasm <00:07:20.161>module, <00:07:20.278>when <00:07:20.394>I <00:07:20.511>started <00:07:20.628>working <00:07:20.744>on <00:07:20.861>this <00:07:20.978>project, <00:07:21.094>had <00:07:21.211>12 <00:07:21.328>sections.

126
00:07:25.628 --> 00:07:27.628
<00:07:25.628>But <00:07:25.828>I <00:07:26.027>think <00:07:26.228>they <00:07:26.428>recently <00:07:26.628>introduced <00:07:26.828>two <00:07:27.027>more.

127
00:07:27.728 --> 00:07:28.888
<00:07:27.728>So <00:07:27.989>we <00:07:28.250>now <00:07:28.510>have <00:07:28.772>14.

128
00:07:29.182 --> 00:07:34.382
<00:07:29.182>The <00:07:29.298>recent <00:07:29.415>two <00:07:29.532>additions <00:07:29.648>are <00:07:29.765>primarily <00:07:29.882>with <00:07:29.998>relation <00:07:30.115>to <00:07:30.232>Wazi, <00:07:30.348>which <00:07:30.465>is <00:07:30.582>for

129
00:07:34.382 --> 00:07:36.082
<00:07:34.382>providing <00:07:35.782>you

130
00:07:36.082 --> 00:07:39.962
<00:07:36.082>standard <00:07:36.198>implementation <00:07:36.315>of <00:07:36.432>some <00:07:36.548>interactions <00:07:36.665>that <00:07:36.782>you <00:07:36.898>want <00:07:37.015>to <00:07:37.132>do <00:07:37.248>with <00:07:37.365>the <00:07:37.482>host.

131
00:07:41.922 --> 00:07:47.022
<00:07:41.922>The <00:07:42.038>ticks <00:07:42.155>that <00:07:42.272>you <00:07:42.388>see <00:07:42.505>is <00:07:42.622>what <00:07:42.738>WISC <00:07:42.855>implements <00:07:42.972>because <00:07:43.088>it <00:07:43.205>was <00:07:43.322>done

132
00:07:47.022 --> 00:07:48.702
<00:07:47.022>primarily <00:07:47.372>for <00:07:47.722>a <00:07:48.072>very <00:07:48.421>small

133
00:07:49.282 --> 00:07:51.022
<00:07:49.282>That's <00:07:49.561>why <00:07:49.842>I <00:07:50.121>only <00:07:50.402>implemented <00:07:50.681>five.

134
00:07:51.022 --> 00:07:56.682
<00:07:51.022>And <00:07:51.301>these <00:07:51.582>sections <00:07:51.861>are <00:07:52.142>implemented <00:07:52.421>by

135
00:07:56.682 --> 00:07:57.182
<00:07:56.682>any <00:07:57.132>runtime.

136
00:07:57.255 --> 00:07:58.415
<00:07:57.255>that's <00:07:58.299>production-grade.

137
00:08:00.735 --> 00:08:03.195
<00:08:00.735>Every <00:08:01.085>runtime <00:08:01.435>has <00:08:01.785>four <00:08:02.135>stages.

138
00:08:03.695 --> 00:08:06.395
<00:08:03.695>It <00:08:03.928>decodes <00:08:04.161>your <00:08:04.395>Watson <00:08:04.628>module, <00:08:04.861>because <00:08:05.094>it

139
00:08:06.395 --> 00:08:08.035
<00:08:06.395>needs <00:08:06.628>to <00:08:06.861>understand <00:08:07.094>what's <00:08:07.328>happening <00:08:07.561>inside <00:08:07.794>it.

140
00:08:08.195 --> 00:08:09.615
<00:08:08.195>Then <00:08:08.514>it <00:08:08.834>does <00:08:09.153>some <00:08:09.473>validations.

141
00:08:09.835 --> 00:08:12.395
<00:08:09.835>It <00:08:10.068>also <00:08:10.301>does <00:08:10.534>some <00:08:10.768>instantiation, <00:08:11.001>because <00:08:11.234>everything

142
00:08:12.395 --> 00:08:13.535
<00:08:12.395>requires <00:08:13.421>memory.

143
00:08:13.695 --> 00:08:15.255
<00:08:13.695>And <00:08:13.974>it <00:08:14.255>also <00:08:14.534>has <00:08:14.815>some <00:08:15.094>globals.

144
00:08:15.635 --> 00:08:17.395
<00:08:15.635>And <00:08:15.868>eventually, <00:08:16.101>you <00:08:16.335>want <00:08:16.568>to <00:08:16.801>execute <00:08:17.034>it.

145
00:08:18.375 --> 00:08:21.855
<00:08:18.375>Every <00:08:18.550>runtime, <00:08:18.725>Watson <00:08:18.900>time, <00:08:19.075>Watson <00:08:19.250>edge, <00:08:19.425>all <00:08:19.600>those <00:08:19.775>included.

146
00:08:22.095 --> 00:08:23.315
<00:08:22.095>And <00:08:22.461>so <00:08:22.827>does <00:08:23.193>WISC.

147
00:08:23.315 --> 00:08:25.255
<00:08:23.315>However, <00:08:23.515>WISC <00:08:23.715>was <00:08:23.915>done <00:08:24.115>at <00:08:24.315>the <00:08:24.515>same <00:08:24.715>time.

148
00:08:25.329 --> 00:08:30.749
<00:08:25.329>a <00:08:25.416>very <00:08:25.504>small <00:08:25.591>project, <00:08:25.679>a <00:08:25.766>play <00:08:25.854>toy, <00:08:25.941>and <00:08:26.029>that's <00:08:26.116>why <00:08:26.204>it <00:08:26.291>has <00:08:26.379>a <00:08:26.466>very <00:08:26.554>thin <00:08:26.641>layer <00:08:26.729>on

149
00:08:30.749 --> 00:08:31.809
<00:08:30.749>all <00:08:31.067>these <00:08:31.385>four <00:08:31.703>stages.

150
00:08:34.509 --> 00:08:40.469
<00:08:34.509>Now, <00:08:34.616>just <00:08:34.724>a <00:08:34.832>quick <00:08:34.939>intro <00:08:35.047>to <00:08:35.155>Whisk. <00:08:35.262>I've <00:08:35.370>been <00:08:35.478>calling <00:08:35.585>Whisk <00:08:35.693>so <00:08:35.801>far. <00:08:35.909>So,

151
00:08:40.969 --> 00:08:42.629
<00:08:40.969>not <00:08:41.319>so <00:08:41.669>long <00:08:42.019>ago <00:08:42.369>in

152
00:08:42.629 --> 00:08:46.469
<00:08:42.629>past, <00:08:42.722>there <00:08:42.815>was <00:08:42.909>a <00:08:43.002>time <00:08:43.095>when <00:08:43.188>we <00:08:43.282>wanted <00:08:43.375>to <00:08:43.469>learn <00:08:43.562>something. <00:08:43.655>We <00:08:43.749>would <00:08:43.842>just <00:08:43.935>build <00:08:44.029>things,

153
00:08:46.609 --> 00:08:51.729
<00:08:46.609>not <00:08:46.691>just <00:08:46.773>prompt <00:08:46.856>to <00:08:46.938>AI <00:08:47.020>and <00:08:47.103>ask <00:08:47.185>for <00:08:47.267>a <00:08:47.350>huge <00:08:47.432>document <00:08:47.514>that <00:08:47.597>we <00:08:47.679>may <00:08:47.761>or <00:08:47.844>may <00:08:47.926>never <00:08:48.009>read.

154
00:08:51.929 --> 00:08:53.329
<00:08:51.929>We <00:08:52.348>were <00:08:52.769>to <00:08:53.189>just

155
00:08:53.403 --> 00:08:55.743
<00:08:53.403>try <00:08:53.603>things <00:08:53.803>on <00:08:54.003>our <00:08:54.203>hands, <00:08:54.403>burn <00:08:54.603>our <00:08:54.803>hands.

156
00:08:55.963 --> 00:08:57.243
<00:08:55.963>That's <00:08:56.251>how <00:08:56.539>Wisk <00:08:56.827>was <00:08:57.115>born.

157
00:08:57.503 --> 00:09:00.063
<00:08:57.503>It <00:08:57.783>was <00:08:58.063>written <00:08:58.343>in <00:08:58.623>four <00:08:58.903>days,

158
00:09:00.843 --> 00:09:04.023
<00:09:00.843>and <00:09:01.017>I <00:09:01.193>submitted <00:09:01.367>as <00:09:01.543>a <00:09:01.718>talk <00:09:01.892>to <00:09:02.068>a <00:09:02.242>conference.

159
00:09:04.683 --> 00:09:06.023
<00:09:04.683>So <00:09:05.085>it's <00:09:05.487>very <00:09:05.889>small.

160
00:09:06.223 --> 00:09:08.443
<00:09:06.223>It <00:09:06.378>does <00:09:06.534>not <00:09:06.689>have <00:09:06.845>any <00:09:07.000>dependencies, <00:09:07.156>it's <00:09:07.311>written <00:09:07.467>in <00:09:07.622>Rust,

161
00:09:08.643 --> 00:09:12.363
<00:09:08.643>and <00:09:08.798>it <00:09:08.954>only <00:09:09.109>supports <00:09:09.265>five <00:09:09.420>sections <00:09:09.576>that <00:09:09.731>we <00:09:09.887>just <00:09:10.043>saw,

162
00:09:12.543 --> 00:09:14.743
<00:09:12.543>and <00:09:12.823>it <00:09:13.103>only <00:09:13.383>supports <00:09:13.663>eight <00:09:13.943>opcodes.

163
00:09:14.963 --> 00:09:17.183
<00:09:14.963>And <00:09:15.242>these <00:09:15.522>opcodes <00:09:15.803>are <00:09:16.083>assembly <00:09:16.363>opcodes

164
00:09:17.183 --> 00:09:19.283
<00:09:17.183>that <00:09:17.383>you <00:09:17.583>have <00:09:17.783>to <00:09:17.983>implement <00:09:18.183>as <00:09:18.383>a <00:09:18.583>runtime.

165
00:09:19.283 --> 00:09:21.403
<00:09:19.283>It <00:09:19.983>only <00:09:20.683>supports...

166
00:09:21.477 --> 00:09:27.097
<00:09:21.477>I32 <00:09:21.651>values. <00:09:21.827>WebAssembly <00:09:22.002>in <00:09:22.177>itself <00:09:22.352>supports <00:09:22.526>I32, <00:09:22.702>I64, <00:09:22.877>F32,

167
00:09:27.337 --> 00:09:30.197
<00:09:27.337>and <00:09:27.803>F64. <00:09:28.270>Everything <00:09:28.737>outside

168
00:09:30.197 --> 00:09:36.697
<00:09:30.197>these <00:09:30.337>scalar <00:09:30.477>values <00:09:30.617>goes <00:09:30.757>into <00:09:30.897>memory, <00:09:31.037>into <00:09:31.177>the <00:09:31.317>linear <00:09:31.457>memory. <00:09:31.597>And

169
00:09:36.697 --> 00:09:37.417
<00:09:36.697>it <00:09:36.859>does <00:09:37.021>not <00:09:37.183>have <00:09:37.345>any

170
00:09:37.417 --> 00:09:40.917
<00:09:37.417>unsafe <00:09:37.510>code. <00:09:37.603>And <00:09:37.697>there's <00:09:37.790>a <00:09:37.883>reason <00:09:37.977>for <00:09:38.070>it, <00:09:38.163>which <00:09:38.257>we <00:09:38.350>will <00:09:38.443>see <00:09:38.537>in <00:09:38.630>just <00:09:38.723>a <00:09:38.817>bit.

171
00:09:42.837 --> 00:09:48.197
<00:09:42.837>So, <00:09:42.944>let's <00:09:43.052>get <00:09:43.160>into <00:09:43.267>the <00:09:43.375>meat <00:09:43.483>of <00:09:43.590>the <00:09:43.698>talk. <00:09:43.806>When <00:09:43.913>you <00:09:44.021>look <00:09:44.129>at <00:09:44.237>the

172
00:09:48.197 --> 00:09:49.397
<00:09:48.197>bytecodes <00:09:49.277>of

173
00:09:49.551 --> 00:09:51.431
<00:09:49.551>or <00:09:49.706>our <00:09:49.862>awesome <00:09:50.017>module <00:09:50.173>has <00:09:50.328>a <00:09:50.484>structure, <00:09:50.639>as <00:09:50.795>I <00:09:50.951>said.

174
00:09:51.811 --> 00:09:53.451
<00:09:51.811>The <00:09:52.011>first <00:09:52.211>thing <00:09:52.411>that <00:09:52.611>you <00:09:52.811>need <00:09:53.011>to <00:09:53.211>know

175
00:09:53.451 --> 00:09:55.571
<00:09:53.451>is <00:09:53.917>this <00:09:54.384>eight-byte <00:09:54.851>pattern.

176
00:09:55.831 --> 00:09:58.391
<00:09:55.831>These <00:09:56.006>eight <00:09:56.181>bytes <00:09:56.356>are <00:09:56.531>actually <00:09:56.706>the <00:09:56.881>first <00:09:57.056>four <00:09:57.231>bytes

177
00:09:58.391 --> 00:10:03.071
<00:09:58.391>give <00:09:58.518>you <00:09:58.645>the <00:09:58.772>preamble, <00:09:58.900>or <00:09:59.027>the <00:09:59.154>awesome <00:09:59.281>thing <00:09:59.409>of <00:09:59.536>a <00:09:59.663>null <00:09:59.790>value

178
00:10:03.071 --> 00:10:08.431
<00:10:03.071>followed <00:10:03.226>by <00:10:03.382>a <00:10:03.537>static <00:10:03.693>ASM, <00:10:03.848>which <00:10:04.004>makes <00:10:04.159>sure <00:10:04.315>that <00:10:04.471>this

179
00:10:08.431 --> 00:10:08.971
<00:10:08.431>byte <00:10:08.917>code

180
00:10:08.971 --> 00:10:10.491
<00:10:08.971>is <00:10:09.313>actually <00:10:09.655>a <00:10:09.997>WebAssembly <00:10:10.339>module.

181
00:10:11.031 --> 00:10:14.691
<00:10:11.031>The <00:10:11.231>next <00:10:11.430>four <00:10:11.631>bytes <00:10:11.830>are <00:10:12.031>the <00:10:12.231>version <00:10:12.430>number.

182
00:10:14.691 --> 00:10:17.551
<00:10:14.691>At <00:10:14.866>the <00:10:15.041>moment <00:10:15.216>when <00:10:15.391>I <00:10:15.566>did <00:10:15.741>this, <00:10:15.916>it <00:10:16.091>was

183
00:10:17.625 --> 00:10:19.945
<00:10:17.625>was <00:10:17.800>version <00:10:17.975>one, <00:10:18.150>but <00:10:18.325>I <00:10:18.500>think <00:10:18.675>it's <00:10:18.850>progressive <00:10:19.025>now.

184
00:10:20.445 --> 00:10:23.165
<00:10:20.445>The <00:10:20.620>next <00:10:20.795>byte, <00:10:20.970>which <00:10:21.145>is <00:10:21.320>the <00:10:21.495>ninth <00:10:21.670>byte, <00:10:21.845>which

185
00:10:23.165 --> 00:10:26.265
<00:10:23.165>is <00:10:23.631>this <00:10:24.098>one, <00:10:24.564>01.

186
00:10:26.505 --> 00:10:28.625
<00:10:26.505>From <00:10:26.785>here, <00:10:27.064>it <00:10:27.345>starts <00:10:27.625>the <00:10:27.905>sections.

187
00:10:28.825 --> 00:10:31.825
<00:10:28.825>And <00:10:29.058>each <00:10:29.291>line <00:10:29.525>shows <00:10:29.758>you <00:10:29.991>a <00:10:30.225>section.

188
00:10:32.025 --> 00:10:33.845
<00:10:32.025>The <00:10:32.258>next <00:10:32.491>one <00:10:32.725>is <00:10:32.958>a <00:10:33.191>type <00:10:33.425>section.

189
00:10:34.145 --> 00:10:38.725
<00:10:34.145>The <00:10:34.300>first <00:10:34.456>byte, <00:10:34.611>01 <00:10:34.767>and <00:10:34.922>so <00:10:35.078>on, <00:10:35.233>03, <00:10:35.389>07, <00:10:35.545>08,

190
00:10:38.765 --> 00:10:41.525
<00:10:38.765>gives <00:10:38.965>you <00:10:39.165>the <00:10:39.365>byte <00:10:39.564>of <00:10:39.765>the <00:10:39.965>section <00:10:40.165>ID.

191
00:10:41.865 --> 00:10:44.165
<00:10:41.865>Each <00:10:42.098>section <00:10:42.331>has <00:10:42.565>an <00:10:42.798>identifier, <00:10:43.031>and <00:10:43.265>that

192
00:10:44.165 --> 00:10:45.225
<00:10:44.165>can <00:10:44.355>be <00:10:44.546>stored <00:10:44.737>in <00:10:44.928>one <00:10:45.119>byte.

193
00:10:45.699 --> 00:10:47.839
<00:10:45.699>gives <00:10:45.978>you <00:10:46.258>127 <00:10:46.539>options <00:10:46.819>for <00:10:47.098>sections.

194
00:10:48.419 --> 00:10:50.779
<00:10:48.419>So <00:10:48.619>01 <00:10:48.819>tells <00:10:49.019>me <00:10:49.218>it's <00:10:49.419>a <00:10:49.619>type <00:10:49.819>section.

195
00:10:50.979 --> 00:10:54.459
<00:10:50.979>What <00:10:51.106>this <00:10:51.233>type <00:10:51.360>section <00:10:51.488>has, <00:10:51.615>it <00:10:51.742>has <00:10:51.869>a <00:10:51.997>signature <00:10:52.124>of <00:10:52.251>a <00:10:52.379>function.

196
00:10:55.559 --> 00:10:59.099
<00:10:55.559>So <00:10:55.733>01 <00:10:55.909>is <00:10:56.084>the <00:10:56.259>ID, <00:10:56.434>which <00:10:56.608>is <00:10:56.784>right <00:10:56.959>here.

197
00:10:59.379 --> 00:11:01.879
<00:10:59.379>07 <00:10:59.612>is <00:10:59.845>the <00:11:00.079>length <00:11:00.312>of <00:11:00.545>that <00:11:00.779>section.

198
00:11:02.319 --> 00:11:05.139
<00:11:02.319>And <00:11:02.598>eventually, <00:11:02.878>the <00:11:03.159>next <00:11:03.439>seven <00:11:03.718>bytes

199
00:11:05.139 --> 00:11:07.719
<00:11:05.139>are <00:11:05.339>the <00:11:05.539>payload, <00:11:05.739>which <00:11:05.939>is <00:11:06.139>the <00:11:06.339>section <00:11:06.539>itself.

200
00:11:08.679 --> 00:11:13.699
<00:11:08.679>So <00:11:08.806>01, <00:11:08.933>07, <00:11:09.060>size, <00:11:09.188>and <00:11:09.315>01, <00:11:09.442>and <00:11:09.569>so <00:11:09.697>on <00:11:09.824>and <00:11:09.951>so <00:11:10.079>forth.

201
00:11:13.773 --> 00:11:15.253
<00:11:13.773>But <00:11:13.995>6,0 <00:11:14.217>tells <00:11:14.439>me <00:11:14.661>it's <00:11:14.883>a <00:11:15.105>function.

202
00:11:15.653 --> 00:11:17.973
<00:11:15.653>And <00:11:15.828>0,1 <00:11:16.003>tells <00:11:16.178>me <00:11:16.353>how <00:11:16.528>many <00:11:16.703>entries <00:11:16.878>do <00:11:17.053>I

203
00:11:17.973 --> 00:11:19.073
<00:11:17.973>have <00:11:18.220>in <00:11:18.468>this <00:11:18.715>type <00:11:18.963>section.

204
00:11:19.353 --> 00:11:23.513
<00:11:19.353>So <00:11:19.492>in <00:11:19.632>this <00:11:19.772>one, <00:11:19.912>I <00:11:20.053>have <00:11:20.193>one <00:11:20.333>entry <00:11:20.473>of <00:11:20.613>6,0, <00:11:20.752>which

205
00:11:23.513 --> 00:11:24.253
<00:11:23.513>means <00:11:23.846>a <00:11:24.179>function.

206
00:11:24.453 --> 00:11:27.553
<00:11:24.453>I <00:11:24.627>know <00:11:24.803>this <00:11:24.978>because <00:11:25.153>I <00:11:25.328>have <00:11:25.502>implemented <00:11:25.678>by <00:11:25.853>hand.

207
00:11:27.713 --> 00:11:29.653
<00:11:27.713>Otherwise, <00:11:27.913>you <00:11:28.113>don't <00:11:28.313>need <00:11:28.512>to <00:11:28.713>really <00:11:28.913>know <00:11:29.113>this.

208
00:11:29.753 --> 00:11:32.793
<00:11:29.753>When <00:11:29.928>you <00:11:30.103>look <00:11:30.278>into <00:11:30.453>a <00:11:30.628>code <00:11:30.803>of <00:11:30.978>any <00:11:31.153>runtime,

209
00:11:32.973 --> 00:11:34.813
<00:11:32.973>you <00:11:33.173>can <00:11:33.372>see <00:11:33.573>how <00:11:33.772>they <00:11:33.973>are <00:11:34.173>interpreting <00:11:34.372>it.

210
00:11:35.753 --> 00:11:38.473
<00:11:35.753>Next <00:11:35.986>one <00:11:36.219>is <00:11:36.453>a <00:11:36.686>function <00:11:36.919>section, <00:11:37.153>which

211
00:11:38.473 --> 00:11:41.293
<00:11:38.473>has <00:11:38.706>a <00:11:38.939>function <00:11:39.173>0 <00:11:39.406>at <00:11:39.639>index <00:11:39.872>0.

212
00:11:41.846 --> 00:11:45.766
<00:11:41.846>What <00:11:42.046>it <00:11:42.246>does, <00:11:42.446>it's <00:11:42.646>basically <00:11:42.846>a <00:11:43.046>middle <00:11:43.246>layer

213
00:11:45.766 --> 00:11:48.586
<00:11:45.766>that <00:11:45.940>you <00:11:46.116>can <00:11:46.290>think <00:11:46.466>of <00:11:46.641>between <00:11:46.815>the <00:11:46.991>type <00:11:47.165>section

214
00:11:49.386 --> 00:11:52.166
<00:11:49.386>and <00:11:49.513>the <00:11:49.640>code <00:11:49.767>section <00:11:49.895>that <00:11:50.022>we <00:11:50.149>see <00:11:50.276>at <00:11:50.404>the <00:11:50.531>very <00:11:50.658>bottom <00:11:50.786>here.

215
00:11:52.546 --> 00:11:55.246
<00:11:52.546>So <00:11:52.779>there's <00:11:53.012>a <00:11:53.246>type <00:11:53.479>where <00:11:53.712>we <00:11:53.946>say,

216
00:11:55.346 --> 00:11:56.966
<00:11:55.346>this <00:11:55.521>is <00:11:55.696>the <00:11:55.871>function <00:11:56.046>that <00:11:56.221>we <00:11:56.396>are <00:11:56.571>looking <00:11:56.746>at.

217
00:11:57.366 --> 00:12:02.046
<00:11:57.366>It <00:11:57.540>expects <00:11:57.716>two <00:11:57.891>parameters, <00:11:58.066>and <00:11:58.241>it <00:11:58.415>returns <00:11:58.591>an <00:11:58.766>I32.

218
00:12:02.446 --> 00:12:06.606
<00:12:02.446>Now, <00:12:02.601>in <00:12:02.757>the <00:12:02.912>code <00:12:03.068>section, <00:12:03.223>there <00:12:03.379>is <00:12:03.534>a <00:12:03.690>function <00:12:03.846>body,

219
00:12:06.606 --> 00:12:08.646
<00:12:06.606>which <00:12:06.806>actually <00:12:07.006>does <00:12:07.206>whatever <00:12:07.406>it <00:12:07.606>needs <00:12:07.806>to <00:12:08.006>do

220
00:12:08.646 --> 00:12:09.846
<00:12:08.646>with <00:12:09.185>those <00:12:09.726>three.

221
00:12:10.700 --> 00:12:15.320
<00:12:10.700>And <00:12:10.827>what <00:12:10.954>it <00:12:11.081>connects <00:12:11.209>to <00:12:11.336>is <00:12:11.463>the <00:12:11.590>code <00:12:11.718>looks <00:12:11.845>for <00:12:11.972>the <00:12:12.100>function.

222
00:12:15.480 --> 00:12:18.580
<00:12:15.480>Function <00:12:15.655>says, <00:12:15.830>here <00:12:16.005>is <00:12:16.180>the <00:12:16.355>definition <00:12:16.530>of <00:12:16.705>the <00:12:16.880>function

223
00:12:19.460 --> 00:12:20.620
<00:12:19.460>That's <00:12:19.721>in <00:12:19.982>the <00:12:20.243>type <00:12:20.504>section.

224
00:12:23.040 --> 00:12:27.760
<00:12:23.040>So <00:12:23.214>any <00:12:23.390>runtime <00:12:23.564>does <00:12:23.740>some <00:12:23.915>validations <00:12:24.089>at <00:12:24.265>some <00:12:24.439>stage.

225
00:12:28.000 --> 00:12:30.160
<00:12:28.000>WISC <00:12:28.200>does <00:12:28.400>a <00:12:28.600>very <00:12:28.800>thin <00:12:29.000>layer <00:12:29.200>of <00:12:29.400>it.

226
00:12:30.740 --> 00:12:33.800
<00:12:30.740>The <00:12:30.880>validation <00:12:31.020>itself <00:12:31.160>when <00:12:31.300>it <00:12:31.440>comes <00:12:31.580>to <00:12:31.720>a <00:12:31.860>complete <00:12:32.000>full <00:12:32.140>runtime,

227
00:12:33.980 --> 00:12:35.020
<00:12:33.980>it's <00:12:34.292>a <00:12:34.604>production <00:12:34.915>runtime.

228
00:12:35.020 --> 00:12:37.920
<00:12:35.020>You <00:12:35.253>do <00:12:35.486>not <00:12:35.720>just <00:12:35.953>make <00:12:36.186>sure <00:12:36.420>it's

229
00:12:37.994 --> 00:12:43.274
<00:12:37.994>a <00:12:38.134>WebAssembly <00:12:38.274>module <00:12:38.414>in <00:12:38.554>itself, <00:12:38.694>but <00:12:38.834>you <00:12:38.974>also <00:12:39.114>do <00:12:39.254>that <00:12:39.394>the

230
00:12:43.274 --> 00:12:47.394
<00:12:43.274>types, <00:12:43.554>the <00:12:43.834>types <00:12:44.114>section <00:12:44.394>has <00:12:44.674>a

231
00:12:47.394 --> 00:12:52.134
<00:12:47.394>matching <00:12:47.471>code <00:12:47.549>section <00:12:47.627>and <00:12:47.705>it <00:12:47.782>also <00:12:47.860>has <00:12:47.938>a <00:12:48.016>function <00:12:48.094>that <00:12:48.171>maps <00:12:48.249>to <00:12:48.327>it. <00:12:48.405>You <00:12:48.482>also <00:12:48.560>want <00:12:48.638>to <00:12:48.716>make <00:12:48.794>sure

232
00:12:52.134 --> 00:12:57.954
<00:12:52.134>that <00:12:52.216>all <00:12:52.298>the <00:12:52.381>memory <00:12:52.463>allocations <00:12:52.545>that <00:12:52.628>you <00:12:52.710>do <00:12:52.792>at <00:12:52.875>runtime <00:12:52.957>will <00:12:53.039>be <00:12:53.122>safe <00:12:53.204>and <00:12:53.286>there <00:12:53.369>is <00:12:53.451>no <00:12:53.534>violation

233
00:12:57.954 --> 00:13:03.114
<00:12:57.954>of <00:12:58.093>the <00:12:58.233>memory <00:12:58.373>at <00:12:58.513>least. <00:12:58.654>So <00:12:58.794>all <00:12:58.934>those <00:12:59.074>checks <00:12:59.214>are <00:12:59.353>done

234
00:13:03.114 --> 00:13:05.674
<00:13:03.114>at <00:13:03.464>validation <00:13:03.814>point, <00:13:04.164>especially <00:13:04.514>in

235
00:13:06.068 --> 00:13:09.028
<00:13:06.068>JIT <00:13:06.348>compiled <00:13:06.627>or <00:13:06.908>AOT <00:13:07.188>compiled <00:13:07.468>runtimes.

236
00:13:09.988 --> 00:13:11.508
<00:13:09.988>It's <00:13:10.672>well-typed <00:13:11.356>instructions.

237
00:13:13.028 --> 00:13:14.688
<00:13:13.028>Eventually, <00:13:13.261>what <00:13:13.494>you <00:13:13.728>want <00:13:13.961>to <00:13:14.194>make <00:13:14.428>sure

238
00:13:14.688 --> 00:13:16.368
<00:13:14.688>is <00:13:14.968>that <00:13:15.247>during <00:13:15.528>execution, <00:13:15.808>you <00:13:16.088>just

239
00:13:16.368 --> 00:13:19.628
<00:13:16.368>have <00:13:16.543>a <00:13:16.718>machine <00:13:16.893>code <00:13:17.068>if <00:13:17.243>you <00:13:17.418>are <00:13:17.593>doing <00:13:17.768>JIT.

240
00:13:19.848 --> 00:13:24.268
<00:13:19.848>And <00:13:19.975>you <00:13:20.102>don't <00:13:20.229>have <00:13:20.357>to <00:13:20.484>do <00:13:20.611>any <00:13:20.738>sort <00:13:20.866>of <00:13:20.993>validation <00:13:21.120>at <00:13:21.247>runtime.

241
00:13:24.548 --> 00:13:26.288
<00:13:24.548>That's <00:13:24.828>what <00:13:25.108>the <00:13:25.388>validation <00:13:25.668>basically <00:13:25.948>does.

242
00:13:27.348 --> 00:13:30.068
<00:13:27.348>So <00:13:27.548>executor <00:13:27.747>doesn't <00:13:27.948>have <00:13:28.147>to <00:13:28.348>worry <00:13:28.548>about <00:13:28.747>anything.

243
00:13:30.228 --> 00:13:31.668
<00:13:30.228>It <00:13:30.660>just <00:13:31.092>blindly <00:13:31.524>executes.

244
00:13:34.142 --> 00:13:39.462
<00:13:34.142>So, <00:13:34.235>WISC <00:13:34.328>only <00:13:34.422>does <00:13:34.515>eight <00:13:34.608>bytes <00:13:34.702>and <00:13:34.795>just <00:13:34.888>takes <00:13:34.982>a <00:13:35.075>leap <00:13:35.168>of <00:13:35.262>faith, <00:13:35.355>okay, <00:13:35.448>I <00:13:35.542>trust

245
00:13:39.462 --> 00:13:39.982
<00:13:39.462>you, <00:13:39.930>bro.

246
00:13:40.582 --> 00:13:43.262
<00:13:40.582>So, <00:13:40.757>it <00:13:40.932>only <00:13:41.107>checks <00:13:41.282>for <00:13:41.457>the <00:13:41.632>first <00:13:41.807>eight <00:13:41.982>bytes.

247
00:13:43.462 --> 00:13:49.082
<00:13:43.462>It <00:13:43.544>says, <00:13:43.626>okay, <00:13:43.709>there's <00:13:43.791>a <00:13:43.873>magic <00:13:43.956>number <00:13:44.038>to <00:13:44.120>it, <00:13:44.203>which <00:13:44.285>is, <00:13:44.367>again, <00:13:44.450>hard <00:13:44.532>-coded <00:13:44.614>as <00:13:44.697>a <00:13:44.779>constant <00:13:44.862>in

248
00:13:49.082 --> 00:13:50.042
<00:13:49.082>the <00:13:49.514>code <00:13:49.946>itself.

249
00:13:50.482 --> 00:13:55.622
<00:13:50.482>And <00:13:50.569>it <00:13:50.656>then <00:13:50.744>just <00:13:50.832>compares <00:13:50.919>the <00:13:51.007>version <00:13:51.094>because <00:13:51.182>I <00:13:51.269>only <00:13:51.357>targeted <00:13:51.444>version <00:13:51.531>one, <00:13:51.619>so <00:13:51.707>everything <00:13:51.794>is <00:13:51.882>hard

250
00:13:55.622 --> 00:13:55.862
-coded.

251
00:13:56.082 --> 00:14:01.182
<00:13:56.082>If <00:13:56.169>I <00:13:56.257>were <00:13:56.344>to <00:13:56.432>improve <00:13:56.519>the <00:13:56.607>validation, <00:13:56.694>the <00:13:56.782>next <00:13:56.869>layer <00:13:56.957>will <00:13:57.044>be <00:13:57.132>to <00:13:57.219>compile, <00:13:57.307>not <00:13:57.394>compile, <00:13:57.482>but

252
00:14:01.182 --> 00:14:02.142
<00:14:01.182>validate <00:14:01.614>whether <00:14:02.046>the...

253
00:14:02.216 --> 00:14:07.276
<00:14:02.216>The <00:14:02.332>type <00:14:02.449>section <00:14:02.566>has <00:14:02.682>a <00:14:02.799>matching <00:14:02.916>function <00:14:03.032>section <00:14:03.149>and <00:14:03.266>it <00:14:03.382>has <00:14:03.499>an <00:14:03.616>equivalent

254
00:14:07.276 --> 00:14:08.096
<00:14:07.276>code <00:14:08.014>section.

255
00:14:08.456 --> 00:14:09.316
<00:14:08.456>That's <00:14:08.649>how <00:14:08.843>it <00:14:09.036>would <00:14:09.230>compare.

256
00:14:09.856 --> 00:14:14.936
<00:14:09.856>And <00:14:09.963>then <00:14:10.071>you <00:14:10.179>improve <00:14:10.286>those <00:14:10.394>layers <00:14:10.502>by <00:14:10.609>checking <00:14:10.717>is <00:14:10.825>the <00:14:10.932>memory <00:14:11.040>allocated, <00:14:11.148>the <00:14:11.256>linear

257
00:14:14.936 --> 00:14:15.296
memory

258
00:14:15.296 --> 00:14:16.616
<00:14:15.296>is <00:14:15.593>allocated <00:14:15.890>properly <00:14:16.187>or <00:14:16.484>not.

259
00:14:17.136 --> 00:14:22.176
<00:14:17.136>So <00:14:17.229>when <00:14:17.322>a <00:14:17.415>function <00:14:17.509>executes, <00:14:17.602>will <00:14:17.695>it <00:14:17.789>have <00:14:17.882>all <00:14:17.976>those <00:14:18.069>parameters <00:14:18.162>that <00:14:18.256>is <00:14:18.349>expected <00:14:18.442>on <00:14:18.536>the

260
00:14:23.236 --> 00:14:24.096
<00:14:23.236>All <00:14:23.623>those <00:14:24.010>things.

261
00:14:24.316 --> 00:14:25.916
<00:14:24.316>But <00:14:24.549>WISC <00:14:24.782>does <00:14:25.016>a <00:14:25.249>very <00:14:25.482>thin <00:14:25.716>layer.

262
00:14:26.096 --> 00:14:27.596
<00:14:26.096>That's <00:14:26.321>all <00:14:26.546>the <00:14:26.771>validation <00:14:26.996>that <00:14:27.221>WISC <00:14:27.446>does.

263
00:14:27.596 --> 00:14:30.216
<00:14:27.596>Again, <00:14:27.946>WISC <00:14:28.296>was <00:14:28.646>never <00:14:28.996>met.

264
00:14:30.290 --> 00:14:34.170
<00:14:30.290>to <00:14:30.390>be <00:14:30.490>another <00:14:30.589>runtime, <00:14:30.689>it <00:14:30.790>was <00:14:30.890>just <00:14:30.990>a <00:14:31.089>hobby <00:14:31.189>project <00:14:31.290>that <00:14:31.390>I <00:14:31.490>did <00:14:31.589>to <00:14:31.689>understand

265
00:14:34.170 --> 00:14:40.870
<00:14:34.170>what's <00:14:34.277>happening <00:14:34.385>when <00:14:34.493>I <00:14:34.600>run <00:14:34.708>a <00:14:34.816>WASM <00:14:34.923>module. <00:14:35.031>It <00:14:35.139>was <00:14:35.246>a <00:14:35.354>learning <00:14:35.462>project <00:14:35.569>before

266
00:14:40.870 --> 00:14:46.050
<00:14:40.870>the <00:14:41.103>age <00:14:41.336>of <00:14:41.570>AI. <00:14:41.803>Now <00:14:42.036>instantiation, <00:14:42.270>allocation

267
00:14:46.050 --> 00:14:47.330
<00:14:46.050>of <00:14:46.434>memory, <00:14:46.818>it's <00:14:47.202>very

268
00:14:47.330 --> 00:14:52.450
<00:14:47.330>important <00:14:47.470>because <00:14:47.610>as <00:14:47.750>I <00:14:47.890>said, <00:14:48.030>WebAssembly <00:14:48.170>by <00:14:48.310>default <00:14:48.450>only <00:14:48.590>supports <00:14:48.730>I32,

269
00:14:52.870 --> 00:14:55.050
<00:14:52.870>I64, <00:14:54.270>F32

270
00:14:55.050 --> 00:14:58.210
<00:14:55.050>and <00:14:55.224>F64. <00:14:55.400>Anything <00:14:55.574>outside <00:14:55.750>it, <00:14:55.925>let's <00:14:56.099>say <00:14:56.275>a <00:14:56.449>string.

271
00:14:58.364 --> 00:15:02.804
<00:14:58.364>or <00:14:58.504>let's <00:14:58.644>say <00:14:58.784>if <00:14:58.924>you <00:14:59.064>have <00:14:59.204>slices <00:14:59.344>of <00:14:59.484>array <00:14:59.624>of <00:14:59.764>data,

272
00:15:03.084 --> 00:15:04.764
<00:15:03.084>it <00:15:03.317>all <00:15:03.550>goes <00:15:03.784>into <00:15:04.017>the <00:15:04.250>linear <00:15:04.483>memory.

273
00:15:05.004 --> 00:15:07.364
<00:15:05.004>What <00:15:05.237>eventually <00:15:05.470>you <00:15:05.704>get <00:15:05.937>during <00:15:06.170>the <00:15:06.404>runtime

274
00:15:07.364 --> 00:15:11.364
<00:15:07.364>is <00:15:07.504>the <00:15:07.644>index <00:15:07.784>where <00:15:07.924>that's <00:15:08.064>in <00:15:08.204>the <00:15:08.344>memory, <00:15:08.484>where <00:15:08.624>it's <00:15:08.764>stored,

275
00:15:11.544 --> 00:15:13.164
<00:15:11.544>and <00:15:11.777>then <00:15:12.010>the <00:15:12.244>length <00:15:12.477>of <00:15:12.710>the <00:15:12.944>data.

276
00:15:13.364 --> 00:15:16.504
<00:15:13.364>And <00:15:13.519>eventually, <00:15:13.675>your <00:15:13.830>runtime <00:15:13.986>will <00:15:14.141>go <00:15:14.297>to <00:15:14.452>the <00:15:14.608>memory <00:15:14.764>index,

277
00:15:17.104 --> 00:15:19.704
<00:15:17.104>fetch <00:15:17.279>those <00:15:17.454>many <00:15:17.629>bytes, <00:15:17.804>and <00:15:17.979>give <00:15:18.154>it <00:15:18.329>to <00:15:18.504>you.

278
00:15:19.844 --> 00:15:20.884
<00:15:19.844>And <00:15:20.078>that's <00:15:20.312>how <00:15:20.546>it <00:15:20.780>works.

279
00:15:21.004 --> 00:15:24.144
<00:15:21.004>There <00:15:21.204>is <00:15:21.404>no <00:15:21.604>concept <00:15:21.804>of <00:15:22.004>arrays <00:15:22.204>within <00:15:22.404>WebAssembly.

280
00:15:24.144 --> 00:15:25.964
So,

281
00:15:26.437 --> 00:15:30.797
<00:15:26.437>The <00:15:26.612>host <00:15:26.787>is <00:15:26.962>responsible <00:15:27.137>for <00:15:27.312>resolving <00:15:27.487>all <00:15:27.662>the <00:15:27.837>inputs,

282
00:15:30.977 --> 00:15:33.817
<00:15:30.977>and <00:15:31.257>what <00:15:31.536>input <00:15:31.817>is, <00:15:32.097>for <00:15:32.377>example,

283
00:15:34.017 --> 00:15:37.237
<00:15:34.017>let's <00:15:34.192>say <00:15:34.367>I <00:15:34.542>want <00:15:34.717>to <00:15:34.892>print <00:15:35.067>something <00:15:35.242>onto <00:15:35.417>console

284
00:15:37.237 --> 00:15:38.077
<00:15:37.237>as <00:15:37.489>a <00:15:37.741>WASM <00:15:37.992>module.

285
00:15:38.317 --> 00:15:40.837
<00:15:38.317>I <00:15:38.492>do <00:15:38.667>not <00:15:38.842>have <00:15:39.017>that <00:15:39.192>capability <00:15:39.367>inside <00:15:39.542>the <00:15:39.717>WebAssembly.

286
00:15:41.037 --> 00:15:43.977
<00:15:41.037>What <00:15:41.164>I <00:15:41.291>have <00:15:41.418>to <00:15:41.546>do <00:15:41.673>is <00:15:41.800>rely <00:15:41.927>on <00:15:42.055>the <00:15:42.182>host <00:15:42.309>providing <00:15:42.437>me

287
00:15:43.977 --> 00:15:47.297
<00:15:43.977>with <00:15:44.177>the <00:15:44.377>right <00:15:44.577>functions, <00:15:44.776>like <00:15:44.977>FDWrite <00:15:45.177>or <00:15:45.377>whatnot,

288
00:15:47.517 --> 00:15:50.617
<00:15:47.517>so <00:15:47.717>that <00:15:47.917>I <00:15:48.117>can, <00:15:48.317>as <00:15:48.517>a <00:15:48.717>WASM <00:15:48.917>module,

289
00:15:50.797 --> 00:15:52.877
<00:15:50.797>I <00:15:50.997>call <00:15:51.197>out <00:15:51.397>to <00:15:51.597>the <00:15:51.797>host <00:15:51.997>and <00:15:52.197>say,

290
00:15:52.877 --> 00:15:54.437
<00:15:52.877>okay, <00:15:53.343>this <00:15:53.810>is <00:15:54.276>the...

291
00:15:54.511 --> 00:15:57.291
<00:15:54.511>the <00:15:54.666>address <00:15:54.822>of <00:15:54.977>the <00:15:55.133>string <00:15:55.288>which <00:15:55.444>I <00:15:55.599>want <00:15:55.755>to <00:15:55.911>write.

292
00:15:57.431 --> 00:15:59.431
<00:15:57.431>This <00:15:57.558>is <00:15:57.685>the <00:15:57.812>length <00:15:57.940>of <00:15:58.067>the <00:15:58.194>string <00:15:58.321>that <00:15:58.449>I <00:15:58.576>want <00:15:58.703>to <00:15:58.831>write.

293
00:15:59.611 --> 00:16:00.691
<00:15:59.611>Could <00:15:59.805>you <00:15:59.999>write <00:16:00.194>it <00:16:00.388>for <00:16:00.583>me?

294
00:16:00.851 --> 00:16:03.891
<00:16:00.851>And <00:16:01.006>that's <00:16:01.162>how <00:16:01.317>it <00:16:01.473>goes <00:16:01.628>from <00:16:01.784>the <00:16:01.939>was <00:16:02.095>module, <00:16:02.251>which

295
00:16:03.891 --> 00:16:05.431
<00:16:03.891>is <00:16:04.168>the <00:16:04.445>guest, <00:16:04.722>to <00:16:04.999>the <00:16:05.277>host.

296
00:16:05.771 --> 00:16:07.451
<00:16:05.771>And <00:16:06.050>then <00:16:06.330>it <00:16:06.611>eventually <00:16:06.891>gets <00:16:07.170>printed.

297
00:16:12.091 --> 00:16:14.171
<00:16:12.091>Wisk <00:16:12.324>declares <00:16:12.557>the <00:16:12.791>shape, <00:16:13.024>but <00:16:13.257>it <00:16:13.491>actually

298
00:16:14.171 --> 00:16:16.251
<00:16:14.171>does <00:16:14.451>not <00:16:14.731>do <00:16:15.011>anything <00:16:15.291>with <00:16:15.571>memory.

299
00:16:16.571 --> 00:16:19.431
<00:16:16.571>I <00:16:16.746>never <00:16:16.921>went <00:16:17.096>to <00:16:17.271>that <00:16:17.446>stage <00:16:17.621>of <00:16:17.796>actually <00:16:17.971>implementing

300
00:16:19.431 --> 00:16:20.251
<00:16:19.431>the <00:16:19.800>linear <00:16:20.169>memory.

301
00:16:20.391 --> 00:16:21.891
<00:16:20.391>I <00:16:20.661>just <00:16:20.930>ran <00:16:21.200>out <00:16:21.471>of <00:16:21.741>time.

302
00:16:21.891 --> 00:16:22.511
<00:16:21.891>And <00:16:21.983>I <00:16:22.077>just <00:16:22.170>ran <00:16:22.262>out <00:16:22.356>of <00:16:22.449>time.

303
00:16:22.585 --> 00:16:24.205
<00:16:22.585>other <00:16:23.051>things <00:16:23.518>got <00:16:23.985>priority.

304
00:16:24.765 --> 00:16:27.525
<00:16:24.765>So, <00:16:24.939>Wisk <00:16:25.115>actually <00:16:25.290>does <00:16:25.465>not <00:16:25.640>do <00:16:25.814>any <00:16:25.990>memory <00:16:26.165>management.

305
00:16:27.705 --> 00:16:28.525
<00:16:27.705>It <00:16:27.951>just <00:16:28.197>declares <00:16:28.443>it.

306
00:16:28.625 --> 00:16:31.305
<00:16:28.625>So, <00:16:28.780>if <00:16:28.936>a <00:16:29.091>module <00:16:29.247>has <00:16:29.402>something, <00:16:29.558>it <00:16:29.713>can <00:16:29.869>just <00:16:30.025>instantiate,

307
00:16:31.445 --> 00:16:34.745
<00:16:31.445>but <00:16:31.585>it <00:16:31.725>does <00:16:31.865>not <00:16:32.005>really <00:16:32.145>do <00:16:32.285>much <00:16:32.425>with <00:16:32.565>the <00:16:32.705>memory <00:16:32.845>itself.

308
00:16:39.025 --> 00:16:41.765
<00:16:39.025>As <00:16:39.225>a <00:16:39.425>final <00:16:39.625>step, <00:16:39.824>we <00:16:40.025>actually <00:16:40.225>start <00:16:40.425>executing.

309
00:16:42.085 --> 00:16:45.765
<00:16:42.085>Any <00:16:42.240>runtime, <00:16:42.396>walk <00:16:42.551>the <00:16:42.707>instructions <00:16:42.862>in <00:16:43.018>a <00:16:43.173>stack <00:16:43.329>machine <00:16:43.485>model.

310
00:16:45.965 --> 00:16:50.585
<00:16:45.965>Now, <00:16:46.198>we <00:16:46.431>know <00:16:46.665>that <00:16:46.898>Wasm <00:16:47.131>is <00:16:47.365>stack-based.

311
00:16:50.659 --> 00:16:55.439
<00:16:50.659>A <00:16:50.752>lot <00:16:50.845>of <00:16:50.939>people <00:16:51.032>think <00:16:51.125>that <00:16:51.218>Wasm <00:16:51.312>is <00:16:51.405>fast <00:16:51.499>because <00:16:51.592>it's <00:16:51.685>stack-based, <00:16:51.779>but <00:16:51.872>that's <00:16:51.965>not <00:16:52.059>true.

312
00:16:56.079 --> 00:17:01.159
<00:16:56.079>Stack <00:16:56.218>-based <00:16:56.358>machines <00:16:56.498>give <00:16:56.638>you <00:16:56.779>an <00:16:56.919>option <00:16:57.059>that <00:16:57.199>you <00:16:57.339>can <00:16:57.478>interpret

313
00:17:01.159 --> 00:17:02.699
<00:17:01.159>or <00:17:01.436>you <00:17:01.713>can <00:17:01.990>JIT <00:17:02.267>compile <00:17:02.545>or

314
00:17:02.699 --> 00:17:07.959
<00:17:02.699>you <00:17:02.799>can <00:17:02.899>AOT, <00:17:02.998>but <00:17:03.098>those <00:17:03.199>decisions <00:17:03.299>are <00:17:03.399>the <00:17:03.498>ones <00:17:03.598>that <00:17:03.699>make <00:17:03.799>your <00:17:03.899>execution <00:17:03.998>near <00:17:04.098>-native,

315
00:17:08.139 --> 00:17:08.399
not

316
00:17:08.399 --> 00:17:09.639
<00:17:08.398>just <00:17:08.956>being <00:17:09.514>stack-based.

317
00:17:09.879 --> 00:17:14.599
<00:17:09.878>What <00:17:09.978>stack-based <00:17:10.079>basically <00:17:10.178>means <00:17:10.279>is, <00:17:10.378>let's <00:17:10.478>say <00:17:10.579>we <00:17:10.678>have <00:17:10.779>a <00:17:10.878>function <00:17:10.978>called <00:17:11.079>run, <00:17:11.178>and <00:17:11.279>what

318
00:17:14.599 --> 00:17:18.659
<00:17:14.598>we <00:17:14.715>are <00:17:14.832>doing <00:17:14.948>is <00:17:15.065>we <00:17:15.182>are <00:17:15.299>simply <00:17:15.415>taking <00:17:15.532>two <00:17:15.648>parameters, <00:17:15.765>five <00:17:15.882>and <00:17:15.999>three.

319
00:17:18.733 --> 00:17:23.853
<00:17:18.733>then <00:17:18.888>the <00:17:19.044>first <00:17:19.199>thing <00:17:19.355>it's <00:17:19.510>because <00:17:19.666>it's <00:17:19.821>a <00:17:19.977>stack <00:17:20.133>based

320
00:17:23.853 --> 00:17:25.413
<00:17:23.853>machine <00:17:24.203>you <00:17:24.553>do <00:17:24.903>not <00:17:25.253>get

321
00:17:25.413 --> 00:17:29.953
<00:17:25.413>registers <00:17:25.512>so <00:17:25.613>everything <00:17:25.713>lives <00:17:25.813>in <00:17:25.913>a <00:17:26.012>stack <00:17:26.113>or <00:17:26.213>in <00:17:26.313>the <00:17:26.413>local <00:17:26.512>store <00:17:26.613>that <00:17:26.713>a <00:17:26.813>function

322
00:17:29.953 --> 00:17:35.213
<00:17:29.953>gets <00:17:30.040>so <00:17:30.128>when <00:17:30.215>we <00:17:30.303>do <00:17:30.390>a <00:17:30.478>local <00:17:30.565>get <00:17:30.653>zero <00:17:30.740>it <00:17:30.828>only <00:17:30.915>straightaway <00:17:31.003>goes <00:17:31.090>to <00:17:31.178>and <00:17:31.265>check <00:17:31.353>okay

323
00:17:35.213 --> 00:17:40.493
<00:17:35.213>there's <00:17:35.306>a <00:17:35.399>five <00:17:35.493>and <00:17:35.586>it <00:17:35.679>pushes <00:17:35.773>it <00:17:35.866>onto <00:17:35.959>the <00:17:36.053>stack <00:17:36.146>so <00:17:36.239>they <00:17:36.332>there's <00:17:36.426>always <00:17:36.519>one <00:17:36.613>entry

324
00:17:40.493 --> 00:17:45.553
<00:17:40.493>on <00:17:40.575>the <00:17:40.657>stack <00:17:40.740>the <00:17:40.822>next <00:17:40.904>one <00:17:40.987>is <00:17:41.069>we <00:17:41.151>do <00:17:41.234>a <00:17:41.316>get <00:17:41.398>one <00:17:41.481>so <00:17:41.563>this <00:17:41.645>zero <00:17:41.728>and <00:17:41.810>one <00:17:41.893>is

325
00:17:45.553 --> 00:17:45.873
basically

326
00:17:45.873 --> 00:17:46.733
<00:17:45.873>the <00:17:46.260>index <00:17:46.647>or

327
00:17:46.807 --> 00:17:49.947
<00:17:46.807>in <00:17:46.982>the <00:17:47.157>local <00:17:47.332>store, <00:17:47.507>which <00:17:47.682>the <00:17:47.857>runtime <00:17:48.032>will <00:17:48.207>fetch.

328
00:17:50.127 --> 00:17:52.747
<00:17:50.127>And <00:17:50.327>it <00:17:50.527>believes <00:17:50.726>that <00:17:50.927>since <00:17:51.127>we <00:17:51.327>are <00:17:51.527>here,

329
00:17:52.947 --> 00:17:56.287
<00:17:52.947>it's <00:17:53.147>already <00:17:53.347>validated <00:17:53.547>that <00:17:53.747>the <00:17:53.947>values <00:17:54.147>will <00:17:54.347>actually

330
00:17:56.287 --> 00:17:58.447
<00:17:56.287>be <00:17:56.442>present, <00:17:56.598>and <00:17:56.753>it <00:17:56.909>can <00:17:57.064>be <00:17:57.220>pushed <00:17:57.375>onto <00:17:57.531>the <00:17:57.687>stack.

331
00:17:59.287 --> 00:18:02.167
<00:17:59.287>So <00:17:59.403>we <00:17:59.520>get <00:17:59.637>0, <00:17:59.753>we <00:17:59.870>get <00:17:59.987>1, <00:18:00.103>we <00:18:00.220>push <00:18:00.337>it <00:18:00.453>onto <00:18:00.570>the <00:18:00.687>stack.

332
00:18:02.387 --> 00:18:07.507
<00:18:02.387>The <00:18:02.542>next <00:18:02.698>function, <00:18:02.853>add, <00:18:03.009>simply <00:18:03.164>pops <00:18:03.320>those <00:18:03.475>values, <00:18:03.631>adds <00:18:03.787>them,

333
00:18:07.687 --> 00:18:11.327
<00:18:07.687>and <00:18:07.861>straightaway <00:18:08.036>pushes <00:18:08.212>the <00:18:08.387>result <00:18:08.562>back <00:18:08.736>to <00:18:08.911>the <00:18:09.087>stack.

334
00:18:11.487 --> 00:18:12.687
<00:18:11.487>It <00:18:11.757>does <00:18:12.027>not <00:18:12.297>return <00:18:12.567>anything.

335
00:18:12.687 --> 00:18:14.547
<00:18:12.687>And <00:18:12.887>the <00:18:13.087>end, <00:18:13.286>which <00:18:13.486>is <00:18:13.687>the <00:18:13.887>return <00:18:14.087>call,

336
00:18:14.881 --> 00:18:19.801
<00:18:14.881>simply <00:18:14.997>goes <00:18:15.114>to <00:18:15.231>the <00:18:15.347>stack <00:18:15.464>and <00:18:15.581>pops <00:18:15.697>the <00:18:15.814>last <00:18:15.931>value <00:18:16.047>and <00:18:16.164>returns <00:18:16.281>it.

337
00:18:20.301 --> 00:18:22.721
<00:18:20.301>So <00:18:20.581>here, <00:18:20.860>it's <00:18:21.140>a <00:18:21.420>stack <00:18:21.701>machine.

338
00:18:22.861 --> 00:18:26.681
<00:18:22.861>If <00:18:22.977>it <00:18:23.094>were <00:18:23.211>to <00:18:23.327>be <00:18:23.444>something <00:18:23.561>else, <00:18:23.677>we <00:18:23.794>will <00:18:23.911>have <00:18:24.027>registers <00:18:24.144>and <00:18:24.261>whatnot.

339
00:18:26.961 --> 00:18:29.961
<00:18:26.961>But <00:18:27.241>because <00:18:27.521>it's <00:18:27.801>WebAssembly <00:18:28.081>is <00:18:28.361>stack-based,

340
00:18:30.141 --> 00:18:32.301
<00:18:30.141>everything <00:18:30.421>works <00:18:30.701>on <00:18:30.981>opcodes <00:18:31.261>and <00:18:31.541>oprins.

341
00:18:36.161 --> 00:18:39.321
<00:18:36.161>Now, <00:18:36.441>risk <00:18:36.721>being <00:18:37.001>a <00:18:37.281>tiny <00:18:37.561>interpreter.

342
00:18:39.561 --> 00:18:42.841
<00:18:39.561>And <00:18:39.677>the <00:18:39.794>reason <00:18:39.910>I <00:18:40.027>say <00:18:40.144>it's <00:18:40.261>an <00:18:40.377>interpreter <00:18:40.494>is <00:18:40.610>because <00:18:40.727>it <00:18:40.844>does <00:18:40.961>not

343
00:18:42.955 --> 00:18:48.455
<00:18:42.955>any <00:18:43.110>JIT <00:18:43.266>compilation. <00:18:43.421>It <00:18:43.577>does <00:18:43.732>not <00:18:43.888>do <00:18:44.043>AOT. <00:18:44.199>More <00:18:44.355>sophisticated

344
00:18:48.455 --> 00:18:49.735
<00:18:48.455>run <00:18:48.839>times <00:18:49.223>to <00:18:49.607>JIT

345
00:18:49.735 --> 00:18:54.575
<00:18:49.735>compilation, <00:18:49.834>they <00:18:49.935>also <00:18:50.034>give <00:18:50.135>you <00:18:50.235>an <00:18:50.334>option <00:18:50.435>to <00:18:50.534>AOT <00:18:50.635>if <00:18:50.735>you <00:18:50.834>can. <00:18:50.935>So <00:18:51.034>we <00:18:51.135>only

346
00:18:54.575 --> 00:18:59.415
<00:18:54.575>implement <00:18:54.702>eight <00:18:54.829>opcodes <00:18:54.956>and <00:18:55.084>opcode <00:18:55.211>meaning <00:18:55.338>like <00:18:55.465>we <00:18:55.593>have <00:18:55.720>local <00:18:55.847>get, <00:18:55.975>these

347
00:18:59.415 --> 00:19:03.335
<00:18:59.415>are <00:18:59.522>the <00:18:59.630>opcodes <00:18:59.738>that <00:18:59.845>you <00:18:59.953>have <00:19:00.061>to <00:19:00.168>actually <00:19:00.276>come <00:19:00.384>implement. <00:19:00.491>So <00:19:00.599>let's <00:19:00.707>take <00:19:00.815>a

348
00:19:03.335 --> 00:19:08.415
<00:19:03.335>quick <00:19:03.510>example. <00:19:03.685>And <00:19:03.860>one <00:19:04.035>more <00:19:04.210>thing <00:19:04.385>that's <00:19:04.560>worth <00:19:04.735>highlighting

349
00:19:08.415 --> 00:19:09.235
is...

350
00:19:11.029 --> 00:19:16.549
<00:19:11.029>WISC <00:19:11.106>at <00:19:11.184>the <00:19:11.262>moment <00:19:11.340>does <00:19:11.417>not <00:19:11.495>support, <00:19:11.573>and <00:19:11.651>it's <00:19:11.729>probably <00:19:11.806>never <00:19:11.884>going <00:19:11.962>to <00:19:12.040>support <00:19:12.117>loops <00:19:12.195>or <00:19:12.273>if <00:19:12.351>conditions, <00:19:12.429>conditional

351
00:19:16.549 --> 00:19:17.969
<00:19:16.549>navigation <00:19:16.975>through <00:19:17.401>your <00:19:17.827>code.

352
00:19:18.089 --> 00:19:23.709
<00:19:18.089>It <00:19:18.182>just <00:19:18.275>works <00:19:18.369>in <00:19:18.462>a <00:19:18.555>straight <00:19:18.649>line, <00:19:18.742>so <00:19:18.835>it <00:19:18.928>reads <00:19:19.022>the <00:19:19.115>bytes, <00:19:19.208>and <00:19:19.302>it <00:19:19.395>just <00:19:19.489>executes

353
00:19:23.709 --> 00:19:23.909
them.

354
00:19:24.069 --> 00:19:29.089
<00:19:24.069>But <00:19:24.129>at <00:19:24.190>the <00:19:24.251>same <00:19:24.312>time, <00:19:24.373>let's <00:19:24.434>say <00:19:24.495>if <00:19:24.555>you <00:19:24.616>were <00:19:24.677>to <00:19:24.738>write <00:19:24.799>a <00:19:24.860>loop <00:19:24.921>where <00:19:24.982>you <00:19:25.042>want <00:19:25.103>to <00:19:25.164>print <00:19:25.225>a <00:19:25.286>few <00:19:25.347>things, <00:19:25.408>it's <00:19:25.469>not

355
00:19:29.089 --> 00:19:30.629
<00:19:29.089>possible <00:19:29.366>with <00:19:29.643>WISC <00:19:29.920>at <00:19:30.197>the <00:19:30.475>moment.

356
00:19:31.929 --> 00:19:37.129
<00:19:31.929>So <00:19:32.022>here <00:19:32.115>are <00:19:32.209>the <00:19:32.302>opcodes <00:19:32.395>that <00:19:32.489>are <00:19:32.582>supported, <00:19:32.675>and <00:19:32.769>I <00:19:32.862>use <00:19:32.955>Rust <00:19:33.049>because <00:19:33.142>it <00:19:33.235>makes <00:19:33.329>sense.

357
00:19:37.869 --> 00:19:38.949
<00:19:37.869>Enums <00:19:38.193>are <00:19:38.517>very <00:19:38.841>powerful.

358
00:19:39.102 --> 00:19:43.902
<00:19:39.102>in <00:19:39.184>dust <00:19:39.266>and <00:19:39.349>I <00:19:39.431>did <00:19:39.513>not <00:19:39.596>want <00:19:39.678>to <00:19:39.760>do <00:19:39.843>try <00:19:39.925>any <00:19:40.007>other <00:19:40.090>language <00:19:40.172>because <00:19:40.254>I <00:19:40.337>know <00:19:40.419>it's <00:19:40.502>it's

359
00:19:43.902 --> 00:19:48.382
<00:19:43.902>good <00:19:44.018>it's <00:19:44.135>a <00:19:44.252>good <00:19:44.368>suitable <00:19:44.485>language <00:19:44.602>and <00:19:44.718>ISA <00:19:44.835>being <00:19:44.952>the <00:19:45.068>instruction <00:19:45.185>set <00:19:45.302>architecture

360
00:19:48.382 --> 00:19:52.842
<00:19:48.382>is <00:19:48.482>a <00:19:48.582>finite <00:19:48.682>set <00:19:48.782>of <00:19:48.882>instructions <00:19:48.982>that <00:19:49.082>you <00:19:49.182>want <00:19:49.282>to <00:19:49.382>support <00:19:49.482>it's <00:19:49.582>highly <00:19:49.682>possible <00:19:49.782>to

361
00:19:54.102 --> 00:19:59.122
<00:19:54.102>put <00:19:54.302>everything <00:19:54.502>together <00:19:54.702>in <00:19:54.902>an <00:19:55.102>enum <00:19:55.302>eventually <00:19:55.502>when

362
00:19:59.122 --> 00:20:00.562
<00:19:59.122>you <00:19:59.446>go <00:19:59.770>through <00:20:00.094>each <00:20:00.418>op

363
00:20:00.562 --> 00:20:05.782
<00:20:00.562>code <00:20:00.655>you <00:20:00.748>do <00:20:00.841>a <00:20:00.935>match <00:20:01.028>which <00:20:01.121>is <00:20:01.215>again <00:20:01.308>a <00:20:01.401>rust <00:20:01.495>thing <00:20:01.588>but <00:20:01.681>you <00:20:01.775>see <00:20:01.868>okay <00:20:01.962>there's

364
00:20:05.782 --> 00:20:05.902
an

365
00:20:05.902 --> 00:20:06.942
<00:20:05.902>I <00:20:06.089>try <00:20:06.276>to <00:20:06.463>do <00:20:06.650>a <00:20:06.838>constant

366
00:20:07.176 --> 00:20:10.016
<00:20:07.176>you <00:20:07.331>put <00:20:07.487>it <00:20:07.642>onto <00:20:07.798>the <00:20:07.953>stack, <00:20:08.109>and <00:20:08.264>this <00:20:08.420>is <00:20:08.576>something

367
00:20:10.016 --> 00:20:11.736
<00:20:10.016>that <00:20:10.216>you <00:20:10.416>have <00:20:10.616>to <00:20:10.816>do <00:20:11.016>for <00:20:11.216>each <00:20:11.416>opcode.

368
00:20:11.896 --> 00:20:12.596
<00:20:11.896>So <00:20:12.053>it's <00:20:12.211>up <00:20:12.368>to <00:20:12.526>you.

369
00:20:12.936 --> 00:20:15.776
<00:20:12.936>Let's <00:20:13.076>say <00:20:13.216>if <00:20:13.356>you <00:20:13.495>want <00:20:13.636>to <00:20:13.775>take <00:20:13.916>WISC <00:20:14.055>and <00:20:14.196>improve <00:20:14.336>something

370
00:20:15.776 --> 00:20:17.356
<00:20:15.776>and <00:20:15.951>get <00:20:16.126>a <00:20:16.301>feel <00:20:16.476>of <00:20:16.651>what <00:20:16.826>exactly <00:20:17.001>it <00:20:17.176>is

371
00:20:17.356 --> 00:20:21.136
<00:20:17.356>to <00:20:17.531>implementing <00:20:17.706>a <00:20:17.881>runtime, <00:20:18.056>you <00:20:18.231>just <00:20:18.406>add <00:20:18.581>an <00:20:18.756>opcode.

372
00:20:21.216 --> 00:20:22.476
<00:20:21.216>And <00:20:21.499>because <00:20:21.783>it's <00:20:22.066>ROST, <00:20:22.350>everything

373
00:20:22.476 --> 00:20:23.796
<00:20:22.476>will <00:20:22.773>break <00:20:23.070>at <00:20:23.367>compile <00:20:23.664>time.

374
00:20:23.836 --> 00:20:26.956
<00:20:23.836>And <00:20:23.963>then <00:20:24.090>you <00:20:24.217>fix <00:20:24.345>all <00:20:24.472>the <00:20:24.599>matches <00:20:24.726>or <00:20:24.854>all <00:20:24.981>the <00:20:25.108>compilation <00:20:25.236>errors,

375
00:20:27.096 --> 00:20:28.716
<00:20:27.096>and <00:20:27.376>you <00:20:27.656>will <00:20:27.936>improve <00:20:28.216>the <00:20:28.496>runtime,

376
00:20:28.876 --> 00:20:31.536
<00:20:28.876>because <00:20:29.051>it <00:20:29.226>will <00:20:29.401>keep <00:20:29.576>failing <00:20:29.751>until <00:20:29.926>you <00:20:30.101>fix <00:20:30.276>it.

377
00:20:32.036 --> 00:20:34.056
<00:20:32.036>So <00:20:32.316>it's <00:20:32.596>slow, <00:20:32.876>but <00:20:33.156>it's <00:20:33.436>simple.

378
00:20:35.250 --> 00:20:39.290
<00:20:35.250>So <00:20:35.350>how <00:20:35.450>exactly <00:20:35.550>do <00:20:35.650>we <00:20:35.750>make <00:20:35.850>first, <00:20:35.950>how <00:20:36.050>the <00:20:36.150>traditional <00:20:36.250>run <00:20:36.350>times <00:20:36.450>make <00:20:36.550>it <00:20:36.650>first?

379
00:20:39.470 --> 00:20:44.850
<00:20:39.470>By <00:20:39.703>using <00:20:39.936>JIT <00:20:40.170>and <00:20:40.403>optimized <00:20:40.636>JIT. <00:20:40.870>JIT

380
00:20:44.850 --> 00:20:49.730
<00:20:44.850>basically <00:20:45.024>means, <00:20:45.199>let's <00:20:45.375>say <00:20:45.550>you <00:20:45.725>have <00:20:45.899>your <00:20:46.074>whole <00:20:46.250>code.

381
00:20:50.150 --> 00:20:53.670
<00:20:50.150>When <00:20:50.232>you <00:20:50.314>run <00:20:50.397>it <00:20:50.479>for <00:20:50.561>the <00:20:50.644>first <00:20:50.726>time, <00:20:50.808>when <00:20:50.891>you <00:20:50.973>run <00:20:51.055>your <00:20:51.138>awesome <00:20:51.220>module <00:20:51.302>for <00:20:51.385>the <00:20:51.467>first <00:20:51.550>time,

382
00:20:53.910 --> 00:20:58.990
<00:20:53.910>it <00:20:54.065>will <00:20:54.221>transpile <00:20:54.376>it <00:20:54.532>into <00:20:54.687>an <00:20:54.843>intermediate <00:20:54.998>format <00:20:55.154>that <00:20:55.310>the

383
00:20:58.990 --> 00:21:00.230
<00:20:58.990>runtime <00:20:59.548>itself <00:21:00.106>understands.

384
00:21:00.370 --> 00:21:02.850
<00:21:00.370>It <00:21:00.525>optimizes <00:21:00.681>the <00:21:00.836>order <00:21:00.992>in <00:21:01.147>which <00:21:01.303>you <00:21:01.458>want <00:21:01.614>to <00:21:01.770>execute.

385
00:21:03.324 --> 00:21:04.284
<00:21:03.324>and <00:21:03.612>move <00:21:03.900>things <00:21:04.188>around.

386
00:21:04.864 --> 00:21:07.244
<00:21:04.864>And <00:21:05.064>eventually, <00:21:05.264>the <00:21:05.464>first <00:21:05.664>run <00:21:05.864>will <00:21:06.064>be <00:21:06.264>time-consuming,

387
00:21:07.344 --> 00:21:10.884
<00:21:07.344>but <00:21:07.499>any <00:21:07.655>follow-up <00:21:07.810>runs <00:21:07.966>for <00:21:08.121>that <00:21:08.277>will <00:21:08.432>be <00:21:08.588>much <00:21:08.744>faster.

388
00:21:11.504 --> 00:21:16.064
<00:21:11.504>Optimizing <00:21:11.678>JIT <00:21:11.853>is <00:21:12.029>much <00:21:12.204>better, <00:21:12.379>where <00:21:12.553>you <00:21:12.728>get <00:21:12.904>registers.

389
00:21:16.324 --> 00:21:21.744
<00:21:16.324>And <00:21:16.451>also, <00:21:16.578>the <00:21:16.705>runtime <00:21:16.833>does <00:21:16.960>a <00:21:17.087>lot <00:21:17.214>more <00:21:17.342>in <00:21:17.469>terms <00:21:17.596>of <00:21:17.724>it

390
00:21:21.744 --> 00:21:22.084
directly

391
00:21:22.084 --> 00:21:24.284
<00:21:22.084>compiles <00:21:22.317>into <00:21:22.550>the <00:21:22.784>machine <00:21:23.017>code <00:21:23.250>that <00:21:23.484>you

392
00:21:24.284 --> 00:21:25.844
<00:21:24.284>can <00:21:24.564>run <00:21:24.844>on <00:21:25.124>the <00:21:25.404>target <00:21:25.684>itself.

393
00:21:25.924 --> 00:21:28.264
<00:21:25.924>That <00:21:26.124>also <00:21:26.324>goes <00:21:26.524>in <00:21:26.724>line <00:21:26.924>with <00:21:27.124>the <00:21:27.324>AOT.

394
00:21:30.384 --> 00:21:31.264
<00:21:30.384>And <00:21:30.780>I'm <00:21:31.176>running.

395
00:21:31.398 --> 00:21:36.558
<00:21:31.398>of <00:21:31.538>time. <00:21:31.678>Here's <00:21:31.818>a <00:21:31.957>quick <00:21:32.098>example <00:21:32.237>of <00:21:32.378>the <00:21:32.517>same <00:21:32.658>function <00:21:32.798>that

396
00:21:36.558 --> 00:21:38.578
<00:21:36.558>can <00:21:36.908>be <00:21:37.258>implemented <00:21:37.608>in <00:21:37.958>what,

397
00:21:39.098 --> 00:21:44.558
<00:21:39.098>Rust, <00:21:39.238>and <00:21:39.378>Go. <00:21:39.518>So <00:21:39.658>it's <00:21:39.798>just <00:21:39.937>a <00:21:40.078>simple <00:21:40.217>addition <00:21:40.358>which <00:21:40.498>is

398
00:21:44.558 --> 00:21:46.378
<00:21:44.558>possible <00:21:44.791>to <00:21:45.024>run <00:21:45.258>in <00:21:45.491>both <00:21:45.724>the <00:21:45.958>languages,

399
00:21:46.738 --> 00:21:51.358
<00:21:46.738>three <00:21:46.825>of <00:21:46.913>the <00:21:47.000>languages <00:21:47.088>or <00:21:47.175>any <00:21:47.263>other <00:21:47.350>language. <00:21:47.438>And <00:21:47.525>once <00:21:47.613>you <00:21:47.700>compile <00:21:47.788>it <00:21:47.875>into <00:21:47.963>Wasm, <00:21:48.050>you <00:21:48.138>can

400
00:21:51.358 --> 00:21:56.298
<00:21:51.358>simply <00:21:51.445>execute, <00:21:51.533>let's <00:21:51.620>say, <00:21:51.707>risk <00:21:51.795>or <00:21:51.883>any <00:21:51.970>other <00:21:52.058>runtime. <00:21:52.145>You <00:21:52.233>do <00:21:52.320>an <00:21:52.408>invoke <00:21:52.495>because <00:21:52.582>we <00:21:52.670>are <00:21:52.758>exporting

401
00:21:56.298 --> 00:21:59.178
<00:21:56.298>the <00:21:56.473>function <00:21:56.648>run <00:21:56.823>here <00:21:56.998>and <00:21:57.173>you <00:21:57.348>provide <00:21:57.523>the <00:21:57.698>arguments.

402
00:21:59.472 --> 00:22:00.532
<00:21:59.472>that <00:21:59.710>you <00:21:59.949>want <00:22:00.187>to <00:22:00.426>run.

403
00:22:01.412 --> 00:22:04.112
<00:22:01.412>And <00:22:01.612>these <00:22:01.812>will <00:22:02.012>be <00:22:02.212>executed <00:22:02.412>as <00:22:02.612>the <00:22:02.812>one

404
00:22:04.112 --> 00:22:06.332
<00:22:04.112>that <00:22:04.287>we <00:22:04.462>saw <00:22:04.637>earlier, <00:22:04.812>local.get <00:22:04.987>and <00:22:05.162>all <00:22:05.337>that <00:22:05.512>stuff.

405
00:22:09.372 --> 00:22:10.952
<00:22:09.372>So <00:22:09.605>as <00:22:09.838>I <00:22:10.072>said, <00:22:10.305>a <00:22:10.538>module <00:22:10.772>cannot.

406
00:22:11.092 --> 00:22:12.672
<00:22:11.092>I <00:22:11.247>have <00:22:11.403>to <00:22:11.558>rush <00:22:11.714>because <00:22:11.869>I'm <00:22:12.025>running <00:22:12.180>out <00:22:12.336>of <00:22:12.492>time.

407
00:22:13.972 --> 00:22:16.392
<00:22:13.972>A <00:22:14.205>model <00:22:14.438>itself <00:22:14.672>cannot <00:22:14.905>do <00:22:15.138>I-O <00:22:15.372>itself.

408
00:22:16.512 --> 00:22:17.292
<00:22:16.512>It <00:22:16.862>needs <00:22:17.214>WASI.

409
00:22:17.412 --> 00:22:21.512
<00:22:17.412>And <00:22:17.645>WASI <00:22:17.878>gives <00:22:18.112>you <00:22:18.345>the <00:22:18.578>standardized <00:22:18.812>implementations

410
00:22:21.512 --> 00:22:25.692
<00:22:21.512>of <00:22:21.667>certain <00:22:21.823>functions <00:22:21.978>that <00:22:22.134>you <00:22:22.289>can <00:22:22.445>use <00:22:22.600>instead <00:22:22.756>of <00:22:22.912>relying

411
00:22:27.546 --> 00:22:32.586
<00:22:27.546>host <00:22:27.662>itself <00:22:27.779>which <00:22:27.896>also <00:22:28.012>means <00:22:28.129>when <00:22:28.246>you <00:22:28.362>add <00:22:28.479>support <00:22:28.596>of <00:22:28.712>WASI <00:22:28.829>into <00:22:28.946>a

412
00:22:32.586 --> 00:22:34.186
<00:22:32.586>WASI <00:22:32.866>module, <00:22:33.146>the <00:22:33.426>size <00:22:33.706>of <00:22:33.986>the

413
00:22:34.186 --> 00:22:40.626
<00:22:34.186>module <00:22:34.419>itself <00:22:34.652>grows. <00:22:34.886>Let's <00:22:35.119>move <00:22:35.352>forward. <00:22:35.586>This

414
00:22:40.626 --> 00:22:44.166
<00:22:40.626>is, <00:22:40.766>I <00:22:40.906>think, <00:22:41.046>the <00:22:41.186>important <00:22:41.326>one. <00:22:41.466>A <00:22:41.606>lot <00:22:41.745>of <00:22:41.886>people <00:22:42.026>think

415
00:22:44.166 --> 00:22:49.386
<00:22:44.166>that <00:22:44.259>WebAssembly <00:22:44.352>is <00:22:44.446>still <00:22:44.539>confined <00:22:44.632>to <00:22:44.726>web <00:22:44.819>but <00:22:44.912>that's <00:22:45.005>not <00:22:45.099>true. <00:22:45.192>There <00:22:45.285>is <00:22:45.379>already <00:22:45.472>a <00:22:45.566>shim

416
00:22:49.386 --> 00:22:49.566
layer

417
00:22:49.566 --> 00:22:54.606
<00:22:49.566>that's <00:22:49.666>available <00:22:49.766>in <00:22:49.866>container <00:22:49.966>D <00:22:50.066>which <00:22:50.166>allows <00:22:50.266>you <00:22:50.366>to <00:22:50.466>run <00:22:50.566>WASI <00:22:50.666>modules <00:22:50.766>alongside <00:22:50.866>your <00:22:50.966>containers

418
00:22:54.606 --> 00:22:54.886
in

419
00:22:56.240 --> 00:22:59.060
<00:22:56.240>There <00:22:56.380>is <00:22:56.520>a <00:22:56.660>spin <00:22:56.800>and <00:22:56.940>spin <00:22:57.080>cube, <00:22:57.220>which <00:22:57.360>is <00:22:57.500>also, <00:22:57.640>again,

420
00:22:59.200 --> 00:23:02.540
<00:22:59.200>a <00:22:59.375>CNCF-based <00:22:59.550>project, <00:22:59.725>which <00:22:59.900>allows <00:23:00.075>you <00:23:00.250>to <00:23:00.425>have <00:23:00.600>fast

421
00:23:02.540 --> 00:23:04.240
<00:23:02.540>but <00:23:03.006>powered <00:23:03.473>by <00:23:03.940>WebAssembly.

422
00:23:04.500 --> 00:23:07.700
<00:23:04.500>It's <00:23:04.675>a <00:23:04.850>function <00:23:05.025>of <00:23:05.200>the <00:23:05.375>service, <00:23:05.550>but <00:23:05.725>using <00:23:05.900>WebAssembly.

423
00:23:08.000 --> 00:23:10.000
<00:23:08.000>Wasm <00:23:08.280>Cloud <00:23:08.560>is <00:23:08.840>super <00:23:09.120>famous <00:23:09.400>already.

424
00:23:10.200 --> 00:23:11.100
<00:23:10.200>No <00:23:10.362>need <00:23:10.524>to <00:23:10.686>talk <00:23:10.848>about <00:23:11.010>it.

425
00:23:11.340 --> 00:23:14.960
<00:23:11.340>Component <00:23:11.573>model <00:23:11.806>and <00:23:12.040>Wasm <00:23:12.273>202 <00:23:12.506>is <00:23:12.740>something

426
00:23:14.960 --> 00:23:19.700
<00:23:14.960>that's <00:23:15.193>coming <00:23:15.426>together <00:23:15.660>for <00:23:15.893>combining <00:23:16.126>multiple <00:23:16.360>modules

427
00:23:20.440 --> 00:23:23.560
<00:23:20.440>but <00:23:20.673>using <00:23:20.906>a <00:23:21.140>well-defined <00:23:21.373>interface, <00:23:21.606>not <00:23:21.840>just

428
00:23:23.693 --> 00:23:25.413
<00:23:23.693>piping <00:23:24.159>bytes <00:23:24.626>through <00:23:25.093>them.

429
00:23:25.653 --> 00:23:27.273
<00:23:25.653>I <00:23:25.933>do <00:23:26.213>not <00:23:26.493>have <00:23:26.773>much <00:23:27.053>experience.

430
00:23:27.273 --> 00:23:30.093
<00:23:27.273>I <00:23:27.428>would <00:23:27.584>prefer <00:23:27.739>not <00:23:27.895>to <00:23:28.050>beat <00:23:28.206>the <00:23:28.361>bush <00:23:28.517>around <00:23:28.673>it.

431
00:23:30.113 --> 00:23:32.593
<00:23:30.113>I <00:23:30.313>just <00:23:30.513>know <00:23:30.713>that <00:23:30.913>it's <00:23:31.113>for <00:23:31.313>type <00:23:31.513>safety.

432
00:23:32.753 --> 00:23:34.873
<00:23:32.753>But <00:23:32.893>I <00:23:33.033>don't <00:23:33.173>know <00:23:33.312>under <00:23:33.453>the <00:23:33.592>hood <00:23:33.733>what's <00:23:33.872>how <00:23:34.013>it's <00:23:34.153>working,

433
00:23:34.913 --> 00:23:36.353
<00:23:34.913>so <00:23:35.129>I'll <00:23:35.345>not <00:23:35.561>talk <00:23:35.777>much <00:23:35.993>about <00:23:36.209>it.

434
00:23:37.513 --> 00:23:40.553
<00:23:37.513>So <00:23:37.668>WebAssembly <00:23:37.824>itself <00:23:37.979>gives <00:23:38.135>you <00:23:38.290>a <00:23:38.446>much <00:23:38.601>better <00:23:38.757>cold <00:23:38.913>start,

435
00:23:40.613 --> 00:23:42.613
<00:23:40.613>and <00:23:40.846>it's <00:23:41.079>super <00:23:41.313>helpful <00:23:41.546>because <00:23:41.779>it's <00:23:42.013>tiny.

436
00:23:45.373 --> 00:23:47.053
<00:23:45.373>Here's <00:23:45.723>the <00:23:46.073>four <00:23:46.423>key <00:23:46.773>takeaways.

437
00:23:47.273 --> 00:23:49.133
<00:23:47.273>WebAssembly <00:23:47.553>is <00:23:47.832>based <00:23:48.112>on <00:23:48.392>Stack <00:23:48.673>Machine.

438
00:23:49.253 --> 00:23:51.693
<00:23:49.253>It's <00:23:49.453>a <00:23:49.653>binary <00:23:49.852>envelope <00:23:50.053>on <00:23:50.253>the <00:23:50.453>state <00:23:50.653>machine.

439
00:23:53.027 --> 00:23:53.747
<00:23:53.027>It's <00:23:53.351>a <00:23:53.675>runtime.

440
00:23:54.007 --> 00:23:56.327
<00:23:54.007>Every <00:23:54.182>runtime <00:23:54.357>has <00:23:54.532>to <00:23:54.707>go <00:23:54.882>through <00:23:55.057>those <00:23:55.232>four <00:23:55.407>stages.

441
00:23:56.447 --> 00:23:57.107
<00:23:56.447>It's <00:23:57.041>small.

442
00:23:57.287 --> 00:24:00.087
<00:23:57.287>And <00:23:57.462>that's <00:23:57.637>why <00:23:57.812>it's <00:23:57.987>super <00:23:58.162>useful <00:23:58.337>in <00:23:58.512>Edge <00:23:58.687>devices.

443
00:24:00.507 --> 00:24:03.167
<00:24:00.507>And <00:24:00.662>you <00:24:00.818>could <00:24:00.973>build <00:24:01.129>a <00:24:01.284>thin <00:24:01.440>slice <00:24:01.595>over <00:24:01.751>a <00:24:01.907>weekend.

444
00:24:04.327 --> 00:24:06.647
<00:24:04.327>Here <00:24:04.502>are <00:24:04.677>a <00:24:04.852>few <00:24:05.027>resources <00:24:05.202>that <00:24:05.377>you <00:24:05.552>can <00:24:05.727>check.

445
00:24:07.287 --> 00:24:09.347
<00:24:07.287>And <00:24:07.487>if <00:24:07.687>you <00:24:07.887>want <00:24:08.087>to <00:24:08.287>take <00:24:08.487>the <00:24:08.687>slides,

446
00:24:09.627 --> 00:24:10.607
<00:24:09.627>they're <00:24:10.068>also <00:24:10.509>available.

447
00:24:10.987 --> 00:24:12.907
<00:24:10.987>And <00:24:11.220>since <00:24:11.453>everything <00:24:11.687>was <00:24:11.920>in <00:24:12.153>a <00:24:12.387>terminal,

448
00:24:13.927 --> 00:24:15.187
<00:24:13.927>it's <00:24:14.304>all <00:24:14.683>marked <00:24:15.061>down.

449
00:24:15.307 --> 00:24:17.567
<00:24:15.307>So <00:24:15.447>you <00:24:15.587>can <00:24:15.727>just <00:24:15.867>take <00:24:16.007>a <00:24:16.147>look <00:24:16.287>and <00:24:16.427>try <00:24:16.567>things <00:24:16.707>out.

450
00:24:17.567 --> 00:24:19.187
<00:24:17.567>Before <00:24:18.267>I <00:24:18.967>drop.

451
00:24:19.841 --> 00:24:20.721
<00:24:19.841>I <00:24:20.039>have <00:24:20.236>a <00:24:20.435>few <00:24:20.633>seconds.

452
00:24:20.881 --> 00:24:21.961
<00:24:20.881>I <00:24:21.205>can <00:24:21.529>quickly <00:24:21.853>show.

453
00:24:23.461 --> 00:24:29.061
<00:24:23.461>So <00:24:23.661>if <00:24:23.861>we <00:24:24.061>take, <00:24:24.261>I <00:24:24.461>have <00:24:24.661>the <00:24:24.861>same

454
00:24:29.061 --> 00:24:29.941
<00:24:29.061>files <00:24:29.325>that <00:24:29.589>I <00:24:29.853>showed.

455
00:24:29.961 --> 00:24:31.881
<00:24:29.961>I <00:24:30.241>will <00:24:30.521>just <00:24:30.801>quickly <00:24:31.081>compile <00:24:31.361>them.

456
00:24:38.901 --> 00:24:40.921
<00:24:38.901>And <00:24:39.134>let's <00:24:39.367>see <00:24:39.601>if <00:24:39.834>I <00:24:40.067>can <00:24:40.301>type.

457
00:24:43.741 --> 00:24:44.861
Star.osm.

458
00:24:44.961 --> 00:24:47.461
<00:24:44.961>So <00:24:45.136>you <00:24:45.311>see <00:24:45.486>the <00:24:45.661>size <00:24:45.836>of <00:24:46.011>these <00:24:46.186>modules <00:24:46.361>are.

459
00:24:47.915 --> 00:24:48.875
<00:24:47.915>It's <00:24:48.347>so <00:24:48.779>small.

460
00:24:49.035 --> 00:24:49.635
<00:24:49.035>It's <00:24:49.305>a <00:24:49.575>function.

461
00:24:49.775 --> 00:24:51.875
<00:24:49.775>But <00:24:49.882>if <00:24:49.990>you <00:24:50.098>compile <00:24:50.205>it <00:24:50.313>as <00:24:50.421>a <00:24:50.528>binary, <00:24:50.636>it <00:24:50.744>will <00:24:50.851>be <00:24:50.959>a <00:24:51.067>lot <00:24:51.175>larger.

462
00:24:52.075 --> 00:24:54.775
<00:24:52.075>But <00:24:52.250>if <00:24:52.425>you <00:24:52.600>do <00:24:52.775>it <00:24:52.950>with <00:24:53.125>WebAssembly, <00:24:53.300>super <00:24:53.475>small.

463
00:24:55.315 --> 00:24:56.975
<00:24:55.315>And <00:24:55.665>we <00:24:56.015>can <00:24:56.365>run <00:24:56.715>it.

464
00:24:57.755 --> 00:24:58.955
<00:24:57.755>Let's <00:24:58.115>take <00:24:58.475>this <00:24:58.835>example.

465
00:24:59.135 --> 00:25:00.955
<00:24:59.135>So <00:24:59.485>it <00:24:59.835>works <00:25:00.185>for <00:25:00.535>sure.

466
00:25:01.335 --> 00:25:05.535
<00:25:01.335>But <00:25:01.435>yeah, <00:25:01.535>I'll <00:25:01.635>stop <00:25:01.735>here <00:25:01.835>and <00:25:01.935>probably <00:25:02.035>just <00:25:02.135>have <00:25:02.235>any <00:25:02.335>questions <00:25:02.435>if <00:25:02.535>there <00:25:02.635>are <00:25:02.735>any.

467
00:25:06.535 --> 00:25:07.095
<00:25:06.535>Thank <00:25:07.039>you.