summary refs log tree commit diff stats
path: root/tests/vm/tmanyregs.nim
blob: 711c69285d122850e5dad5ce555c71300146f219 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import macros

# Generate a proc with more then 255 registers. Should not generate an error at
# compile time

static:
  macro mkFoo() =
    let ss = newStmtList()
    for i in 1..256:
      ss.add parseStmt "var x" & $i & " = " & $i
      ss.add parseStmt "inc x" & $i
    quote do:
      proc foo() =
        `ss`
  mkFoo()
  foo()
> CLONE_PARENT_SETTID* = 0x00100000 CLONE_CHILD_CLEARTID* = 0x00200000 CLONE_DETACHED* = 0x00400000 CLONE_UNTRACED* = 0x00800000 CLONE_CHILD_SETTID* = 0x01000000 CLONE_STOPPED* = 0x02000000 # fn should be of type proc (a2: pointer): void {.cdecl.} proc clone*(fn: pointer; child_stack: pointer; flags: cint; arg: pointer; ptid: ptr Pid; tls: pointer; ctid: ptr Pid): cint {.importc, header: "<sched.h>".}