~cypheon/rapid

917e58510c8e0a7740adf7d24106e92dabff931a — Johann Rudloff 4 months ago 7c8bf51 cps
Finish task regularly by calling longjmp() instead of exit()
1 files changed, 12 insertions(+), 1 deletions(-)

M support/rapid/support.ll
M support/rapid/support.ll => support/rapid/support.ll +12 -1
@@ 25,6 25,13 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1"
  , ptr ; stack_top
  , ptr ; stack_size
  , i64 ; heap_alloc
  , i64 ; next_nursery_size
  , i64 ; used_nursery_size
  , ptr ; nurseryHead
  , ptr ; nurseryCur
  , ptr ; nurseryScavenge
  , {i64, i64, i64, i64, i64, i64} ; gc_stats
  , ptr ; jmp_buf
}

%TSOPtr = type ptr


@@ 48,6 55,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-ni:1"
%ClosureFunc2 = type ptr

;START MOCKMOCKMOCK
declare ccc void @longjmp(ptr, i64) noreturn
declare ccc void @exit(i64) noreturn
declare ccc i64 @write(i64, ptr, i64)
@helloStr = private unnamed_addr addrspace(0) constant {i64, [13 x i8]} {i64 13, [13 x i8] c"Hello world!\0a"}


@@ 187,7 195,10 @@ define tailcc void @rapid.moreheap.clos(%TSOPtr %Base, i64 %Alloc, %ObjPtr %clos
}

define tailcc void @__halt(i64 %Heap, %TSOPtr %Base, %ObjPtr %k, %ObjPtr %result) {
  call ccc void @exit(i64 3) noreturn
  %JmpBufAddr = getelementptr inbounds %Idris_TSO.struct, ptr %Base, i32 0, i32 14 ; jmp_buf

  call ccc void @longjmp(ptr %JmpBufAddr, i64 3) noreturn

  unreachable
}
@__halt$$closureNoArgs = private unnamed_addr constant {i64, ptr} {i64 1, ptr @__halt}