added shared library support to AMD64 and i386
[voodoo-lang.git] / test / restore-frame.voo
blobd81e76af4ff4076727b0f77363b029c3a21fffb5
1 # Test for save-frame and restore-frame.
3 section data
5 address: word 0
7 format_20:
8 string "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n\x00"
11 section functions
12 import exit printf
13 export main
15 align
16 test:
17 function
18     let a 1
19     let b 2
20     let c 3
21     let d 4
22     let e 5
23     let f 6
24     let g 7
25     let h 8
26     let i 9
27     let j 10
28     let k 11
29     let l 12
30     let m 13
31     let n 14
32     let o 15
33     let p 16
34     let q 17
35     let r 18
36     let s 19
37     let t 20
39     set a call saves_frame o p q r s t
40     call printf format_20 a b c d e f g h i j \
41         k l m n o p q r s t
43     return
44 end function
47 align
48 saves_frame:
49 function u v w x y z
50     let a u
51     let b 90
52     let c v
53     let d 91
54     let e w
55     let f 92
56     let g x
57     let h 93
58     let i y
59     let j 94
60     let k z
61     let saved-frame auto-bytes %saved-frame-size
62     save-frame saved-frame
64     set @address ret_1
65     call passthrough saved-frame
66     return 0
68 ret_1:
69     return 1
70 end function
72 align
73 nonlocal_jump:
74 function frame
75     let a 71
76     let b 72
77     let c 73
78     let d 74
79     let e 75
80     let f 76
81     let g 77
82     let h 78
83     let i 79
84     let j 80
85     let k 81
86     let l 82
87     let m 83
88     let n 84
89     let o 85
90     let p 86
91     let q 87
92     let r 88
93     let s 89
94     let t 90
95     restore-frame frame
96     goto @address
97     call exit 2
98 end function
100 align
101 passthrough:
102 function frame
103     let a 41
104     let b 42
105     let c 43
106     let d 44
107     let e 45
108     let f 46
109     let g 47
110     let h 48
111     let i 49
112     call nonlocal_jump frame
113     call exit 1
114 end function
117 align
118 main:
119 function argc argv
120     call test
121     return 0
122 end function