Merge branch 'master' of gitosis@yap.dcc.fc.up.pt:yap-6
This commit is contained in:
commit
ce76be4e77
10
C/amasm.c
10
C/amasm.c
@ -280,7 +280,7 @@ STATIC_PROTO(yamop *a_bmap, (yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(void a_fetch_vv, (cmp_op_info *, int, struct intermediates *));
|
||||
STATIC_PROTO(void a_fetch_cv, (cmp_op_info *, int, struct intermediates *));
|
||||
STATIC_PROTO(void a_fetch_vc, (cmp_op_info *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_f2, (int, cmp_op_info *, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_f2, (cmp_op_info *, yamop *, int, struct intermediates *));
|
||||
|
||||
#define CELLSIZE sizeof(CELL)
|
||||
|
||||
@ -2471,7 +2471,7 @@ a_fetch_cv(cmp_op_info *cmp_info, int pass_no, struct intermediates *cip)
|
||||
}
|
||||
|
||||
static yamop *
|
||||
a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
Int opc = cip->cpc->rnd2;
|
||||
Ventry *ve = (Ventry *)(cip->cpc->rnd1);
|
||||
@ -3656,13 +3656,13 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
a_fetch_cv(&cmp_info, pass_no, cip);
|
||||
break;
|
||||
case f_val_op:
|
||||
code_p = a_f2(FALSE, &cmp_info, code_p, pass_no, cip);
|
||||
code_p = a_f2(&cmp_info, code_p, pass_no, cip);
|
||||
break;
|
||||
case f_var_op:
|
||||
code_p = a_f2(TRUE, &cmp_info, code_p, pass_no, cip);
|
||||
code_p = a_f2(&cmp_info, code_p, pass_no, cip);
|
||||
break;
|
||||
case f_0_op:
|
||||
code_p = a_f2(TRUE, &cmp_info, code_p, pass_no, cip);
|
||||
code_p = a_f2(&cmp_info, code_p, pass_no, cip);
|
||||
break;
|
||||
case enter_profiling_op:
|
||||
{
|
||||
|
@ -905,7 +905,7 @@ static void
|
||||
c_test(Int Op, Term t1, compiler_struct *cglobs) {
|
||||
Term t = Deref(t1);
|
||||
|
||||
if (!IsVarTerm(t)) {
|
||||
if (!IsVarTerm(t) || IsNewVar(t)) {
|
||||
Term tn = MkVarTerm();
|
||||
c_eq(t, tn, cglobs);
|
||||
t = tn;
|
||||
|
@ -2831,6 +2831,7 @@ open_buf_write_stream(char *nbuf, UInt sz)
|
||||
st->u.mem_string.pos = 0;
|
||||
st->u.mem_string.buf = nbuf;
|
||||
st->u.mem_string.max_size = sz;
|
||||
st->u.mem_string.src = MEM_BUF_CODE;
|
||||
return sno;
|
||||
}
|
||||
|
||||
|
@ -13,16 +13,41 @@
|
||||
** Atomic lock for X86 **
|
||||
** ----------------------------- */
|
||||
|
||||
#define swap(reg,adr) \
|
||||
({ \
|
||||
char _ret; \
|
||||
asm volatile ("xchgb %0,%1" \
|
||||
: "=q" (_ret), "=m" (*(adr)) /* Output %0,%1 */ \
|
||||
: "m" (*(adr)), "0" (reg)); /* Input (%2),%0 */ \
|
||||
_ret; \
|
||||
})
|
||||
typedef struct {
|
||||
volatile unsigned int lock;
|
||||
} spinlock_t;
|
||||
|
||||
#define TRY_LOCK(LOCK_VAR) (swap(1,(LOCK_VAR))==0)
|
||||
static inline int
|
||||
spin_trylock(spinlock_t *lock)
|
||||
{
|
||||
char tmp = 1;
|
||||
__asm__ __volatile__(
|
||||
"xchgb %b0, %1"
|
||||
: "=q"(tmp), "=m"(lock->lock)
|
||||
: "0"(tmp) : "memory");
|
||||
return tmp == 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spin_unlock(spinlock_t *lock)
|
||||
{
|
||||
/* To unlock we move 0 to the lock.
|
||||
* On i386 this needs to be a locked operation
|
||||
* to avoid Pentium Pro errata 66 and 92.
|
||||
*/
|
||||
#if defined(__x86_64__)
|
||||
__asm__ __volatile__("" : : : "memory");
|
||||
*(unsigned char*)&lock->lock = 0;
|
||||
#else
|
||||
char tmp = 0;
|
||||
__asm__ __volatile__(
|
||||
"xchgb %b0, %1"
|
||||
: "=q"(tmp), "=m"(lock->lock)
|
||||
: "0"(tmp) : "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
#define TRY_LOCK(LOCK_VAR) spin_trylock((spinlock_t *)(LOCK_VAR))
|
||||
|
||||
#define INIT_LOCK(LOCK_VAR) ((LOCK_VAR) = 0)
|
||||
#define LOCK(LOCK_VAR) do { \
|
||||
@ -31,7 +56,7 @@
|
||||
} while (1)
|
||||
#define IS_LOCKED(LOCK_VAR) ((LOCK_VAR) != 0)
|
||||
#define IS_UNLOCKED(LOCK_VAR) ((LOCK_VAR) == 0)
|
||||
#define UNLOCK(LOCK_VAR) ((LOCK_VAR) = 0)
|
||||
#define UNLOCK(LOCK_VAR) spin_unlock((spinlock_t *)&(LOCK_VAR))
|
||||
|
||||
/* This code has been copied from the sources of the Linux kernel */
|
||||
|
||||
|
@ -268,8 +268,6 @@ version(T) :-
|
||||
fail.
|
||||
'$set_toplevel_hook'(_).
|
||||
|
||||
halt(X) :- '$halt'(X).
|
||||
|
||||
halt :-
|
||||
print_message(informational, halt),
|
||||
'$halt'(0).
|
||||
|
Reference in New Issue
Block a user