|
| 1 | +// RUN: veir-interpret %s | filecheck %s |
| 2 | + |
| 3 | +// A 4-byte message received into a 2-byte window reports |
| 4 | +// `Io.Error.messageTooLong` (-3), leaves the buffer untouched, and stays in |
| 5 | +// flight, so a retry with the full length succeeds with 4 bytes. |
| 6 | + |
| 7 | +"builtin.module"() ({ |
| 8 | + "func.func"() <{sym_name = "main", function_type = () -> (i64, i32, i64, i32)}> ({ |
| 9 | + %self = "io.self"() : () -> !io.address |
| 10 | + %len = "llvm.mlir.constant"() <{value = 4 : i64}> : () -> i64 |
| 11 | + %short = "llvm.mlir.constant"() <{value = 2 : i64}> : () -> i64 |
| 12 | + %buf = "llvm.alloca"(%len) <{elem_type = i8}> : (i64) -> !llvm.ptr |
| 13 | + %abcd = "llvm.mlir.constant"() <{value = 1684234849 : i32}> : () -> i32 |
| 14 | + "llvm.store"(%abcd, %buf) : (i32, !llvm.ptr) -> () |
| 15 | + %sent = "io.send"(%self, %buf, %len) : (!io.address, !llvm.ptr, i64) -> i64 |
| 16 | + %zero = "llvm.mlir.constant"() <{value = 0 : i32}> : () -> i32 |
| 17 | + "llvm.store"(%zero, %buf) : (i32, !llvm.ptr) -> () |
| 18 | + %n1, %from1 = "io.recv"(%buf, %short) : (!llvm.ptr, i64) -> (i64, !io.address) |
| 19 | + %w1 = "llvm.load"(%buf) : (!llvm.ptr) -> i32 |
| 20 | + %n2, %from2 = "io.recv"(%buf, %len) : (!llvm.ptr, i64) -> (i64, !io.address) |
| 21 | + %w2 = "llvm.load"(%buf) : (!llvm.ptr) -> i32 |
| 22 | + "func.return"(%n1, %w1, %n2, %w2) : (i64, i32, i64, i32) -> () |
| 23 | + }) : () -> () |
| 24 | +}) : () -> () |
| 25 | + |
| 26 | +// CHECK: Program output: #[0xfffffffffffffffd#64, 0x00000000#32, 0x0000000000000004#64, 0x64636261#32] |
0 commit comments