| ... | @@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 44 | js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len); | 44 | js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len); |
| 45 | } | 45 | } |
| 46 | | 46 | |
| 47 | pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | 47 | pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!void { |
| 48 | const max_table_rows = 500; | 48 | const max_table_rows = 500; |
| 49 | | 49 | |
| 50 | if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message"); | 50 | if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message"); |
| ... | @@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 166 | }); | 166 | }); |
| 167 | defer gpa.free(inner_html); | 167 | defer gpa.free(inner_html); |
| 168 | | 168 | |
| 169 | var file_table_html: std.ArrayListUnmanaged(u8) = .empty; | 169 | var file_table_html: std.Io.Writer.Allocating = .init(gpa); |
| 170 | defer file_table_html.deinit(gpa); | 170 | defer file_table_html.deinit(); |
| | 171 | |
| 171 | for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| { | 172 | for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| { |
| 172 | try file_table_html.writer(gpa).print( | 173 | try file_table_html.writer.print( |
| 173 | \\<tr> | 174 | \\<tr> |
| 174 | \\ <th scope="row"><code>{f}</code></th> | 175 | \\ <th scope="row"><code>{f}</code></th> |
| 175 | \\ <td>{D}</td> | 176 | \\ <td>{D}</td> |
| ... | @@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 187 | }); | 188 | }); |
| 188 | } | 189 | } |
| 189 | if (slowest_files.len > max_table_rows) { | 190 | if (slowest_files.len > max_table_rows) { |
| 190 | try file_table_html.writer(gpa).print( | 191 | try file_table_html.writer.print( |
| 191 | \\<tr><td colspan="4">{d} more rows omitted</td></tr> | 192 | \\<tr><td colspan="4">{d} more rows omitted</td></tr> |
| 192 | \\ | 193 | \\ |
| 193 | , .{slowest_files.len - max_table_rows}); | 194 | , .{slowest_files.len - max_table_rows}); |
| 194 | } | 195 | } |
| 195 | | 196 | |
| 196 | var decl_table_html: std.ArrayListUnmanaged(u8) = .empty; | 197 | var decl_table_html: std.Io.Writer.Allocating = .init(gpa); |
| 197 | defer decl_table_html.deinit(gpa); | 198 | defer decl_table_html.deinit(); |
| 198 | | 199 | |
| 199 | for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| { | 200 | for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| { |
| 200 | try decl_table_html.writer(gpa).print( | 201 | try decl_table_html.writer.print( |
| 201 | \\<tr> | 202 | \\<tr> |
| 202 | \\ <th scope="row"><code>{f}</code></th> | 203 | \\ <th scope="row"><code>{f}</code></th> |
| 203 | \\ <th scope="row"><code>{f}</code></th> | 204 | \\ <th scope="row"><code>{f}</code></th> |
| ... | @@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 219 | }); | 220 | }); |
| 220 | } | 221 | } |
| 221 | if (slowest_decls.len > max_table_rows) { | 222 | if (slowest_decls.len > max_table_rows) { |
| 222 | try decl_table_html.writer(gpa).print( | 223 | try decl_table_html.writer.print( |
| 223 | \\<tr><td colspan="6">{d} more rows omitted</td></tr> | 224 | \\<tr><td colspan="6">{d} more rows omitted</td></tr> |
| 224 | \\ | 225 | \\ |
| 225 | , .{slowest_decls.len - max_table_rows}); | 226 | , .{slowest_decls.len - max_table_rows}); |
| ... | @@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 229 | hdr.step_idx, | 230 | hdr.step_idx, |
| 230 | inner_html.ptr, | 231 | inner_html.ptr, |
| 231 | inner_html.len, | 232 | inner_html.len, |
| 232 | file_table_html.items.ptr, | 233 | file_table_html.written().ptr, |
| 233 | file_table_html.items.len, | 234 | file_table_html.written().len, |
| 234 | decl_table_html.items.ptr, | 235 | decl_table_html.written().ptr, |
| 235 | decl_table_html.items.len, | 236 | decl_table_html.written().len, |
| 236 | hdr.flags.use_llvm, | 237 | hdr.flags.use_llvm, |
| 237 | ); | 238 | ); |
| 238 | } | 239 | } |