@@ -457,6 +457,11 @@ be skipped over by an engine. The current list of valid `name_type` codes are:
457
457
| [ Module] ( #module-name ) | ` 0 ` | Assigns a name to the module |
458
458
| [ Function] ( #function-names ) | ` 1 ` | Assigns names to functions |
459
459
| [ Local] ( #local-names ) | ` 2 ` | Assigns names to locals in functions |
460
+ | [ Labels] ( #label-names ) | ` 3 ` | Assigns names to labels in functions |
461
+ | [ Type] ( #type-names ) | ` 4 ` | Assigns names to types |
462
+ | [ Table] ( #table-names ) | ` 5 ` | Assigns names to tables |
463
+ | [ Memory] ( #memory-names ) | ` 6 ` | Assigns names to memories |
464
+ | [ Global] ( #global-names ) | ` 7 ` | Assigns names to globals |
460
465
461
466
462
467
When present, subsections must appear in this order and at most once. The
@@ -522,6 +527,58 @@ where a `local_name` is encoded as:
522
527
| index | ` varuint32 ` | the index of the function whose locals are being named |
523
528
| local_map | ` name_map ` | assignment of names to local indices |
524
529
530
+ #### Label names
531
+
532
+ The label names subsection assigns ` name_map ` s to a subset of functions in the
533
+ [ function index space] ( Modules.md#function-index-space ) . This may include both
534
+ module-defined or imported functions, but is only meaningful for module-defined
535
+ functions. The ` name_map ` for a function assigns names to label indices, with
536
+ label indices assigned sequentially to the labels in the order they are introduced
537
+ by control structure operators (i.e. ` block ` , ` loop ` , or ` if ` ) in the function's
538
+ code.
539
+
540
+ | Field | Type | Description |
541
+ | ----- | ---- | ----------- |
542
+ | count | ` varuint32 ` | count of ` label_names ` in funcs |
543
+ | funcs | ` label_names* ` | sequence of ` label_names ` sorted by index |
544
+
545
+ where a ` label_name ` is encoded as:
546
+
547
+ | Field | Type | Description |
548
+ | ----- | ---- | ----------- |
549
+ | index | ` varuint32 ` | the index of the function whose labels are being named |
550
+ | label_map | ` name_map ` | assignment of names to labeling operator |
551
+
552
+ #### Type names
553
+
554
+ The type names subsection is a ` name_map ` which assigns names to a subset
555
+ of types in the module's [ type section] ( #type-section ) .
556
+
557
+ #### Table names
558
+
559
+ The table names subsection is a ` name_map ` which assigns names to a subset
560
+ of tables in the [ table index space] ( Modules.md#table-index-space ) .
561
+
562
+ #### Memory names
563
+
564
+ The memory names subsection is a ` name_map ` which assigns names to a subset
565
+ of memories in the [ linear memory index space] ( Modules.md#linear-memory-index-space ) .
566
+
567
+ #### Global names
568
+
569
+ The global names subsection is a ` name_map ` which assigns names to a subset
570
+ of globals in the [ global index space] ( Modules.md#global-index-space ) .
571
+
572
+ #### Module name
573
+
574
+ The module name subsection assigns a name to the module itself. It simply
575
+ consists of a single string:
576
+
577
+ | Field | Type | Description |
578
+ | ----- | ---- | ----------- |
579
+ | name_len | ` varuint32 ` | length of ` name_str ` in bytes |
580
+ | name_str | ` bytes ` | UTF-8 encoding of the name |
581
+
525
582
# Function Bodies
526
583
527
584
Function bodies consist of a sequence of local variable declarations followed by
0 commit comments