start support for java interface
bug fixes git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1093 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
14
C/exec.c
14
C/exec.c
@@ -127,6 +127,13 @@ do_execute(Term t, Term mod)
|
||||
/* first do predicate expansion, even before you process signals.
|
||||
This way you don't get to spy goal_expansion(). */
|
||||
if (PRED_GOAL_EXPANSION_ON) {
|
||||
LOCK(SignalLock);
|
||||
/* disable creeping when we do goal expansion */
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
DelayedTrace = TRUE;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
return CallMetaCall(mod);
|
||||
} else if (ActiveSignals) {
|
||||
return EnterCreepMode(t, mod);
|
||||
@@ -244,7 +251,11 @@ p_execute0(void)
|
||||
unsigned int arity;
|
||||
Prop pe;
|
||||
|
||||
if (ActiveSignals) {
|
||||
if (ActiveSignals || DelayedTrace) {
|
||||
if (DelayedTrace) {
|
||||
DelayedTrace = FALSE;
|
||||
ActiveSignals |= YAP_CREEP_SIGNAL;
|
||||
}
|
||||
return EnterCreepMode(t, mod);
|
||||
}
|
||||
restart_exec:
|
||||
@@ -1517,6 +1528,7 @@ Yap_InitYaamRegs(void)
|
||||
WPP = NULL;
|
||||
PREG_ADDR = NULL;
|
||||
#endif
|
||||
DelayedTrace = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -158,7 +158,6 @@ STATIC_PROTO (Int p_add_alias_to_stream, (void));
|
||||
STATIC_PROTO (Int p_change_alias_to_stream, (void));
|
||||
STATIC_PROTO (Int p_check_if_valid_new_alias, (void));
|
||||
STATIC_PROTO (Int p_fetch_stream_alias, (void));
|
||||
STATIC_PROTO (int format_print_str, (Int, Int, int, Term));
|
||||
STATIC_PROTO (Int p_format, (void));
|
||||
STATIC_PROTO (Int p_startline, (void));
|
||||
STATIC_PROTO (Int p_change_type_of_char, (void));
|
||||
@@ -3593,7 +3592,7 @@ static void fill_pads(int nchars)
|
||||
}
|
||||
|
||||
static int
|
||||
format_print_str (Int sno, Int size, Int has_size, Term args)
|
||||
format_print_str (Int sno, Int size, Int has_size, Term args, int (* f_putc)(int, int))
|
||||
{
|
||||
Term arghd;
|
||||
while (!has_size || size > 0) {
|
||||
@@ -3616,7 +3615,7 @@ format_print_str (Int sno, Int size, Int has_size, Term args)
|
||||
Yap_Error(TYPE_ERROR_LIST, arghd, "format/2");
|
||||
return FALSE;
|
||||
}
|
||||
format_putc(sno, (int) IntOfTerm (arghd));
|
||||
f_putc(sno, (int) IntOfTerm (arghd));
|
||||
size--;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -4013,7 +4012,7 @@ format(Term tail, Term args, int sno)
|
||||
if (targ > tnum-1)
|
||||
goto do_consistency_error;
|
||||
t = targs[targ++];
|
||||
if (!format_print_str (sno, repeats, has_repeats, t)) {
|
||||
if (!format_print_str (sno, repeats, has_repeats, t, f_putc)) {
|
||||
goto do_default_error;
|
||||
}
|
||||
break;
|
||||
|
||||
3
C/save.c
3
C/save.c
@@ -1301,7 +1301,9 @@ static void
|
||||
RestoreHeap(OPCODE old_ops[])
|
||||
{
|
||||
int heap_moved = (OldHeapBase != Yap_HeapBase), opcodes_moved;
|
||||
Term mod = CurrentModule;
|
||||
|
||||
CurrentModule = PROLOG_MODULE;
|
||||
opcodes_moved = check_opcodes(old_ops);
|
||||
/* opcodes_moved has side-effects and should be tried first */
|
||||
if (heap_moved || opcodes_moved) {
|
||||
@@ -1324,6 +1326,7 @@ RestoreHeap(OPCODE old_ops[])
|
||||
#ifdef DEBUG_RESTORE1
|
||||
fprintf(errout, "phase 1 done\n");
|
||||
#endif
|
||||
CurrentModule = mod;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
30
C/threads.c
30
C/threads.c
@@ -163,12 +163,42 @@ p_create_thread(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Int
|
||||
Yap_new_thread(void)
|
||||
{
|
||||
UInt ssize = IntegerOfTerm(Deref(ARG2));
|
||||
UInt tsize = IntegerOfTerm(Deref(ARG3));
|
||||
/* UInt systemsize = IntegerOfTerm(Deref(ARG4)); */
|
||||
Term tgoal = Deref(ARG1);
|
||||
Term tdetach = Deref(ARG5);
|
||||
int new_worker_id = IntegerOfTerm(Deref(ARG6));
|
||||
|
||||
if (new_worker_id == -1) {
|
||||
/* YAP ERROR */
|
||||
return FALSE;
|
||||
}
|
||||
ThreadHandle[new_worker_id].id = new_worker_id;
|
||||
store_specs(new_worker_id, ssize, tsize, tgoal, tdetach);
|
||||
pthread_mutex_init(&ThreadHandle[new_worker_id].tlock, NULL);
|
||||
if ((ThreadHandle[new_worker_id].ret = pthread_create(&ThreadHandle[new_worker_id].handle, NULL, thread_run, (void *)(&(ThreadHandle[new_worker_id].id)))) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
/* YAP ERROR */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_thread_self(void)
|
||||
{
|
||||
return Yap_unify(MkIntegerTerm(worker_id), ARG1);
|
||||
}
|
||||
|
||||
int
|
||||
Yap_self(void)
|
||||
{
|
||||
return worker_id;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_thread_join(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user