~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
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:
19
19
 * standard_bif_interface_3(nbif_name, cbif_name)
20
20
 *
21
21
 * Generate native interface for a BIF with 1-3 parameters and
22
 
 * standard failure mode (may fail, but not with RESCHEDULE).
 
22
 * standard failure mode.
23
23
 */
24
24
define(standard_bif_interface_1,
25
25
`
138
138
#endif')
139
139
 
140
140
/*
141
 
 * expensive_bif_interface_1(nbif_name, cbif_name)
142
 
 * expensive_bif_interface_2(nbif_name, cbif_name)
143
 
 * expensive_bif_interface_3(nbif_name, cbif_name)
144
 
 *
145
 
 * Generate native interface for a BIF with 1-3 parameters and
146
 
 * an expensive failure mode (may fail with RESCHEDULE).
147
 
 */
148
 
define(expensive_bif_interface_1,
149
 
`
150
 
#ifndef HAVE_$1
151
 
#`define' HAVE_$1
152
 
        GLOBAL(ASYM($1))
153
 
ASYM($1):
154
 
        /* Set up C argument registers. */
155
 
        mr      r3, P
156
 
        NBIF_ARG(r4,1,0)
157
 
 
158
 
        /* Save actual parameters in case we must reschedule. */
159
 
        NBIF_SAVE_RESCHED_ARGS(1)
160
 
 
161
 
        /* Save caller-save registers and call the C function. */
162
 
        SAVE_CONTEXT_BIF
163
 
        bl      CSYM($2)
164
 
        TEST_GOT_MBUF
165
 
 
166
 
        /* Restore registers. Check for exception. */
167
 
        CMPI    r3, THE_NON_VALUE
168
 
        RESTORE_CONTEXT_BIF
169
 
        beq-    1f
170
 
        NBIF_RET(1)
171
 
1:
172
 
        /* XXX: may need to change for PPC64 */
173
 
        addi    r5, 0, lo16(ASYM($1))
174
 
        addis   r5, r5, ha16(ASYM($1))
175
 
        b       CSYM(nbif_1_hairy_exception)
176
 
        HANDLE_GOT_MBUF(1)
177
 
        SET_SIZE(ASYM($1))
178
 
        TYPE_FUNCTION(ASYM($1))
179
 
#endif')
180
 
 
181
 
define(expensive_bif_interface_2,
182
 
`
183
 
#ifndef HAVE_$1
184
 
#`define' HAVE_$1
185
 
        GLOBAL(ASYM($1))
186
 
ASYM($1):
187
 
        /* Set up C argument registers. */
188
 
        mr      r3, P
189
 
        NBIF_ARG(r4,2,0)
190
 
        NBIF_ARG(r5,2,1)
191
 
 
192
 
        /* Save actual parameters in case we must reschedule. */
193
 
        NBIF_SAVE_RESCHED_ARGS(2)
194
 
 
195
 
        /* Save caller-save registers and call the C function. */
196
 
        SAVE_CONTEXT_BIF
197
 
        bl      CSYM($2)
198
 
        TEST_GOT_MBUF
199
 
 
200
 
        /* Restore registers. Check for exception. */
201
 
        CMPI    r3, THE_NON_VALUE
202
 
        RESTORE_CONTEXT_BIF
203
 
        beq-    1f
204
 
        NBIF_RET(2)
205
 
1:
206
 
        /* XXX: may need to change for PPC64 */
207
 
        addi    r5, 0, lo16(ASYM($1))
208
 
        addis   r5, r5, ha16(ASYM($1))
209
 
        b       CSYM(nbif_2_hairy_exception)
210
 
        HANDLE_GOT_MBUF(2)
211
 
        SET_SIZE(ASYM($1))
212
 
        TYPE_FUNCTION(ASYM($1))
213
 
#endif')
214
 
 
215
 
define(expensive_bif_interface_3,
216
 
`
217
 
#ifndef HAVE_$1
218
 
#`define' HAVE_$1
219
 
        GLOBAL(ASYM($1))
220
 
ASYM($1):
221
 
        /* Set up C argument registers. */
222
 
        mr      r3, P
223
 
        NBIF_ARG(r4,3,0)
224
 
        NBIF_ARG(r5,3,1)
225
 
        NBIF_ARG(r6,3,2)
226
 
 
227
 
        /* Save actual parameters in case we must reschedule. */
228
 
        NBIF_SAVE_RESCHED_ARGS(3)
229
 
 
230
 
        /* Save caller-save registers and call the C function. */
231
 
        SAVE_CONTEXT_BIF
232
 
        bl      CSYM($2)
233
 
        TEST_GOT_MBUF
234
 
 
235
 
        /* Restore registers. Check for exception. */
236
 
        CMPI    r3, THE_NON_VALUE
237
 
        RESTORE_CONTEXT_BIF
238
 
        beq-    1f
239
 
        NBIF_RET(3)
240
 
1:
241
 
        /* XXX: may need to change for PPC64 */
242
 
        addi    r5, 0, lo16(ASYM($1))
243
 
        addis   r5, r5, ha16(ASYM($1))
244
 
        b       CSYM(nbif_3_hairy_exception)
245
 
        HANDLE_GOT_MBUF(3)
246
 
        SET_SIZE(ASYM($1))
247
 
        TYPE_FUNCTION(ASYM($1))
248
 
#endif')
249
 
 
250
 
/*
251
141
 * gc_bif_interface_0(nbif_name, cbif_name)
252
142
 * gc_bif_interface_1(nbif_name, cbif_name)
253
143
 * gc_bif_interface_2(nbif_name, cbif_name)
254
144
 *
255
145
 * Generate native interface for a BIF with 0-2 parameters and
256
 
 * standard failure mode (may fail, but not with RESCHEDULE).
 
146
 * standard failure mode.
257
147
 * The BIF may do a GC.
258
148
 */
259
149
define(gc_bif_interface_0,
334
224
#endif')
335
225
 
336
226
/*
337
 
 * expensive_gc_bif_interface_1(nbif_name, cbif_name)
338
 
 * expensive_gc_bif_interface_2(nbif_name, cbif_name)
339
 
 *
340
 
 * Generate native interface for a BIF with 1-2 parameters and
341
 
 * an expensive failure mode (may fail with RESCHEDULE).
342
 
 * The BIF may do a GC.
343
 
 */
344
 
define(expensive_gc_bif_interface_1,
345
 
`
346
 
#ifndef HAVE_$1
347
 
#`define' HAVE_$1
348
 
        GLOBAL(ASYM($1))
349
 
ASYM($1):
350
 
        /* Set up C argument registers. */
351
 
        mr      r3, P
352
 
        NBIF_ARG(r4,1,0)
353
 
 
354
 
        /* Save actual parameters in case we must reschedule. */
355
 
        NBIF_SAVE_RESCHED_ARGS(1)
356
 
 
357
 
        /* Save caller-save registers and call the C function. */
358
 
        SAVE_CONTEXT_GC
359
 
        bl      CSYM($2)
360
 
        TEST_GOT_MBUF
361
 
 
362
 
        /* Restore registers. Check for exception. */
363
 
        CMPI    r3, THE_NON_VALUE
364
 
        RESTORE_CONTEXT_GC
365
 
        beq-    1f
366
 
        NBIF_RET(1)
367
 
1:
368
 
        /* XXX: may need to change for PPC64 */
369
 
        addi    r5, 0, lo16(ASYM($1))
370
 
        addis   r5, r5, ha16(ASYM($1))
371
 
        b       CSYM(nbif_1_hairy_exception)
372
 
        HANDLE_GOT_MBUF(1)
373
 
        SET_SIZE(ASYM($1))
374
 
        TYPE_FUNCTION(ASYM($1))
375
 
#endif')
376
 
 
377
 
define(expensive_gc_bif_interface_2,
378
 
`
379
 
#ifndef HAVE_$1
380
 
#`define' HAVE_$1
381
 
        GLOBAL(ASYM($1))
382
 
ASYM($1):
383
 
        /* Set up C argument registers. */
384
 
        mr      r3, P
385
 
        NBIF_ARG(r4,2,0)
386
 
        NBIF_ARG(r5,2,1)
387
 
 
388
 
        /* Save actual parameters in case we must reschedule. */
389
 
        NBIF_SAVE_RESCHED_ARGS(2)
390
 
 
391
 
        /* Save caller-save registers and call the C function. */
392
 
        SAVE_CONTEXT_GC
393
 
        bl      CSYM($2)
394
 
        TEST_GOT_MBUF
395
 
 
396
 
        /* Restore registers. Check for exception. */
397
 
        CMPI    r3, THE_NON_VALUE
398
 
        RESTORE_CONTEXT_GC
399
 
        beq-    1f
400
 
        NBIF_RET(2)
401
 
1:
402
 
        /* XXX: may need to change for PPC64 */
403
 
        addi    r5, 0, lo16(ASYM($1))
404
 
        addis   r5, r5, ha16(ASYM($1))
405
 
        b       CSYM(nbif_2_hairy_exception)
406
 
        HANDLE_GOT_MBUF(2)
407
 
        SET_SIZE(ASYM($1))
408
 
        TYPE_FUNCTION(ASYM($1))
409
 
#endif')
410
 
 
411
 
/*
412
227
 * gc_nofail_primop_interface_1(nbif_name, cbif_name)
413
228
 *
414
229
 * Generate native interface for a primop with implicit P