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

« back to all changes in this revision

Viewing changes to erts/emulator/hipe/hipe_bif2.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
3
 * 
4
 
 * Copyright Ericsson AB 2001-2009. All Rights Reserved.
 
4
 * Copyright Ericsson AB 2001-2011. All Rights Reserved.
5
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_bif2.c
21
21
 *
22
22
 * Miscellaneous add-ons.
33
33
#include "big.h"
34
34
#include "hipe_debug.h"
35
35
#include "hipe_mode_switch.h"
36
 
#include "hipe_bif0.h" /* hipe_constants_{start,next} */
37
36
#include "hipe_arch.h"
38
37
#include "hipe_stack.h"
39
38
 
 
39
static void proc_unlock(Process* c_p, Process* rp)
 
40
{
 
41
    ErtsProcLocks locks = ERTS_PROC_LOCKS_ALL;
 
42
    if (rp == c_p) {
 
43
        locks &= ~ERTS_PROC_LOCK_MAIN;
 
44
    }
 
45
    if (rp && locks) {
 
46
        erts_smp_proc_unlock(rp, locks);
 
47
    }
 
48
}
 
49
 
40
50
BIF_RETTYPE hipe_bifs_show_estack_1(BIF_ALIST_1)
41
 
{
 
51
{    
42
52
    Process *rp = erts_pid2proc(BIF_P, ERTS_PROC_LOCK_MAIN,
43
53
                                BIF_ARG_1, ERTS_PROC_LOCKS_ALL);
44
54
    if (!rp)
45
55
        BIF_ERROR(BIF_P, BADARG);
46
56
    hipe_print_estack(rp);
47
 
    erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
 
57
    proc_unlock(BIF_P, rp);
48
58
    BIF_RET(am_true);
49
59
}
50
60
 
55
65
    if (!rp)
56
66
        BIF_ERROR(BIF_P, BADARG);
57
67
    hipe_print_heap(rp);
58
 
    erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
 
68
    proc_unlock(BIF_P, rp);
59
69
    BIF_RET(am_true);
60
70
}
61
71
 
66
76
    if (!rp)
67
77
        BIF_ERROR(BIF_P, BADARG);
68
78
    hipe_print_nstack(rp);
69
 
    erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
 
79
    proc_unlock(BIF_P, rp);
70
80
    BIF_RET(am_true);
71
81
}
72
82
 
82
92
    if (!rp)
83
93
        BIF_ERROR(BIF_P, BADARG);
84
94
    hipe_print_pcb(rp);
85
 
    erts_smp_proc_unlock(rp, ERTS_PROC_LOCKS_ALL);
 
95
    proc_unlock(BIF_P, rp);
86
96
    BIF_RET(am_true);
87
97
}
88
98
 
124
134
    BIF_RET(am_true);
125
135
}
126
136
 
127
 
BIF_RETTYPE hipe_bifs_show_literals_0(BIF_ALIST_0)
128
 
{
129
 
    Eterm *p;
130
 
 
131
 
    p = hipe_constants_start;
132
 
    for (; p < hipe_constants_next; ++p)
133
 
        printf("0x%0*lx: 0x%0*lx\r\n",
134
 
               2*(int)sizeof(long), (unsigned long)p,
135
 
               2*(int)sizeof(long), *p);
136
 
    BIF_RET(am_true);
137
 
}
138
 
 
139
137
BIF_RETTYPE hipe_bifs_in_native_0(BIF_ALIST_0)
140
138
{
141
139
    BIF_RET(am_false);
168
166
    BIF_RET(am_false);
169
167
#endif
170
168
}
 
169
 
 
170
#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP)
 
171
 
 
172
BIF_RETTYPE hipe_debug_bif_wrapper(BIF_ALIST_1);
 
173
 
 
174
#    define ERTS_SMP_REQ_PROC_MAIN_LOCK(P) \
 
175
        if ((P)) erts_proc_lc_require_lock((P), ERTS_PROC_LOCK_MAIN)
 
176
#    define ERTS_SMP_UNREQ_PROC_MAIN_LOCK(P) \
 
177
        if ((P)) erts_proc_lc_unrequire_lock((P), ERTS_PROC_LOCK_MAIN)
 
178
 
 
179
BIF_RETTYPE hipe_debug_bif_wrapper(BIF_ALIST_1)
 
180
{
 
181
    typedef BIF_RETTYPE Bif(BIF_ALIST_1);
 
182
    Bif* fp = (Bif*) (BIF_P->hipe.bif_callee);
 
183
    BIF_RETTYPE res;
 
184
    ERTS_SMP_UNREQ_PROC_MAIN_LOCK(BIF_P);
 
185
    res = (*fp)(BIF_P, BIF__ARGS);
 
186
    ERTS_SMP_REQ_PROC_MAIN_LOCK(BIF_P);
 
187
    return res;
 
188
}
 
189
 
 
190
#endif /* ERTS_ENABLE_LOCK_CHECK && ERTS_SMP */
 
191