~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/emulator/hipe/hipe_amd64_bifs.m4

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090215164252-dxpjjuq108nz4noa
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * standard_bif_interface_3(nbif_name, cbif_name)
23
23
 *
24
24
 * Generate native interface for a BIF with 1-3 parameters and
25
 
 * standard failure mode (may fail, but not with RESCHEDULE).
 
25
 * standard failure mode.
26
26
 */
27
27
define(standard_bif_interface_1,
28
28
`
141
141
#endif')
142
142
 
143
143
/*
144
 
 * expensive_bif_interface_1(nbif_name, cbif_name)
145
 
 * expensive_bif_interface_2(nbif_name, cbif_name)
146
 
 * expensive_bif_interface_3(nbif_name, cbif_name)
147
 
 *
148
 
 * Generate native interface for a BIF with 1-3 parameters and
149
 
 * an expensive failure mode (may fail with RESCHEDULE).
150
 
 */
151
 
define(expensive_bif_interface_1,
152
 
`
153
 
#ifndef HAVE_$1
154
 
#`define' HAVE_$1
155
 
        .section ".text"
156
 
        .align  4
157
 
        .global $1
158
 
$1:
159
 
        /* set up the parameters */
160
 
        movq    P, %rdi
161
 
        NBIF_ARG(%rsi,1,0)
162
 
 
163
 
        /* save actual parameters in case we must reschedule */
164
 
        NBIF_SAVE_RESCHED_ARGS(1)
165
 
 
166
 
        /* make the call on the C stack */
167
 
        SWITCH_ERLANG_TO_C
168
 
        call    $2
169
 
        TEST_GOT_MBUF
170
 
        SWITCH_C_TO_ERLANG
171
 
 
172
 
        /* throw exception if failure, otherwise return */
173
 
        TEST_GOT_EXN
174
 
        jz      1f
175
 
        NBIF_RET(1)
176
 
1:
177
 
        movq    `$'$1, %rdx     /* resumption address */
178
 
        jmp     nbif_1_hairy_exception
179
 
        HANDLE_GOT_MBUF(1)
180
 
        .size   $1,.-$1
181
 
        .type   $1,@function
182
 
#endif')
183
 
 
184
 
define(expensive_bif_interface_2,
185
 
`
186
 
#ifndef HAVE_$1
187
 
#`define' HAVE_$1
188
 
        .section ".text"
189
 
        .align  4
190
 
        .global $1
191
 
$1:
192
 
        /* set up the parameters */
193
 
        movq    P, %rdi
194
 
        NBIF_ARG(%rsi,2,0)
195
 
        NBIF_ARG(%rdx,2,1)
196
 
 
197
 
        /* save actual parameters in case we must reschedule */
198
 
        NBIF_SAVE_RESCHED_ARGS(2)
199
 
 
200
 
        /* make the call on the C stack */
201
 
        SWITCH_ERLANG_TO_C
202
 
        call    $2
203
 
        TEST_GOT_MBUF
204
 
        SWITCH_C_TO_ERLANG
205
 
 
206
 
        /* throw exception if failure, otherwise return */
207
 
        TEST_GOT_EXN
208
 
        jz      1f
209
 
        NBIF_RET(2)
210
 
1:
211
 
        movq    `$'$1, %rdx     /* resumption address */
212
 
        jmp     nbif_2_hairy_exception
213
 
        HANDLE_GOT_MBUF(2)
214
 
        .size   $1,.-$1
215
 
        .type   $1,@function
216
 
#endif')
217
 
 
218
 
define(expensive_bif_interface_3,
219
 
`
220
 
#ifndef HAVE_$1
221
 
#`define' HAVE_$1
222
 
        .section ".text"
223
 
        .align  4
224
 
        .global $1
225
 
$1:
226
 
        /* set up the parameters */
227
 
        movq    P, %rdi
228
 
        NBIF_ARG(%rsi,3,0)
229
 
        NBIF_ARG(%rdx,3,1)
230
 
        NBIF_ARG(%rcx,3,2)
231
 
 
232
 
        /* save actual parameters in case we must reschedule */
233
 
        NBIF_SAVE_RESCHED_ARGS(3)
234
 
 
235
 
        /* make the call on the C stack */
236
 
        SWITCH_ERLANG_TO_C
237
 
        call    $2
238
 
        TEST_GOT_MBUF
239
 
        SWITCH_C_TO_ERLANG
240
 
 
241
 
        /* throw exception if failure, otherwise return */
242
 
        TEST_GOT_EXN
243
 
        jz      1f
244
 
        NBIF_RET(3)
245
 
1:
246
 
        movq    `$'$1, %rdx     /* resumption address */
247
 
        jmp     nbif_3_hairy_exception
248
 
        HANDLE_GOT_MBUF(3)
249
 
        .size   $1,.-$1
250
 
        .type   $1,@function
251
 
#endif')
252
 
 
253
 
/*
254
144
 * nofail_primop_interface_0(nbif_name, cbif_name)
255
145
 * nofail_primop_interface_1(nbif_name, cbif_name)
256
146
 * nofail_primop_interface_2(nbif_name, cbif_name)
636
526
define(gc_bif_interface_2,`standard_bif_interface_2($1, $2)')
637
527
 
638
528
/*
639
 
 * Implement expensive_gc_bif_interface_N as expensive_bif_interface_N (N=1,2).
640
 
 */
641
 
define(expensive_gc_bif_interface_1,`expensive_bif_interface_1($1, $2)')
642
 
define(expensive_gc_bif_interface_2,`expensive_bif_interface_2($1, $2)')
643
 
 
644
 
/*
645
529
 * Implement gc_nofail_primop_interface_1 as nofail_primop_interface_1.
646
530
 */
647
531
define(gc_nofail_primop_interface_1,`nofail_primop_interface_1($1, $2)')