fix gcc dependent code
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@367 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
2b8c0a2961
commit
f3756717fb
16
C/heapgc.c
16
C/heapgc.c
@ -22,7 +22,7 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
|
||||||
#define EARLY_RESET 1
|
#define EARLY_RESET 1
|
||||||
#if !defined(TABLING) && HAVE_GCC
|
#if !defined(TABLING)
|
||||||
#define EASY_SHUNTING 1
|
#define EASY_SHUNTING 1
|
||||||
#endif
|
#endif
|
||||||
#define HYBRID_SCHEME 1
|
#define HYBRID_SCHEME 1
|
||||||
@ -291,7 +291,8 @@ GC_ALLOC_NEW_MASPACE(void)
|
|||||||
if ((char *)gc_ma_h_top > TrailTop-1024)
|
if ((char *)gc_ma_h_top > TrailTop-1024)
|
||||||
growtrail(64 * 1024L);
|
growtrail(64 * 1024L);
|
||||||
gc_ma_h_top++;
|
gc_ma_h_top++;
|
||||||
cont_top0 = cont_top = (cont *)gc_ma_h_top;
|
cont_top = (cont *)gc_ma_h_top;
|
||||||
|
sTR = (tr_fr_ptr)cont_top;
|
||||||
return(new);
|
return(new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +343,8 @@ GC_NEW_MAHASH(gc_ma_h_inner_struct *top) {
|
|||||||
time = ++timestamp;
|
time = ++timestamp;
|
||||||
}
|
}
|
||||||
gc_ma_h_top = top;
|
gc_ma_h_top = top;
|
||||||
cont_top0 = cont_top = (cont *)gc_ma_h_top;
|
cont_top = (cont *)gc_ma_h_top;
|
||||||
|
sTR = (tr_fr_ptr)cont_top;
|
||||||
live_list = NULL;
|
live_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1160,7 +1162,8 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
else
|
else
|
||||||
TrailTerm(endsTR) = (CELL)nsTR;
|
TrailTerm(endsTR) = (CELL)nsTR;
|
||||||
endsTR = nsTR;
|
endsTR = nsTR;
|
||||||
cont_top0 = cont_top = (cont *)(nsTR+3);
|
cont_top = (cont *)(nsTR+3);
|
||||||
|
sTR = (tr_fr_ptr)cont_top;
|
||||||
gc_ma_h_top = (gc_ma_h_inner_struct *)(nsTR+3);
|
gc_ma_h_top = (gc_ma_h_inner_struct *)(nsTR+3);
|
||||||
RESET_VARIABLE(cptr);
|
RESET_VARIABLE(cptr);
|
||||||
MARK(cptr);
|
MARK(cptr);
|
||||||
@ -1239,7 +1242,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
live_list = live_list->ma_list;
|
live_list = live_list->ma_list;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
cont_top0 = old_cont_top0;
|
sTR = (tr_fr_ptr)old_cont_top0;
|
||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
while (begsTR != NULL) {
|
while (begsTR != NULL) {
|
||||||
tr_fr_ptr newsTR = (tr_fr_ptr)TrailTerm(begsTR);
|
tr_fr_ptr newsTR = (tr_fr_ptr)TrailTerm(begsTR);
|
||||||
@ -2536,7 +2539,8 @@ marking_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp, CELL *max)
|
|||||||
#ifdef EASY_SHUNTING
|
#ifdef EASY_SHUNTING
|
||||||
sTR0 = (tr_fr_ptr)db_vec;
|
sTR0 = (tr_fr_ptr)db_vec;
|
||||||
#endif
|
#endif
|
||||||
cont_top0 = cont_top = (cont *)db_vec;
|
cont_top = (cont *)db_vec;
|
||||||
|
sTR = (tr_fr_ptr)db_vec;
|
||||||
/* These two must be marked first so that our trail optimisation won't lose
|
/* These two must be marked first so that our trail optimisation won't lose
|
||||||
values */
|
values */
|
||||||
mark_regs(old_TR); /* active registers & trail */
|
mark_regs(old_TR); /* active registers & trail */
|
||||||
|
@ -116,89 +116,89 @@ void rw_lock_voodoo(void) {
|
|||||||
/* code taken from the Linux kernel, it handles shifting between locks */
|
/* code taken from the Linux kernel, it handles shifting between locks */
|
||||||
/* Read/writer locks, as usual this is overly clever to make it as fast as possible. */
|
/* Read/writer locks, as usual this is overly clever to make it as fast as possible. */
|
||||||
/* caches... */
|
/* caches... */
|
||||||
__asm__ __volatile__("
|
__asm__ __volatile__(
|
||||||
___rw_read_enter_spin_on_wlock:
|
"___rw_read_enter_spin_on_wlock:"
|
||||||
orcc %g2, 0x0, %g0
|
" orcc %g2, 0x0, %g0"
|
||||||
be,a ___rw_read_enter
|
" be,a ___rw_read_enter"
|
||||||
ldstub [%g1 + 3], %g2
|
" ldstub [%g1 + 3], %g2"
|
||||||
b ___rw_read_enter_spin_on_wlock
|
" b ___rw_read_enter_spin_on_wlock"
|
||||||
ldub [%g1 + 3], %g2
|
" ldub [%g1 + 3], %g2"
|
||||||
___rw_read_exit_spin_on_wlock:
|
"___rw_read_exit_spin_on_wlock:"
|
||||||
orcc %g2, 0x0, %g0
|
" orcc %g2, 0x0, %g0"
|
||||||
be,a ___rw_read_exit
|
" be,a ___rw_read_exit"
|
||||||
ldstub [%g1 + 3], %g2
|
" ldstub [%g1 + 3], %g2"
|
||||||
b ___rw_read_exit_spin_on_wlock
|
" b ___rw_read_exit_spin_on_wlock"
|
||||||
ldub [%g1 + 3], %g2
|
" ldub [%g1 + 3], %g2"
|
||||||
___rw_write_enter_spin_on_wlock:
|
"___rw_write_enter_spin_on_wlock:"
|
||||||
orcc %g2, 0x0, %g0
|
" orcc %g2, 0x0, %g0"
|
||||||
be,a ___rw_write_enter
|
" be,a ___rw_write_enter"
|
||||||
ldstub [%g1 + 3], %g2
|
" ldstub [%g1 + 3], %g2"
|
||||||
b ___rw_write_enter_spin_on_wlock
|
" b ___rw_write_enter_spin_on_wlock"
|
||||||
ld [%g1], %g2
|
" ld [%g1], %g2"
|
||||||
|
""
|
||||||
|
" .globl ___rw_read_enter"
|
||||||
|
"___rw_read_enter:"
|
||||||
|
" orcc %g2, 0x0, %g0"
|
||||||
|
" bne,a ___rw_read_enter_spin_on_wlock"
|
||||||
|
" ldub [%g1 + 3], %g2"
|
||||||
|
" ld [%g1], %g2"
|
||||||
|
" add %g2, 1, %g2"
|
||||||
|
" st %g2, [%g1]"
|
||||||
|
" retl"
|
||||||
|
" mov %g4, %o7"
|
||||||
|
|
||||||
.globl ___rw_read_enter
|
" .globl ___rw_read_exit"
|
||||||
___rw_read_enter:
|
"___rw_read_exit:"
|
||||||
orcc %g2, 0x0, %g0
|
" orcc %g2, 0x0, %g0"
|
||||||
bne,a ___rw_read_enter_spin_on_wlock
|
" bne,a ___rw_read_exit_spin_on_wlock"
|
||||||
ldub [%g1 + 3], %g2
|
" ldub [%g1 + 3], %g2"
|
||||||
ld [%g1], %g2
|
" ld [%g1], %g2"
|
||||||
add %g2, 1, %g2
|
" sub %g2, 0x1ff, %g2"
|
||||||
st %g2, [%g1]
|
" st %g2, [%g1]"
|
||||||
retl
|
" retl"
|
||||||
mov %g4, %o7
|
" mov %g4, %o7"
|
||||||
|
|
||||||
.globl ___rw_read_exit
|
" .globl ___rw_write_enter"
|
||||||
___rw_read_exit:
|
"___rw_write_enter:"
|
||||||
orcc %g2, 0x0, %g0
|
" orcc %g2, 0x0, %g0"
|
||||||
bne,a ___rw_read_exit_spin_on_wlock
|
" bne ___rw_write_enter_spin_on_wlock"
|
||||||
ldub [%g1 + 3], %g2
|
" ld [%g1], %g2"
|
||||||
ld [%g1], %g2
|
" andncc %g2, 0xff, %g0"
|
||||||
sub %g2, 0x1ff, %g2
|
" bne,a ___rw_write_enter_spin_on_wlock"
|
||||||
st %g2, [%g1]
|
" stb %g0, [%g1 + 3]"
|
||||||
retl
|
" retl"
|
||||||
mov %g4, %o7
|
" mov %g4, %o7"
|
||||||
|
);
|
||||||
.globl ___rw_write_enter
|
|
||||||
___rw_write_enter:
|
|
||||||
orcc %g2, 0x0, %g0
|
|
||||||
bne ___rw_write_enter_spin_on_wlock
|
|
||||||
ld [%g1], %g2
|
|
||||||
andncc %g2, 0xff, %g0
|
|
||||||
bne,a ___rw_write_enter_spin_on_wlock
|
|
||||||
stb %g0, [%g1 + 3]
|
|
||||||
retl
|
|
||||||
mov %g4, %o7
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
#endif /* sparc */
|
#endif /* sparc */
|
||||||
|
|
||||||
|
|
||||||
#ifdef i386
|
#ifdef i386
|
||||||
asm(
|
asm(
|
||||||
"
|
|
||||||
.align 4
|
|
||||||
.globl __write_lock_failed
|
|
||||||
__write_lock_failed:
|
|
||||||
lock; addl $" RW_LOCK_BIAS_STR ",(%eax)
|
|
||||||
1: cmpl $" RW_LOCK_BIAS_STR ",(%eax)
|
|
||||||
jne 1b
|
|
||||||
|
|
||||||
lock; subl $" RW_LOCK_BIAS_STR ",(%eax)
|
".align 4"
|
||||||
jnz __write_lock_failed
|
".globl __write_lock_failed"
|
||||||
ret
|
"__write_lock_failed:"
|
||||||
|
" lock; addl $" RW_LOCK_BIAS_STR ",(%eax)"
|
||||||
|
"1: cmpl $" RW_LOCK_BIAS_STR ",(%eax)"
|
||||||
|
" jne 1b"
|
||||||
|
""
|
||||||
|
" lock; subl $" RW_LOCK_BIAS_STR ",(%eax)"
|
||||||
|
" jnz __write_lock_failed"
|
||||||
|
" ret"
|
||||||
|
""
|
||||||
|
""
|
||||||
|
".align 4"
|
||||||
|
".globl __read_lock_failed"
|
||||||
|
"__read_lock_failed:"
|
||||||
|
" lock ; incl (%eax)"
|
||||||
|
"1: cmpl $1,(%eax)"
|
||||||
|
" js 1b"
|
||||||
|
""
|
||||||
|
" lock ; decl (%eax)"
|
||||||
|
" js __read_lock_failed"
|
||||||
|
" ret"
|
||||||
|
|
||||||
|
|
||||||
.align 4
|
|
||||||
.globl __read_lock_failed
|
|
||||||
__read_lock_failed:
|
|
||||||
lock ; incl (%eax)
|
|
||||||
1: cmpl $1,(%eax)
|
|
||||||
js 1b
|
|
||||||
|
|
||||||
lock ; decl (%eax)
|
|
||||||
js __read_lock_failed
|
|
||||||
ret
|
|
||||||
"
|
|
||||||
);
|
);
|
||||||
#endif /* i386 */
|
#endif /* i386 */
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
Reference in New Issue
Block a user