From c959ceeb1dc6ca2debcf500984a15fd1983eb5ed Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 28 Oct 2016 12:23:51 -0500 Subject: [PATCH 1/2] errors --- C/atomic.c | 1 + C/heapgc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/C/atomic.c b/C/atomic.c index 14744d434..cfe1c099c 100644 --- a/C/atomic.c +++ b/C/atomic.c @@ -442,6 +442,7 @@ restart_aux: static Int atom_codes(USES_REGS1) { Term t1; t1 = Deref(ARG1); + LOCAL_Error_TYPE = 0; restart_aux: if (IsAtomTerm(t1)) { Term tf = Yap_AtomToListOfCodes(t1 PASS_REGS); diff --git a/C/heapgc.c b/C/heapgc.c index 6159b19d6..8cec0ac7f 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -467,7 +467,7 @@ push_registers(Int num_regs, yamop *nextop USES_REGS) ( (*curslot < (CELL)LOCAL_GlobalBase && *curslot > (CELL)HR))) { - *curslot++ = TermNil; + *curslot++ = TermFreeTerm; } TrailTerm(TR++) = (CELL)curslot++; } From 117584e817a32136a0f7e386d5d08108a6f964c6 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 28 Oct 2016 12:24:52 -0500 Subject: [PATCH 2/2] GIL --- CXX/yapt.hh | 5 ++++- packages/python/python.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CXX/yapt.hh b/CXX/yapt.hh index 0edd8d949..44f7b8b51 100644 --- a/CXX/yapt.hh +++ b/CXX/yapt.hh @@ -22,7 +22,10 @@ protected: void mk(Term t0); /// internal method to convert from term to handle Term gt(); /// get handle and obtain term public: - virtual ~YAPTerm(){}; + virtual ~YAPTerm(){ LOCAL_HandleBase[t] = TermFreeTerm; + while ( LOCAL_HandleBase[LOCAL_CurSlot-1] == TermFreeTerm) + LOCAL_CurSlot--; + } YAPTerm(Term tn) { mk(tn); } /// private method to convert from Term (internal YAP representation) to diff --git a/packages/python/python.c b/packages/python/python.c index cdc8efe86..b86f075b3 100644 --- a/packages/python/python.c +++ b/packages/python/python.c @@ -93,7 +93,7 @@ X_API bool init_python(void) { // wait for YAP_Init return false; } - PyGILState_STATE gstate = PyGILState_Ensure(); + // PyGILState_STATE gstate = PyGILState_Ensure(); term_t t = PL_new_term_ref(); if (!Py_IsInitialized()) { python_in_python = true; @@ -112,6 +112,6 @@ X_API bool init_python(void) { PL_reset_term_refs(t); install_pypreds(); install_pl2pl(); - PyGILState_Release(gstate); + //PyGILState_Release(gstate); return !python_in_python; }