Skip to content

Commit e4ff2f2

Browse files
Swap tag order (#6)
1 parent 07f6602 commit e4ff2f2

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/fix-driver/compile.wat

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
(call $attach_tree_ro_table_0 (table.get $ro_table_0 (i32.const 2)))
9494

9595
;; check if the tag was authored by us
96-
(call $equality (local.get $compile) (table.get $ro_table_0 (i32.const 1)))
96+
(call $equality (local.get $compile) (table.get $ro_table_0 (i32.const 0)))
9797

9898
(if (result externref)
9999
(then
@@ -102,7 +102,7 @@
102102

103103
;; zoom into the boot toolchain tree
104104
;; this contains: [wasm2c, cc, ld, system_deps, clang_deps, map]
105-
(call $attach_tree_ro_table_0 (table.get $ro_table_0 (i32.const 0)))
105+
(call $attach_tree_ro_table_0 (table.get $ro_table_0 (i32.const 1)))
106106
(local.set $wasm2c (table.get $ro_table_0 (i32.const 0)))
107107
(local.set $cc (table.get $ro_table_0 (i32.const 1)))
108108
(local.set $ld (table.get $ro_table_0 (i32.const 2)))
@@ -263,7 +263,7 @@
263263
;; Attach the Tag
264264
(call $attach_tree_ro_table_0 (local.get $input))
265265
;; check if the tag was authored by us
266-
(call $equality (local.get $compile) (table.get $ro_table_0 (i32.const 1)))
266+
(call $equality (local.get $compile) (table.get $ro_table_0 (i32.const 0)))
267267
(if
268268
(then
269269
;; Created by compile
@@ -276,7 +276,7 @@
276276

277277
;; The tag we created contains a tag created by some step in the process;
278278
;; we need to ensure that's an "Okay" tag.
279-
(local.set $result (table.get $ro_table_0 (i32.const 0)))
279+
(local.set $result (table.get $ro_table_0 (i32.const 1)))
280280
(call $attach_tree_ro_table_0 (local.get $result))
281281
(call $equality
282282
(call $create_blob_rw_mem_4 (i32.const 4))
@@ -287,9 +287,9 @@
287287
)
288288
(else
289289
;; Not valid, tag the object as Error
290-
(call $error_not_runnable (table.get $ro_table_0 (i32.const 0)))
290+
(call $error_not_runnable (table.get $ro_table_0 (i32.const 1)))
291291
(return)))
292292
;; Valid, tag the object as Runnable
293-
(call $tag_runnable (table.get $ro_table_0 (i32.const 0)))
293+
(call $tag_runnable (table.get $ro_table_0 (i32.const 1)))
294294
)
295295
)

src/fix-driver/link-elfs-driver.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ externref fixpoint_apply( externref encode )
5959
return get_ro_table_0( 2 );
6060
}
6161

62-
// Look at the Object
63-
attach_tree_ro_table_1( get_ro_table_1( 0 ) );
62+
// Look at the Object in the tag
63+
attach_tree_ro_table_1( get_ro_table_1( 1 ) );
6464
std::vector<char*> dep_files;
6565
std::vector<size_t> dep_file_sizes;
6666

@@ -72,8 +72,8 @@ externref fixpoint_apply( externref encode )
7272
// not okay, return the error message
7373
return tag;
7474
}
75-
// unwrap the result
76-
attach_blob_ro_mem_0(get_ro_table_0(0));
75+
// unwrap the result tag
76+
attach_blob_ro_mem_0(get_ro_table_0(1));
7777
char* buffer = (char*)malloc( size_ro_mem_0() + 1 );
7878
ro_0_to_program_memory( buffer, 0, size_ro_mem_0() );
7979
buffer[size_ro_mem_0()] = '\0';

src/fix-driver/map.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
;; Error
3838
(return (table.get $ro_table_0 (i32.const 3)))
3939
))
40-
(call $attach_tree_ro_table_1 (table.get $ro_table_1 (i32.const 0)))
40+
(call $attach_tree_ro_table_1 (table.get $ro_table_1 (i32.const 1)))
4141

4242
(local.set $x (table.get $ro_table_1 (i32.const 0)))
4343

src/serialize/serialize.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ int main( int argc, char* argv[] )
8888
vector<Handle> runnable_tags;
8989
for ( size_t i = 0; i < 4; i++ ) {
9090
vector<Handle> runnable_tag;
91-
runnable_tag.push_back( elf_names[i] );
9291
runnable_tag.push_back( elf_names[4] );
92+
runnable_tag.push_back( elf_names[i] );
9393
runnable_tag.push_back( Handle( "Runnable" ) );
9494
runnable_tags.push_back( serialize_tag( objects, runnable_tag ) );
9595
}
@@ -112,8 +112,8 @@ int main( int argc, char* argv[] )
112112

113113
// Tag compile_tool_tree bootstrap
114114
vector<Handle> compile_tool_tree_tag;
115-
compile_tool_tree_tag.push_back( compile_tool_tree_name );
116115
compile_tool_tree_tag.push_back( elf_names[4] );
116+
compile_tool_tree_tag.push_back( compile_tool_tree_name );
117117
compile_tool_tree_tag.push_back( Handle( "Bootstrap" ) );
118118
Handle compile_tool_tree_tag_name = serialize_tag( objects, compile_tool_tree_tag );
119119

@@ -122,7 +122,7 @@ int main( int argc, char* argv[] )
122122
compile_encode.push_back( Handle( "compile" ) );
123123
compile_encode.push_back( runnable_compile_name );
124124
compile_encode.push_back( compile_tool_tree_tag_name );
125-
Handle compile_encode_name = serialize_tag( objects, compile_encode );
125+
Handle compile_encode_name = serialize_tree( objects, compile_encode );
126126

127127
std::ofstream compile_tool_out( refs / "compile-encode" );
128128
compile_tool_out << base16::encode( compile_encode_name );

0 commit comments

Comments
 (0)