~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/emulator/hipe/hipe_native_bif.c

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
 
 * 
4
 
 * Copyright Ericsson AB 2001-2009. All Rights Reserved.
5
 
 * 
 
3
 *
 
4
 * Copyright Ericsson AB 2001-2011. All Rights Reserved.
 
5
 *
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
8
8
 * compliance with the License. You should have received a copy of the
9
9
 * Erlang Public License along with this software. If not, it can be
10
10
 * retrieved online at http://www.erlang.org/.
11
 
 * 
 
11
 *
12
12
 * Software distributed under the License is distributed on an "AS IS"
13
13
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
 * the License for the specific language governing rights and limitations
15
15
 * under the License.
16
 
 * 
 
16
 *
17
17
 * %CopyrightEnd%
18
18
 */
19
 
/* $Id$
 
19
/*
20
20
 * hipe_native_bif.c
21
21
 */
22
22
#ifdef HAVE_CONFIG_H
41
41
 */
42
42
 
43
43
/* for -Wmissing-prototypes :-( */
44
 
extern Eterm hipe_check_process_code_2(Process*, Eterm, Eterm);
45
 
extern Eterm hipe_garbage_collect_1(Process*, Eterm);
46
 
extern Eterm hipe_show_nstack_1(Process*, Eterm);
 
44
extern Eterm hipe_check_process_code_2(BIF_ALIST_2);
 
45
extern Eterm hipe_garbage_collect_1(BIF_ALIST_1);
 
46
extern Eterm hipe_show_nstack_1(BIF_ALIST_1);
47
47
 
48
48
/* Used when a BIF can trigger a stack walk. */
49
49
static __inline__ void hipe_set_narity(Process *p, unsigned int arity)
56
56
    Eterm ret;
57
57
 
58
58
    hipe_set_narity(BIF_P, 2);
59
 
    ret = check_process_code_2(BIF_P, BIF_ARG_1, BIF_ARG_2);
 
59
    ret = check_process_code_2(BIF_P, BIF__ARGS);
60
60
    hipe_set_narity(BIF_P, 0);
61
61
    return ret;
62
62
}
66
66
    Eterm ret;
67
67
 
68
68
    hipe_set_narity(BIF_P, 1);
69
 
    ret = garbage_collect_1(BIF_P, BIF_ARG_1);
 
69
    ret = garbage_collect_1(BIF_P, BIF__ARGS);
70
70
    hipe_set_narity(BIF_P, 0);
71
71
    return ret;
72
72
}
76
76
    Eterm ret;
77
77
 
78
78
    hipe_set_narity(BIF_P, 1);
79
 
    ret = hipe_bifs_show_nstack_1(BIF_P, BIF_ARG_1);
 
79
    ret = hipe_bifs_show_nstack_1(BIF_P, BIF__ARGS);
80
80
    hipe_set_narity(BIF_P, 0);
81
81
    return ret;
82
82
}
99
99
 *  has begun.
100
100
 * XXX: BUG: native code should check return status
101
101
 */
102
 
Eterm hipe_set_timeout(Process *p, Eterm timeout_value)
 
102
BIF_RETTYPE hipe_set_timeout(BIF_ALIST_1)
103
103
{
 
104
    Process* p = BIF_P;
 
105
    Eterm timeout_value = BIF_ARG_1;
104
106
#if !defined(ARCH_64)
105
107
    Uint time_val;
106
108
#endif
187
189
{
188
190
#if !defined(NO_FPE_SIGNALS)
189
191
    erts_fp_check_init_error(&p->fp_exception);
 
192
#else
 
193
    erl_exit(ERTS_ABORT_EXIT, "Emulated FPE not cleared by HiPE");
190
194
#endif
191
195
}
192
196
 
286
290
 * This does what the (misnamed) Beam instruction 'raise_ss' does,
287
291
 * namely, a proper re-throw of an exception that was caught by 'try'.
288
292
 */
289
 
Eterm hipe_rethrow(Process *c_p, Eterm exc, Eterm value)
 
293
 
 
294
BIF_RETTYPE hipe_rethrow(BIF_ALIST_2)
290
295
{
 
296
    Process* c_p = BIF_P;
 
297
    Eterm exc = BIF_ARG_1;
 
298
    Eterm value = BIF_ARG_2;
 
299
 
291
300
    c_p->fvalue = value;
292
301
    if (c_p->freason == EXC_NULL) {
293
302
        /* a safety check for the R10-0 case; should not happen */
334
343
    bptr = erts_bin_nrml_alloc(len);
335
344
    bptr->flags = 0;
336
345
    bptr->orig_size = len;
337
 
    erts_smp_atomic_init(&bptr->refc, 1);
 
346
    erts_smp_atomic_init_nob(&bptr->refc, 1);
338
347
    return bptr->orig_bytes;
339
348
}
340
349
 
411
420
        return make_small(4);
412
421
}
413
422
 
414
 
Eterm hipe_bs_put_utf8(Process *p, Eterm arg, byte *base, unsigned int offset)
 
423
BIF_RETTYPE hipe_bs_put_utf8(BIF_ALIST_3)
415
424
{
 
425
    Process* p = BIF_P;
 
426
    Eterm arg = BIF_ARG_1;
 
427
    byte* base = (byte*) BIF_ARG_2;
 
428
    Uint offset = (Uint) BIF_ARG_3;
416
429
    byte *save_bin_buf;
417
430
    Uint save_bin_offset;
418
431
    int res;
468
481
    return new_offset;
469
482
}
470
483
 
471
 
Eterm hipe_bs_put_utf16be(Process *p, Eterm arg, byte *base, unsigned int offset)
 
484
BIF_RETTYPE hipe_bs_put_utf16be(BIF_ALIST_3)
472
485
{
 
486
    Process *p = BIF_P;
 
487
    Eterm arg = BIF_ARG_1;
 
488
    byte *base = (byte*) BIF_ARG_2; 
 
489
    Uint offset = (Uint) BIF_ARG_3;
473
490
    return hipe_bs_put_utf16(p, arg, base, offset, 0);
474
491
}
475
492
 
476
 
Eterm hipe_bs_put_utf16le(Process *p, Eterm arg, byte *base, unsigned int offset)
 
493
BIF_RETTYPE hipe_bs_put_utf16le(BIF_ALIST_3)
477
494
{
 
495
    Process *p = BIF_P;
 
496
    Eterm arg = BIF_ARG_1;
 
497
    byte *base = (byte*) BIF_ARG_2; 
 
498
    Uint offset = (Uint) BIF_ARG_3;
478
499
    return hipe_bs_put_utf16(p, arg, base, offset, BSF_LITTLE);
479
500
}
480
501
 
489
510
    return 1;
490
511
}
491
512
 
492
 
Eterm hipe_bs_validate_unicode(Process *p, Eterm arg)
 
513
BIF_RETTYPE hipe_bs_validate_unicode(BIF_ALIST_1)
493
514
{
 
515
    Process *p = BIF_P;
 
516
    Eterm arg = BIF_ARG_1;
494
517
    if (!validate_unicode(arg))
495
518
        BIF_ERROR(p, BADARG);
496
519
    return NIL;
584
607
 
585
608
void hipe_atomic_inc(int *counter)
586
609
{
587
 
    erts_smp_atomic_inc((erts_smp_atomic_t*)counter);
 
610
    erts_smp_atomic_inc_nob((erts_smp_atomic_t*)counter);
588
611
}
589
612
 
590
613
#endif