2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
2015-01-30 07:25:34 +00:00
|
|
|
* Yap Prolog *
|
2001-04-09 20:54:03 +01:00
|
|
|
* *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
2015-04-13 13:28:17 +01:00
|
|
|
* \z *
|
2001-04-09 20:54:03 +01:00
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: absmi.c *
|
|
|
|
* comments: Portable abstract machine interpreter *
|
2008-08-13 02:16:26 +01:00
|
|
|
* Last rev: $Date: 2008-08-13 01:16:26 $,$Author: vsc $ *
|
2004-03-10 14:59:55 +00:00
|
|
|
* $Log: not supported by cvs2svn $
|
2008-08-13 02:16:26 +01:00
|
|
|
* Revision 1.246 2008/08/12 01:27:22 vsc
|
|
|
|
* MaxOS fixes
|
|
|
|
* Avoid a thread deadlock
|
|
|
|
* improvements to SWI predicates.
|
|
|
|
* make variables_in_term system builtin.
|
|
|
|
*
|
2008-08-12 02:27:23 +01:00
|
|
|
* Revision 1.245 2008/08/07 20:51:15 vsc
|
|
|
|
* more threadin fixes
|
|
|
|
*
|
2008-08-07 21:51:23 +01:00
|
|
|
* Revision 1.244 2008/08/06 23:05:49 vsc
|
|
|
|
* fix debugging info
|
|
|
|
*
|
2008-08-07 00:05:49 +01:00
|
|
|
* Revision 1.243 2008/08/06 17:32:18 vsc
|
|
|
|
* more thread fixes
|
|
|
|
*
|
2008-08-06 18:32:22 +01:00
|
|
|
* Revision 1.242 2008/06/17 13:37:48 vsc
|
|
|
|
* fix c_interface not to crash when people try to recover slots that are
|
|
|
|
* not there.
|
|
|
|
* fix try_logical and friends to handle case where predicate has arity 0.
|
|
|
|
*
|
2008-06-17 14:37:51 +01:00
|
|
|
* Revision 1.241 2008/06/04 14:47:18 vsc
|
|
|
|
* make sure we do trim_trail whenever we mess with B!
|
|
|
|
*
|
2008-06-04 15:47:18 +01:00
|
|
|
* Revision 1.240 2008/04/04 16:11:40 vsc
|
|
|
|
* yapor had gotten broken with recent thread changes
|
|
|
|
*
|
2008-04-04 17:11:40 +01:00
|
|
|
* Revision 1.239 2008/04/03 13:26:37 vsc
|
|
|
|
* protect signal handling with locks for threaded version.
|
|
|
|
* fix close/1 entry in manual (obs from Nicos).
|
|
|
|
* fix -f option in chr Makefile.
|
|
|
|
*
|
2008-04-03 14:26:38 +01:00
|
|
|
* Revision 1.238 2008/04/03 10:50:23 vsc
|
|
|
|
* term_variables could store local variable in global.
|
|
|
|
*
|
2008-04-03 11:50:28 +01:00
|
|
|
* Revision 1.237 2008/03/26 14:37:07 vsc
|
|
|
|
* more icc fixes
|
|
|
|
*
|
2008-03-26 14:37:08 +00:00
|
|
|
* Revision 1.236 2008/03/25 16:45:52 vsc
|
|
|
|
* make or-parallelism compile again
|
|
|
|
*
|
2008-03-25 16:45:53 +00:00
|
|
|
* Revision 1.235 2008/02/12 17:03:50 vsc
|
|
|
|
* SWI-portability changes
|
|
|
|
*
|
2008-02-12 17:03:59 +00:00
|
|
|
* Revision 1.234 2008/01/27 11:01:06 vsc
|
|
|
|
* make thread code more stable
|
|
|
|
*
|
2008-01-27 11:01:07 +00:00
|
|
|
* Revision 1.233 2008/01/23 17:57:44 vsc
|
|
|
|
* valgrind it!
|
|
|
|
* enable atom garbage collection.
|
|
|
|
*
|
2008-01-23 17:57:56 +00:00
|
|
|
* Revision 1.232 2007/11/28 23:52:14 vsc
|
|
|
|
* junction tree algorithm
|
|
|
|
*
|
2007-11-28 23:52:14 +00:00
|
|
|
* Revision 1.231 2007/11/26 23:43:07 vsc
|
|
|
|
* fixes to support threads and assert correctly, even if inefficiently.
|
|
|
|
*
|
2007-11-26 23:43:10 +00:00
|
|
|
* Revision 1.230 2007/11/08 15:52:15 vsc
|
|
|
|
* fix some bugs in new dbterm code.
|
|
|
|
*
|
2007-11-08 15:52:15 +00:00
|
|
|
* Revision 1.229 2007/11/07 09:25:27 vsc
|
|
|
|
* speedup meta-calls
|
|
|
|
*
|
2007-11-07 09:25:27 +00:00
|
|
|
* Revision 1.228 2007/11/06 17:02:08 vsc
|
|
|
|
* compile ground terms away.
|
|
|
|
*
|
2007-11-06 17:02:13 +00:00
|
|
|
* Revision 1.227 2007/10/28 11:23:39 vsc
|
|
|
|
* fix overflow
|
|
|
|
*
|
2007-10-28 11:23:41 +00:00
|
|
|
* Revision 1.226 2007/10/28 00:54:09 vsc
|
|
|
|
* new version of viterbi implementation
|
|
|
|
* fix all:atvars reporting bad info
|
|
|
|
* fix bad S info in x86_64
|
|
|
|
*
|
2007-10-28 01:54:09 +01:00
|
|
|
* Revision 1.225 2007/10/17 09:18:26 vsc
|
|
|
|
* growtrail assumed SREG meant ASP?
|
|
|
|
*
|
2007-10-17 10:18:27 +01:00
|
|
|
* Revision 1.224 2007/09/24 09:02:31 vsc
|
|
|
|
* minor bug fixes
|
|
|
|
*
|
2007-09-24 10:02:33 +01:00
|
|
|
* Revision 1.223 2007/06/04 12:28:01 vsc
|
|
|
|
* interface speedups
|
|
|
|
* bad error message in X is foo>>2.
|
|
|
|
*
|
2007-06-04 13:28:02 +01:00
|
|
|
* Revision 1.222 2007/05/01 21:18:19 vsc
|
|
|
|
* fix bug in saving P at p_eq (obs from Frabrizio Riguzzi)
|
|
|
|
*
|
2007-05-01 22:18:19 +01:00
|
|
|
* Revision 1.221 2007/04/10 22:13:20 vsc
|
|
|
|
* fix max modules limitation
|
|
|
|
*
|
2007-04-10 23:13:21 +01:00
|
|
|
* Revision 1.220 2007/03/21 18:32:49 vsc
|
|
|
|
* fix memory expansion bugs.
|
|
|
|
*
|
2007-03-21 18:32:50 +00:00
|
|
|
* Revision 1.219 2007/01/24 09:57:25 vsc
|
|
|
|
* fix glist_void_varx
|
|
|
|
*
|
2007-01-24 09:57:25 +00:00
|
|
|
* Revision 1.218 2006/12/31 01:50:34 vsc
|
|
|
|
* fix some bugs in call_cleanup: the result of action should not matter,
|
|
|
|
* and !,fail would not wakeup the delayed goal.
|
|
|
|
*
|
2006-12-31 01:50:35 +00:00
|
|
|
* Revision 1.217 2006/12/30 03:25:44 vsc
|
|
|
|
* call_cleanup/2 and 3
|
|
|
|
*
|
2006-12-30 03:25:47 +00:00
|
|
|
* Revision 1.216 2006/12/29 01:57:50 vsc
|
|
|
|
* allow coroutining plus tabling, this means fixing some trouble with the
|
|
|
|
* gc and a bug in global variable handling.
|
|
|
|
*
|
2006-12-29 01:57:50 +00:00
|
|
|
* Revision 1.215 2006/12/27 01:32:37 vsc
|
|
|
|
* diverse fixes
|
|
|
|
*
|
2006-12-27 01:32:38 +00:00
|
|
|
* Revision 1.214 2006/11/28 00:46:28 vsc
|
|
|
|
* fix bug in threaded implementation
|
|
|
|
*
|
2006-11-28 00:46:28 +00:00
|
|
|
* Revision 1.213 2006/11/27 17:42:02 vsc
|
|
|
|
* support for UNICODE, and other bug fixes.
|
|
|
|
*
|
2006-11-27 17:42:03 +00:00
|
|
|
* Revision 1.212 2006/11/21 16:21:30 vsc
|
|
|
|
* fix I/O mess
|
|
|
|
* fix spy/reconsult mess
|
|
|
|
*
|
2006-11-21 16:21:33 +00:00
|
|
|
* Revision 1.211 2006/11/15 00:13:36 vsc
|
|
|
|
* fixes for indexing code.
|
|
|
|
*
|
2006-11-15 00:13:37 +00:00
|
|
|
* Revision 1.210 2006/10/25 02:31:07 vsc
|
|
|
|
* fix emulation of trust_logical
|
|
|
|
*
|
2006-10-25 03:31:07 +01:00
|
|
|
* Revision 1.209 2006/10/18 13:47:31 vsc
|
|
|
|
* index.c implementation of trust_logical was decrementing the wrong
|
|
|
|
* cp_tr
|
|
|
|
*
|
2006-10-18 14:47:32 +01:00
|
|
|
* Revision 1.208 2006/10/11 14:53:57 vsc
|
|
|
|
* fix memory leak
|
|
|
|
* fix overflow handling
|
|
|
|
* VS: ----------------------------------------------------------------------
|
|
|
|
*
|
2006-10-11 15:53:57 +01:00
|
|
|
* Revision 1.207 2006/10/10 20:21:42 vsc
|
|
|
|
* fix new indexing code to actually recover space
|
|
|
|
* fix predicate info to work for LUs
|
|
|
|
*
|
2006-10-10 21:21:42 +01:00
|
|
|
* Revision 1.206 2006/10/10 14:08:15 vsc
|
|
|
|
* small fixes on threaded implementation.
|
|
|
|
*
|
2006-10-10 15:08:17 +01:00
|
|
|
* Revision 1.205 2006/09/28 16:15:54 vsc
|
|
|
|
* make GMPless version compile.
|
|
|
|
*
|
2006-09-28 17:15:54 +01:00
|
|
|
* Revision 1.204 2006/09/20 20:03:51 vsc
|
|
|
|
* improve indexing on floats
|
|
|
|
* fix sending large lists to DB
|
|
|
|
*
|
2006-09-20 21:03:51 +01:00
|
|
|
* Revision 1.203 2006/08/07 18:51:44 vsc
|
|
|
|
* fix garbage collector not to try to garbage collect when we ask for large
|
|
|
|
* chunks of stack in a single go.
|
|
|
|
*
|
2006-08-07 19:51:44 +01:00
|
|
|
* Revision 1.202 2006/05/24 02:35:39 vsc
|
|
|
|
* make chr work and other minor fixes.
|
|
|
|
*
|
2006-05-24 03:35:39 +01:00
|
|
|
* Revision 1.201 2006/04/27 14:11:57 rslopes
|
|
|
|
* *** empty log message ***
|
|
|
|
*
|
2006-04-27 15:13:24 +01:00
|
|
|
* Revision 1.200 2006/04/12 17:14:58 rslopes
|
|
|
|
* fix needed by the EAM engine
|
|
|
|
*
|
2006-04-12 18:14:58 +01:00
|
|
|
* Revision 1.199 2006/04/12 15:51:23 rslopes
|
|
|
|
* small fixes
|
|
|
|
*
|
2006-04-12 16:51:23 +01:00
|
|
|
* Revision 1.198 2006/03/30 01:11:09 vsc
|
|
|
|
* fix nasty variable shunting bug in garbage collector :-(:wq
|
|
|
|
*
|
2006-03-30 02:11:10 +01:00
|
|
|
* Revision 1.197 2006/03/24 17:13:41 rslopes
|
|
|
|
* New update to BEAM engine.
|
|
|
|
* BEAM now uses YAP Indexing (JITI)
|
|
|
|
*
|
2006-03-24 17:13:41 +00:00
|
|
|
* Revision 1.196 2006/03/03 23:10:47 vsc
|
|
|
|
* fix MacOSX interrupt handling
|
|
|
|
* fix using Yap files as Yap scripts.
|
|
|
|
*
|
2006-03-03 23:11:30 +00:00
|
|
|
* Revision 1.195 2006/02/01 13:28:56 vsc
|
|
|
|
* bignum support fixes
|
|
|
|
*
|
2006-02-01 13:28:57 +00:00
|
|
|
* Revision 1.194 2006/01/26 19:13:24 vsc
|
|
|
|
* avoid compilation issues with lack of gmp (Remko Troncon)
|
|
|
|
*
|
2006-01-26 19:13:24 +00:00
|
|
|
* Revision 1.193 2006/01/18 15:34:53 vsc
|
|
|
|
* avoid sideffects from MkBigInt
|
|
|
|
*
|
2006-01-18 15:34:54 +00:00
|
|
|
* Revision 1.192 2006/01/17 14:10:40 vsc
|
|
|
|
* YENV may be an HW register (breaks some tabling code)
|
|
|
|
* All YAAM instructions are now brackedted, so Op introduced an { and EndOp introduces an }. This is because Ricardo assumes that.
|
|
|
|
* Fix attvars when COROUTING is undefined.
|
|
|
|
*
|
2006-01-17 14:10:42 +00:00
|
|
|
* Revision 1.191 2006/01/02 02:16:17 vsc
|
|
|
|
* support new interface between YAP and GMP, so that we don't rely on our own
|
|
|
|
* allocation routines.
|
|
|
|
* Several big fixes.
|
|
|
|
*
|
2006-01-02 02:16:19 +00:00
|
|
|
* Revision 1.190 2005/12/23 00:20:13 vsc
|
|
|
|
* updates to gprof
|
|
|
|
* support for __POWER__
|
|
|
|
* Try to saveregs before longjmp.
|
|
|
|
*
|
2005-12-23 00:20:14 +00:00
|
|
|
* Revision 1.189 2005/12/17 03:25:38 vsc
|
|
|
|
* major changes to support online event-based profiling
|
|
|
|
* improve error discovery and restart on scanner.
|
|
|
|
*
|
2005-12-17 03:25:39 +00:00
|
|
|
* Revision 1.188 2005/12/05 17:16:10 vsc
|
|
|
|
* write_depth/3
|
|
|
|
* overflow handlings and garbage collection
|
|
|
|
* Several ipdates to CLPBN
|
|
|
|
* dif/2 could be broken in the presence of attributed variables.
|
|
|
|
*
|
2005-12-05 17:16:12 +00:00
|
|
|
* Revision 1.187 2005/11/26 02:57:25 vsc
|
|
|
|
* improvements to debugger
|
|
|
|
* overflow fixes
|
|
|
|
* reading attvars from DB was broken.
|
|
|
|
*
|
2005-11-26 02:57:25 +00:00
|
|
|
* Revision 1.186 2005/11/23 03:01:32 vsc
|
|
|
|
* fix several bugs in save/restore.b
|
|
|
|
*
|
2005-11-23 03:01:33 +00:00
|
|
|
* Revision 1.185 2005/11/18 18:48:51 tiagosoares
|
|
|
|
* support for executing c code when a cut occurs
|
|
|
|
*
|
2005-11-18 18:52:41 +00:00
|
|
|
* Revision 1.184 2005/11/15 00:50:49 vsc
|
|
|
|
* fixes for stack expansion and garbage collection under tabling.
|
|
|
|
*
|
2005-11-15 00:50:49 +00:00
|
|
|
* Revision 1.183 2005/11/07 15:35:47 vsc
|
|
|
|
* fix bugs in garbage collection of tabling.
|
|
|
|
*
|
2005-11-07 15:35:47 +00:00
|
|
|
* Revision 1.182 2005/11/05 03:02:33 vsc
|
|
|
|
* get rid of unnecessary ^ in setof
|
|
|
|
* Found bug in comparisons
|
|
|
|
*
|
2005-11-05 03:02:33 +00:00
|
|
|
* Revision 1.181 2005/11/04 15:39:14 vsc
|
|
|
|
* absmi should PREG, never P!!
|
|
|
|
*
|
2005-11-04 15:39:14 +00:00
|
|
|
* Revision 1.180 2005/10/28 17:38:49 vsc
|
|
|
|
* sveral updates
|
|
|
|
*
|
2005-10-28 18:38:50 +01:00
|
|
|
* Revision 1.179 2005/10/18 17:04:43 vsc
|
|
|
|
* 5.1:
|
|
|
|
* - improvements to GC
|
|
|
|
* 2 generations
|
|
|
|
* generic speedups
|
|
|
|
* - new scheme for attvars
|
|
|
|
* - hProlog like interface also supported
|
|
|
|
* - SWI compatibility layer
|
|
|
|
* - extra predicates
|
|
|
|
* - global variables
|
|
|
|
* - moved to Prolog module
|
|
|
|
* - CLP(R) by Leslie De Koninck, Tom Schrijvers, Cristian Holzbaur, Bart
|
|
|
|
* Demoen and Jan Wielemacker
|
|
|
|
* - load_files/2
|
|
|
|
*
|
|
|
|
* from 5.0.1
|
|
|
|
*
|
|
|
|
* - WIN32 missing include files (untested)
|
|
|
|
* - -L trouble (my thanks to Takeyuchi Shiramoto-san)!
|
|
|
|
* - debugging of backtrable user-C preds would core dump.
|
|
|
|
* - redeclaring a C-predicate as Prolog core dumps.
|
|
|
|
* - badly protected YapInterface.h.
|
|
|
|
* - break/0 was failing at exit.
|
|
|
|
* - YAP_cut_fail and YAP_cut_succeed were different from manual.
|
|
|
|
* - tracing through data-bases could core dump.
|
|
|
|
* - cut could break on very large computations.
|
|
|
|
* - first pass at BigNum issues (reported by Roberto).
|
|
|
|
* - debugger could get go awol after fail port.
|
|
|
|
* - weird message on wrong debugger option.
|
|
|
|
*
|
2005-10-18 18:04:43 +01:00
|
|
|
* Revision 1.178 2005/10/15 17:05:23 rslopes
|
|
|
|
* enable profiling on amd64
|
|
|
|
*
|
2005-10-15 18:05:23 +01:00
|
|
|
* Revision 1.177 2005/09/09 17:24:37 vsc
|
|
|
|
* a new and hopefully much better implementation of atts.
|
|
|
|
*
|
2005-09-09 18:24:39 +01:00
|
|
|
* Revision 1.176 2005/09/08 22:06:44 rslopes
|
|
|
|
* BEAM for YAP update...
|
|
|
|
*
|
2005-09-08 23:06:45 +01:00
|
|
|
* Revision 1.175 2005/08/12 17:00:00 ricroc
|
|
|
|
* TABLING FIX: support for incomplete tables
|
|
|
|
*
|
2005-08-12 18:00:00 +01:00
|
|
|
* Revision 1.174 2005/08/05 14:55:02 vsc
|
|
|
|
* first steps to allow mavars with tabling
|
|
|
|
* fix trailing for tabling with multiple get_cons
|
|
|
|
*
|
2005-08-05 15:55:03 +01:00
|
|
|
* Revision 1.173 2005/08/04 15:45:49 ricroc
|
|
|
|
* TABLING NEW: support to limit the table space size
|
|
|
|
*
|
2005-08-04 16:45:56 +01:00
|
|
|
* Revision 1.172 2005/08/02 03:09:48 vsc
|
|
|
|
* fix debugger to do well nonsource predicates.
|
|
|
|
*
|
2005-08-02 04:09:52 +01:00
|
|
|
* Revision 1.171 2005/08/01 15:40:36 ricroc
|
|
|
|
* TABLING NEW: better support for incomplete tabling
|
|
|
|
*
|
2005-08-01 16:40:39 +01:00
|
|
|
* Revision 1.170 2005/07/06 19:33:51 ricroc
|
|
|
|
* TABLING: answers for completed calls can now be obtained by loading (new option) or executing (default) them from the trie data structure.
|
|
|
|
*
|
2005-07-06 20:34:12 +01:00
|
|
|
* Revision 1.169 2005/07/06 15:10:01 vsc
|
|
|
|
* improvements to compiler: merged instructions and fixes for ->
|
|
|
|
*
|
2005-07-06 16:10:18 +01:00
|
|
|
* Revision 1.168 2005/06/04 07:27:33 ricroc
|
|
|
|
* long int support for tabling
|
|
|
|
*
|
2005-06-04 08:28:24 +01:00
|
|
|
* Revision 1.167 2005/06/03 08:26:31 ricroc
|
|
|
|
* float support for tabling
|
|
|
|
*
|
2005-06-03 09:26:32 +01:00
|
|
|
* Revision 1.166 2005/06/01 20:25:22 vsc
|
|
|
|
* == and \= should not need a choice-point in ->
|
|
|
|
*
|
2005-06-01 21:25:23 +01:00
|
|
|
* Revision 1.165 2005/06/01 14:02:45 vsc
|
|
|
|
* get_rid of try_me?, retry_me? and trust_me? instructions: they are not
|
|
|
|
* significantly used nowadays.
|
|
|
|
*
|
2005-06-01 15:02:52 +01:00
|
|
|
* Revision 1.164 2005/05/26 18:07:32 vsc
|
|
|
|
* fix warning
|
|
|
|
*
|
2005-05-26 19:07:32 +01:00
|
|
|
* Revision 1.163 2005/04/10 04:01:07 vsc
|
|
|
|
* bug fixes, I hope!
|
|
|
|
*
|
2005-04-10 05:01:15 +01:00
|
|
|
* Revision 1.162 2005/04/07 17:48:53 ricroc
|
|
|
|
* Adding tabling support for mixed strategy evaluation (batched and local scheduling)
|
|
|
|
* UPDATE: compilation flags -DTABLING_BATCHED_SCHEDULING and -DTABLING_LOCAL_SCHEDULING removed. To support tabling use -DTABLING in the Makefile or --enable-tabling in configure.
|
|
|
|
* NEW: yap_flag(tabling_mode,MODE) changes the tabling execution mode of all tabled predicates to MODE (batched, local or default).
|
|
|
|
* NEW: tabling_mode(PRED,MODE) changes the default tabling execution mode of predicate PRED to MODE (batched or local).
|
|
|
|
*
|
2005-04-07 18:56:58 +01:00
|
|
|
* Revision 1.161 2005/03/13 06:26:09 vsc
|
|
|
|
* fix excessive pruning in meta-calls
|
|
|
|
* fix Term->int breakage in compiler
|
|
|
|
* improve JPL (at least it does something now for amd64).
|
|
|
|
*
|
2005-03-13 06:26:13 +00:00
|
|
|
* Revision 1.160 2005/03/07 17:49:14 vsc
|
|
|
|
* small fixes
|
|
|
|
*
|
2005-03-07 17:49:16 +00:00
|
|
|
* Revision 1.159 2005/03/04 20:29:55 ricroc
|
|
|
|
* bug fixes for YapTab support
|
|
|
|
*
|
2005-03-04 20:30:14 +00:00
|
|
|
* Revision 1.158 2005/03/01 22:25:07 vsc
|
|
|
|
* fix pruning bug
|
|
|
|
* make DL_MALLOC less enthusiastic about walking through buckets.
|
|
|
|
*
|
2005-03-01 22:25:09 +00:00
|
|
|
* Revision 1.157 2005/02/08 18:04:17 vsc
|
|
|
|
* library_directory may not be deterministic (usually it isn't).
|
|
|
|
*
|
2005-02-08 18:05:21 +00:00
|
|
|
* Revision 1.156 2005/01/13 05:47:25 vsc
|
|
|
|
* lgamma broke arithmetic optimisation
|
|
|
|
* integer_y has type y
|
|
|
|
* pass original source to checker (and maybe even use option in parser)
|
|
|
|
* use warning mechanism for checker messages.
|
|
|
|
*
|
2005-01-13 05:47:27 +00:00
|
|
|
* Revision 1.155 2004/12/28 22:20:34 vsc
|
|
|
|
* some extra bug fixes for trail overflows: some cannot be recovered that easily,
|
|
|
|
* some can.
|
|
|
|
*
|
2004-12-28 22:20:37 +00:00
|
|
|
* Revision 1.154 2004/12/05 05:01:21 vsc
|
|
|
|
* try to reduce overheads when running with goal expansion enabled.
|
|
|
|
* CLPBN fixes
|
|
|
|
* Handle overflows when allocating big clauses properly.
|
|
|
|
*
|
2004-12-05 05:01:45 +00:00
|
|
|
* Revision 1.153 2004/11/19 22:08:35 vsc
|
2015-09-25 10:57:26 +01:00
|
|
|
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
|
2004-12-05 05:01:45 +00:00
|
|
|
*
|
2004-11-19 22:08:43 +00:00
|
|
|
* Revision 1.152 2004/11/19 17:14:12 vsc
|
|
|
|
* a few fixes for 64 bit compiling.
|
|
|
|
*
|
2004-11-19 17:14:15 +00:00
|
|
|
* Revision 1.151 2004/11/04 18:22:28 vsc
|
|
|
|
* don't ever use memory that has been freed (that was done by LU).
|
|
|
|
* generic fixes for WIN32 libraries
|
|
|
|
*
|
2004-11-04 18:22:36 +00:00
|
|
|
* Revision 1.150 2004/10/26 20:15:36 vsc
|
|
|
|
* More bug fixes for overflow handling
|
|
|
|
*
|
2004-10-26 21:16:18 +01:00
|
|
|
* Revision 1.149 2004/10/14 22:14:52 vsc
|
|
|
|
* don't use a cached version of ARG1 in choice-points
|
|
|
|
*
|
2004-10-14 23:14:53 +01:00
|
|
|
* Revision 1.148 2004/09/30 21:37:40 vsc
|
|
|
|
* fixes for thread support
|
|
|
|
*
|
2004-09-30 22:37:41 +01:00
|
|
|
* Revision 1.147 2004/09/30 19:51:53 vsc
|
|
|
|
* fix overflow from within clause/2
|
|
|
|
*
|
2004-09-30 20:51:54 +01:00
|
|
|
* Revision 1.146 2004/09/27 20:45:02 vsc
|
|
|
|
* Mega clauses
|
|
|
|
* Fixes to sizeof(expand_clauses) which was being overestimated
|
|
|
|
* Fixes to profiling+indexing
|
|
|
|
* Fixes to reallocation of memory after restoring
|
|
|
|
* Make sure all clauses, even for C, end in _Ystop
|
|
|
|
* Don't reuse space for Streams
|
|
|
|
* Fix Stream_F on StreaNo+1
|
|
|
|
*
|
2004-09-27 21:45:04 +01:00
|
|
|
* Revision 1.145 2004/09/17 20:47:35 vsc
|
|
|
|
* fix some overflows recorded.
|
|
|
|
*
|
2004-09-17 21:47:35 +01:00
|
|
|
* Revision 1.144 2004/09/17 19:34:49 vsc
|
|
|
|
* simplify frozen/2
|
|
|
|
*
|
2004-09-17 20:34:53 +01:00
|
|
|
* Revision 1.143 2004/08/16 21:02:04 vsc
|
|
|
|
* more fixes for !
|
|
|
|
*
|
2004-08-16 22:02:04 +01:00
|
|
|
* Revision 1.142 2004/08/11 16:14:51 vsc
|
|
|
|
* whole lot of fixes:
|
|
|
|
* - memory leak in indexing
|
|
|
|
* - memory management in WIN32 now supports holes
|
|
|
|
* - extend Yap interface, more support for SWI-Interface
|
|
|
|
* - new predicate mktime in system
|
|
|
|
* - buffer console I/O in WIN32
|
|
|
|
*
|
2004-08-11 17:14:55 +01:00
|
|
|
* Revision 1.141 2004/07/23 21:08:44 vsc
|
|
|
|
* windows fixes
|
|
|
|
*
|
2004-07-23 22:08:45 +01:00
|
|
|
* Revision 1.140 2004/07/22 21:32:20 vsc
|
|
|
|
* debugger fixes
|
|
|
|
* initial support for JPL
|
|
|
|
* bad calls to garbage collector and gc
|
|
|
|
* debugger fixes
|
|
|
|
*
|
2004-07-22 22:32:23 +01:00
|
|
|
* Revision 1.139 2004/07/03 03:29:24 vsc
|
|
|
|
* make it compile again on non-linux machines
|
|
|
|
*
|
2004-07-03 04:29:24 +01:00
|
|
|
* Revision 1.138 2004/06/29 19:04:40 vsc
|
|
|
|
* fix multithreaded version
|
|
|
|
* include new version of Ricardo's profiler
|
|
|
|
* new predicat atomic_concat
|
|
|
|
* allow multithreaded-debugging
|
|
|
|
* small fixes
|
|
|
|
*
|
2004-06-29 20:04:46 +01:00
|
|
|
* Revision 1.137 2004/06/23 17:24:19 vsc
|
|
|
|
* New comment-based message style
|
|
|
|
* Fix thread support (at least don't deadlock with oneself)
|
|
|
|
* small fixes for coroutining predicates
|
|
|
|
* force Yap to recover space in arrays of dbrefs
|
|
|
|
* use private predicates in debugger.
|
|
|
|
*
|
2004-06-23 18:24:20 +01:00
|
|
|
* Revision 1.136 2004/06/17 22:07:22 vsc
|
|
|
|
* bad bug in indexing code.
|
|
|
|
*
|
2004-06-17 23:07:23 +01:00
|
|
|
* Revision 1.135 2004/06/09 03:32:02 vsc
|
|
|
|
* fix bugs
|
|
|
|
*
|
2004-06-09 04:32:03 +01:00
|
|
|
* Revision 1.134 2004/06/05 03:36:59 vsc
|
|
|
|
* coroutining is now a part of attvars.
|
|
|
|
* some more fixes.
|
|
|
|
*
|
2004-06-05 04:37:01 +01:00
|
|
|
* Revision 1.133 2004/05/13 20:54:57 vsc
|
|
|
|
* debugger fixes
|
|
|
|
* make sure we always go back to current module, even during initizlization.
|
|
|
|
*
|
2004-05-13 21:54:58 +01:00
|
|
|
* Revision 1.132 2004/04/29 03:45:49 vsc
|
|
|
|
* fix garbage collection in execute_tail
|
|
|
|
*
|
2004-04-29 04:45:50 +01:00
|
|
|
* Revision 1.131 2004/04/22 20:07:02 vsc
|
|
|
|
* more fixes for USE_SYSTEM_MEMORY
|
|
|
|
*
|
2004-04-22 21:07:07 +01:00
|
|
|
* Revision 1.130 2004/04/22 03:24:17 vsc
|
|
|
|
* trust_logical should protect the last clause, otherwise it cannot
|
|
|
|
* jump there.
|
|
|
|
*
|
2004-04-22 04:24:17 +01:00
|
|
|
* Revision 1.129 2004/04/16 19:27:30 vsc
|
|
|
|
* more bug fixes
|
|
|
|
*
|
2004-04-16 20:27:31 +01:00
|
|
|
* Revision 1.128 2004/04/14 19:10:22 vsc
|
|
|
|
* expand_clauses: keep a list of clauses to expand
|
|
|
|
* fix new trail scheme for multi-assignment variables
|
|
|
|
*
|
2004-04-14 20:10:40 +01:00
|
|
|
* Revision 1.127 2004/03/31 01:03:09 vsc
|
|
|
|
* support expand group of clauses
|
|
|
|
*
|
2004-03-31 02:03:10 +01:00
|
|
|
* Revision 1.126 2004/03/19 11:35:42 vsc
|
|
|
|
* trim_trail for default machine
|
|
|
|
* be more aggressive about try-retry-trust chains.
|
|
|
|
* - handle cases where block starts with a wait
|
|
|
|
* - don't use _killed instructions, just let the thing rot by itself.
|
|
|
|
*
|
2004-03-19 11:35:42 +00:00
|
|
|
* Revision 1.125 2004/03/10 14:59:54 vsc
|
|
|
|
* optimise -> for type tests
|
|
|
|
*
|
2004-03-10 14:59:55 +00:00
|
|
|
* Revision 1.124 2004/03/08 19:31:01 vsc
|
|
|
|
* move to 4.5.3
|
|
|
|
* *
|
2001-04-09 20:54:03 +01:00
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
2005-11-18 18:52:41 +00:00
|
|
|
|
2014-09-11 20:06:57 +01:00
|
|
|
/**
|
|
|
|
|
|
|
|
@file absmi.c
|
|
|
|
|
2014-09-13 00:50:04 +01:00
|
|
|
@defgroup Efficiency Efficiency Considerations
|
|
|
|
@ingroup YAPProgramming
|
2014-09-11 20:06:57 +01:00
|
|
|
|
|
|
|
We next discuss several issues on trying to make Prolog programs run
|
|
|
|
fast in YAP. We assume two different programming styles:
|
|
|
|
|
2015-02-06 18:11:52 +00:00
|
|
|
+ Execution of <em>deterministic</em> programs ofte
|
|
|
|
n
|
2014-09-11 20:06:57 +01:00
|
|
|
boils down to a recursive loop of the form:
|
|
|
|
|
|
|
|
~~~~~
|
|
|
|
loop(Env) :-
|
|
|
|
do_something(Env,NewEnv),
|
|
|
|
loop(NewEnv).
|
|
|
|
~~~~~
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-07 22:57:53 +01:00
|
|
|
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#define IN_ABSMI_C 1
|
2015-08-07 22:57:53 +01:00
|
|
|
#define _INATIVE 1
|
2011-03-07 16:02:55 +00:00
|
|
|
#define HAS_CACHE_REGS 1
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2015-02-06 18:11:52 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#include "absmi.h"
|
|
|
|
#include "heapgc.h"
|
|
|
|
|
2005-11-18 18:52:41 +00:00
|
|
|
#include "cut_c.h"
|
|
|
|
|
2015-02-06 18:11:52 +00:00
|
|
|
#if YAP_JIT
|
|
|
|
#include "IsGround.h"
|
|
|
|
|
2015-02-18 10:03:57 +00:00
|
|
|
TraceContext **curtrace;
|
|
|
|
yamop *curpreg;
|
|
|
|
BlocksContext **globalcurblock;
|
|
|
|
COUNT ineedredefinedest;
|
|
|
|
yamop* headoftrace;
|
|
|
|
|
2015-02-06 18:11:52 +00:00
|
|
|
NativeContext *NativeArea;
|
|
|
|
IntermediatecodeContext *IntermediatecodeArea;
|
|
|
|
|
|
|
|
CELL l;
|
|
|
|
|
|
|
|
CELL nnexec;
|
|
|
|
|
2015-02-18 10:03:57 +00:00
|
|
|
Environment *Yap_ExpEnvP, Yap_ExpEnv;
|
|
|
|
|
|
|
|
void **Yap_ABSMI_ControlLabels;
|
|
|
|
|
2015-02-06 18:11:52 +00:00
|
|
|
static Int traced_absmi(void)
|
|
|
|
{
|
|
|
|
return Yap_traced_absmi();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-02-18 10:03:57 +00:00
|
|
|
void **Yap_ABSMI_OPCODES;
|
|
|
|
|
2008-08-12 02:27:23 +01:00
|
|
|
#ifdef PUSH_X
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* keep X as a global variable */
|
|
|
|
|
|
|
|
Term Yap_XREGS[MaxTemps]; /* 29 */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#include "arith2.h"
|
|
|
|
|
2015-01-26 04:02:46 +00:00
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
// #include "print_preg.h"
|
|
|
|
//#include "sprint_op.hpp"
|
|
|
|
//#include "print_op.hpp"
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#ifdef COROUTINING
|
|
|
|
/*
|
|
|
|
Imagine we are interrupting the execution, say, because we have a spy
|
|
|
|
point or because we have goals to wake up. This routine saves the current
|
|
|
|
live temporary registers into a structure pointed to by register ARG1.
|
|
|
|
The registers are then recovered by a nasty builtin
|
2014-05-25 20:43:52 +01:00
|
|
|
called
|
2001-04-09 20:54:03 +01:00
|
|
|
*/
|
|
|
|
static Term
|
|
|
|
push_live_regs(yamop *pco)
|
|
|
|
{
|
2011-03-07 16:02:55 +00:00
|
|
|
CACHE_REGS
|
2014-05-30 01:06:09 +01:00
|
|
|
CELL *lab = (CELL *)(pco->y_u.l.l);
|
2001-04-09 20:54:03 +01:00
|
|
|
CELL max = lab[0];
|
2002-02-04 16:12:54 +00:00
|
|
|
CELL curr = lab[1];
|
2014-05-25 20:43:52 +01:00
|
|
|
Term tp = MkIntegerTerm((Int)pco);
|
|
|
|
Term tcp = MkIntegerTerm((Int)CP);
|
|
|
|
Term tenv = MkIntegerTerm((Int)(LCL0-ENV));
|
|
|
|
Term tyenv = MkIntegerTerm((Int)(LCL0-YENV));
|
2014-01-19 21:15:05 +00:00
|
|
|
CELL *start = HR;
|
2001-04-09 20:54:03 +01:00
|
|
|
Int tot = 0;
|
|
|
|
|
2014-05-25 20:43:52 +01:00
|
|
|
HR++;
|
|
|
|
*HR++ = tp;
|
|
|
|
*HR++ = tcp;
|
|
|
|
*HR++ = tenv;
|
|
|
|
*HR++ = tyenv;
|
|
|
|
tot += 4;
|
|
|
|
{
|
|
|
|
CELL i;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
lab += 2;
|
|
|
|
for (i=0; i <= max; i++) {
|
|
|
|
if (i == 8*CellSize) {
|
|
|
|
curr = lab[0];
|
|
|
|
lab++;
|
|
|
|
}
|
|
|
|
if (curr & 1) {
|
|
|
|
CELL d1;
|
|
|
|
|
|
|
|
tot+=2;
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[0] = MkIntTerm(i);
|
2001-04-09 20:54:03 +01:00
|
|
|
d1 = XREGS[i];
|
|
|
|
deref_head(d1, wake_up_unk);
|
|
|
|
wake_up_nonvar:
|
|
|
|
/* just copy it to the heap */
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[1] = d1;
|
|
|
|
HR += 2;
|
2001-04-09 20:54:03 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
{
|
|
|
|
CELL *pt0;
|
|
|
|
deref_body(d1, pt0, wake_up_unk, wake_up_nonvar);
|
|
|
|
/* bind it, in case it is a local variable */
|
2014-01-19 21:15:05 +00:00
|
|
|
if (pt0 <= HR) {
|
2001-04-09 20:54:03 +01:00
|
|
|
/* variable is safe */
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[1] = (CELL)pt0;
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
2014-01-19 21:15:05 +00:00
|
|
|
d1 = Unsigned(HR+1);
|
|
|
|
RESET_VARIABLE(HR+1);
|
2001-04-09 20:54:03 +01:00
|
|
|
Bind_Local(pt0, d1);
|
|
|
|
}
|
|
|
|
}
|
2014-01-19 21:15:05 +00:00
|
|
|
HR += 2;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
curr >>= 1;
|
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
start[0] = (CELL)Yap_MkFunctor(AtomTrue, tot);
|
2001-04-09 20:54:03 +01:00
|
|
|
return(AbsAppl(start));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-07-06 16:10:18 +01:00
|
|
|
#if defined(ANALYST) || defined(DEBUG)
|
|
|
|
|
2015-01-20 03:00:42 +00:00
|
|
|
char *Yap_op_names[] =
|
2005-07-06 16:10:18 +01:00
|
|
|
{
|
|
|
|
#define OPCODE(OP,TYPE) #OP
|
|
|
|
#include "YapOpcodes.h"
|
|
|
|
#undef OPCODE
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-12-12 14:24:40 +00:00
|
|
|
static int
|
2014-05-25 20:43:52 +01:00
|
|
|
check_alarm_fail_int(int CONT USES_REGS)
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
|
|
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
2014-05-25 20:43:52 +01:00
|
|
|
/* I need this for Windows and any system where SIGINT
|
2013-12-12 14:24:40 +00:00
|
|
|
is not proceesed by same thread as absmi */
|
2014-05-25 20:43:52 +01:00
|
|
|
if (LOCAL_PrologMode & (AbortMode|InterruptMode))
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
|
|
|
CalculateStackGap( PASS_REGS1 );
|
|
|
|
return CONT;
|
|
|
|
}
|
|
|
|
#endif
|
2014-09-02 20:19:23 +01:00
|
|
|
if (Yap_get_signal( YAP_FAIL_SIGNAL )) {
|
2014-09-10 05:50:43 +01:00
|
|
|
return false;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
2014-03-06 02:09:48 +00:00
|
|
|
if (!Yap_has_a_signal()) {
|
2014-09-02 20:19:23 +01:00
|
|
|
/* no need to look into GC */
|
|
|
|
CalculateStackGap( PASS_REGS1 );
|
2014-03-06 02:09:48 +00:00
|
|
|
}
|
|
|
|
// fail even if there are more signals, they will have to be dealt later.
|
2013-12-16 13:05:08 +00:00
|
|
|
return -1;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-09-29 23:01:19 +01:00
|
|
|
stack_overflow( PredEntry *pe, CELL *env, yamop *cp, arity_t nargs USES_REGS)
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
2014-01-19 21:15:05 +00:00
|
|
|
if ((Int)(Unsigned(YREG) - Unsigned(HR)) < StackGap( PASS_REGS1 ) ||
|
2014-09-02 20:19:23 +01:00
|
|
|
Yap_get_signal( YAP_STOVF_SIGNAL )) {
|
2014-05-25 20:43:52 +01:00
|
|
|
S = (CELL *)pe;
|
2015-08-07 22:57:53 +01:00
|
|
|
if (!Yap_locked_gc(nargs, env, cp)) {
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
|
2014-03-11 15:33:38 +00:00
|
|
|
return 0;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
code_overflow( CELL *yenv USES_REGS )
|
|
|
|
{
|
2014-09-02 20:19:23 +01:00
|
|
|
if (Yap_get_signal( YAP_CDOVF_SIGNAL )) {
|
2014-05-25 20:43:52 +01:00
|
|
|
CELL cut_b = LCL0-(CELL *)(yenv[E_CB]);
|
2013-12-12 14:24:40 +00:00
|
|
|
|
|
|
|
/* do a garbage collection first to check if we can recover memory */
|
2014-09-10 05:50:43 +01:00
|
|
|
if (!Yap_locked_growheap(false, 0, NULL)) {
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(RESOURCE_ERROR_HEAP, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
|
2013-12-12 14:24:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
CACHE_A1();
|
2014-05-25 20:43:52 +01:00
|
|
|
if (yenv == ASP) {
|
|
|
|
yenv[E_CB] = (CELL)(LCL0-cut_b);
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-05-25 20:43:52 +01:00
|
|
|
interrupt_handler( PredEntry *pe USES_REGS )
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2013-12-13 08:42:57 +00:00
|
|
|
// printf("D %lx %p\n", LOCAL_ActiveSignals, P);
|
2013-12-12 14:24:40 +00:00
|
|
|
/* tell whether we can creep or not, this is hard because we will
|
|
|
|
lose the info RSN
|
|
|
|
*/
|
|
|
|
BEGD(d0);
|
|
|
|
d0 = pe->ArityOfPE;
|
|
|
|
if (d0 == 0) {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[1] = MkAtomTerm((Atom) pe->FunctorOfPred);
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[d0 + 2] = AbsAppl(HR);
|
|
|
|
*HR = (CELL) pe->FunctorOfPred;
|
|
|
|
HR++;
|
2013-12-12 14:24:40 +00:00
|
|
|
BEGP(pt1);
|
|
|
|
pt1 = XREGS + 1;
|
|
|
|
for (; d0 > 0; --d0) {
|
|
|
|
BEGD(d1);
|
|
|
|
BEGP(pt0);
|
|
|
|
pt0 = pt1;
|
|
|
|
d1 = *pt0;
|
|
|
|
deref_head(d1, creep_unk);
|
|
|
|
creep_nonvar:
|
|
|
|
/* just copy it to the heap */
|
|
|
|
pt1++;
|
2014-01-19 21:15:05 +00:00
|
|
|
*HR++ = d1;
|
2013-12-12 14:24:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
derefa_body(d1, pt0, creep_unk, creep_nonvar);
|
2014-01-19 21:15:05 +00:00
|
|
|
if (pt0 <= HR) {
|
2013-12-12 14:24:40 +00:00
|
|
|
/* variable is safe */
|
2014-01-19 21:15:05 +00:00
|
|
|
*HR++ = (CELL)pt0;
|
2013-12-12 14:24:40 +00:00
|
|
|
pt1++;
|
|
|
|
} else {
|
|
|
|
/* bind it, in case it is a local variable */
|
2014-01-19 21:15:05 +00:00
|
|
|
d1 = Unsigned(HR);
|
|
|
|
RESET_VARIABLE(HR);
|
2013-12-12 14:24:40 +00:00
|
|
|
pt1++;
|
2014-01-19 21:15:05 +00:00
|
|
|
HR += 1;
|
2013-12-12 14:24:40 +00:00
|
|
|
Bind_Local(pt0, d1);
|
|
|
|
}
|
|
|
|
ENDP(pt0);
|
|
|
|
ENDD(d1);
|
|
|
|
}
|
|
|
|
ENDP(pt1);
|
|
|
|
}
|
|
|
|
ENDD(d0);
|
2014-01-19 21:15:05 +00:00
|
|
|
HR[0] = Yap_Module_Name(pe);
|
|
|
|
ARG1 = (Term) AbsPair(HR);
|
2013-12-12 14:24:40 +00:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
HR += 2;
|
2013-12-12 14:24:40 +00:00
|
|
|
#ifdef COROUTINING
|
2014-09-02 20:19:23 +01:00
|
|
|
if (Yap_get_signal( YAP_WAKEUP_SIGNAL )) {
|
2013-12-12 14:24:40 +00:00
|
|
|
CalculateStackGap( PASS_REGS1 );
|
|
|
|
ARG2 = Yap_ListOfWokenGoals();
|
|
|
|
pe = WakeUpCode;
|
|
|
|
/* no more goals to wake up */
|
|
|
|
Yap_UpdateTimedVar(LOCAL_WokenGoals,TermNil);
|
2014-05-25 20:43:52 +01:00
|
|
|
} else
|
2013-12-12 14:24:40 +00:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
CalculateStackGap( PASS_REGS1 );
|
|
|
|
pe = CreepCode;
|
|
|
|
}
|
|
|
|
P = pe->CodeOfPred;
|
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
if (Yap_do_low_level_trace)
|
|
|
|
low_level_trace(enter_pred,pe,XREGS+1);
|
|
|
|
#endif /* LOW_LEVEL_TRACE */
|
|
|
|
/* for profiler */
|
|
|
|
CACHE_A1();
|
2014-09-10 05:50:43 +01:00
|
|
|
return true;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
|
2014-05-25 20:43:52 +01:00
|
|
|
// interrupt handling code that sets up the case when we do not have
|
|
|
|
// a guaranteed environment.
|
|
|
|
static int
|
|
|
|
safe_interrupt_handler( PredEntry *pe USES_REGS )
|
|
|
|
{
|
|
|
|
CELL *npt = HR;
|
|
|
|
|
|
|
|
// printf("D %lx %p\n", LOCAL_ActiveSignals, P);
|
|
|
|
/* tell whether we can creep or not, this is hard because we will
|
|
|
|
lose the info RSN
|
|
|
|
*/
|
|
|
|
BEGD(d0);
|
|
|
|
S = (CELL *)pe;
|
|
|
|
d0 = pe->ArityOfPE;
|
|
|
|
if (d0 == 0) {
|
|
|
|
HR[1] = MkAtomTerm((Atom) pe->FunctorOfPred);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
HR[d0 + 2] = AbsAppl(HR);
|
|
|
|
HR += d0+1+2;
|
|
|
|
*npt++ = (CELL) pe->FunctorOfPred;
|
|
|
|
BEGP(pt1);
|
|
|
|
pt1 = XREGS + 1;
|
|
|
|
for (; d0 > 0; --d0) {
|
|
|
|
BEGD(d1);
|
|
|
|
d1 = *pt1;
|
|
|
|
loop:
|
|
|
|
if (!IsVarTerm(d1)) {
|
|
|
|
/* just copy it to the heap */
|
|
|
|
pt1++;
|
|
|
|
*npt++ = d1;
|
|
|
|
} else {
|
|
|
|
if (VarOfTerm(d1) < H0 || VarOfTerm(d1) > HR) {
|
|
|
|
d1 = Deref(d1);
|
|
|
|
if (VarOfTerm(d1) < H0 || VarOfTerm(d1) > HR) {
|
|
|
|
Term v = MkVarTerm();
|
2014-05-29 11:37:50 +01:00
|
|
|
YapBind( VarOfTerm(d1),v );
|
2014-05-25 20:43:52 +01:00
|
|
|
} else {
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*npt++ = d1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ENDD(d1);
|
|
|
|
}
|
|
|
|
ENDP(pt1);
|
|
|
|
}
|
|
|
|
ENDD(d0);
|
|
|
|
npt[0] = Yap_Module_Name(pe);
|
|
|
|
ARG1 = AbsPair(npt);
|
|
|
|
|
|
|
|
HR += 2;
|
|
|
|
#ifdef COROUTINING
|
2014-09-02 20:19:23 +01:00
|
|
|
if (Yap_get_signal( YAP_WAKEUP_SIGNAL )) {
|
2014-05-25 20:43:52 +01:00
|
|
|
CalculateStackGap( PASS_REGS1 );
|
|
|
|
ARG2 = Yap_ListOfWokenGoals();
|
|
|
|
pe = WakeUpCode;
|
|
|
|
/* no more goals to wake up */
|
|
|
|
Yap_UpdateTimedVar(LOCAL_WokenGoals,TermNil);
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
CalculateStackGap( PASS_REGS1 );
|
|
|
|
pe = CreepCode;
|
|
|
|
}
|
2014-09-02 20:19:23 +01:00
|
|
|
// allocate and fill out an environment
|
2014-05-25 20:43:52 +01:00
|
|
|
YENV = ASP;
|
|
|
|
CACHE_Y_AS_ENV(YREG);
|
|
|
|
ENV_YREG[E_CP] = (CELL) CP;
|
|
|
|
ENV_YREG[E_E] = (CELL) ENV;
|
|
|
|
#ifdef DEPTH_LIMIT
|
|
|
|
ENV_YREG[E_DEPTH] = DEPTH;
|
|
|
|
#endif /* DEPTH_LIMIT */
|
|
|
|
ENV = ENV_YREG;
|
|
|
|
ENV_YREG = (CELL *)((CELL)ENV_YREG + ENV_Size(CP));
|
|
|
|
WRITEBACK_Y_AS_ENV();
|
|
|
|
ENDCACHE_Y_AS_ENV();
|
|
|
|
CP = P;
|
|
|
|
P = pe->CodeOfPred;
|
|
|
|
#ifdef DEPTH_LIMIT
|
|
|
|
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
|
|
|
if (pe->ModuleOfPred) {
|
|
|
|
if (DEPTH == MkIntTerm(0))
|
2014-09-10 05:50:43 +01:00
|
|
|
return false;
|
2014-05-25 20:43:52 +01:00
|
|
|
else DEPTH = RESET_DEPTH();
|
|
|
|
}
|
|
|
|
} else if (pe->ModuleOfPred) {
|
|
|
|
DEPTH -= MkIntConstant(2);
|
|
|
|
}
|
|
|
|
#endif /* DEPTH_LIMIT */
|
2014-09-10 05:50:43 +01:00
|
|
|
return true;
|
2014-05-25 20:43:52 +01:00
|
|
|
}
|
|
|
|
|
2013-12-12 14:24:40 +00:00
|
|
|
static int
|
2014-05-25 20:43:52 +01:00
|
|
|
interrupt_handlerc( PredEntry *pe USES_REGS )
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
|
|
|
/* do creep in call */
|
|
|
|
ENV = YENV;
|
|
|
|
CP = NEXTOP(P, Osbpp);
|
2014-05-30 01:06:09 +01:00
|
|
|
YENV = (CELL *) (((char *) YENV) + P->y_u.Osbpp.s);
|
2013-12-12 14:24:40 +00:00
|
|
|
#ifdef FROZEN_STACKS
|
2014-05-25 20:43:52 +01:00
|
|
|
{
|
2013-12-12 14:24:40 +00:00
|
|
|
choiceptr top_b = PROTECT_FROZEN_B(B);
|
|
|
|
#ifdef YAPOR_SBA
|
2014-01-19 21:15:05 +00:00
|
|
|
if (YENV > (CELL *) top_b || YENV < HR) YENV = (CELL *) top_b;
|
2013-12-12 14:24:40 +00:00
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) top_b) YENV = (CELL *) top_b;
|
|
|
|
#endif /* YAPOR_SBA */
|
|
|
|
else YENV = YENV + ENV_Size(CP);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) B)
|
|
|
|
YENV = (CELL *) B;
|
|
|
|
else
|
|
|
|
/* I am not sure about this */
|
|
|
|
YENV = YENV + ENV_Size(CP);
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
/* setup GB */
|
|
|
|
YENV[E_CB] = (CELL) B;
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler( pe PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-05-25 20:43:52 +01:00
|
|
|
interrupt_handler_either( Term t_cut, PredEntry *pe USES_REGS )
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
2014-05-25 20:43:52 +01:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
ARG1 = push_live_regs(NEXTOP(P, Osbpp));
|
2013-12-12 14:24:40 +00:00
|
|
|
#ifdef FROZEN_STACKS
|
2014-05-25 20:43:52 +01:00
|
|
|
{
|
2013-12-12 14:24:40 +00:00
|
|
|
choiceptr top_b = PROTECT_FROZEN_B(B);
|
2014-05-25 20:43:52 +01:00
|
|
|
// protect registers before we mess about.
|
|
|
|
// recompute YENV and get ASP
|
2013-12-12 14:24:40 +00:00
|
|
|
#ifdef YAPOR_SBA
|
2014-01-19 21:15:05 +00:00
|
|
|
if (YENV > (CELL *) top_b || YENV < HR) YENV = (CELL *) top_b;
|
2013-12-12 14:24:40 +00:00
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) top_b) YENV = (CELL *) top_b;
|
|
|
|
#endif /* YAPOR_SBA */
|
|
|
|
else YENV = YENV + ENV_Size(CP);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) B)
|
|
|
|
YENV = (CELL *) B;
|
|
|
|
#endif /* FROZEN_STACKS */
|
2014-05-25 20:43:52 +01:00
|
|
|
P = NEXTOP(P, Osbpp);
|
|
|
|
// should we cut? If t_cut == INT(0) no
|
|
|
|
ARG2 = t_cut;
|
|
|
|
// ASP
|
|
|
|
SET_ASP(YENV, E_CB*sizeof(CELL));
|
|
|
|
// do the work.
|
|
|
|
rc = safe_interrupt_handler( pe PASS_REGS );
|
|
|
|
return rc;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
2014-05-25 20:43:52 +01:00
|
|
|
/* to trace interrupt calls */
|
|
|
|
// #define DEBUG_INTERRUPTS 1
|
2013-12-14 12:35:18 +00:00
|
|
|
|
2013-12-15 08:35:44 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-09-10 05:50:43 +01:00
|
|
|
static int trace_interrupts = true;
|
2013-12-15 08:35:44 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-12 14:24:40 +00:00
|
|
|
static int
|
|
|
|
interrupt_fail( USES_REGS1 )
|
|
|
|
{
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-09-10 05:50:43 +01:00
|
|
|
check_alarm_fail_int( false PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
/* don't do debugging and stack expansion here: space will
|
|
|
|
be recovered. automatically by fail, so
|
|
|
|
better wait.
|
|
|
|
*/
|
2014-09-08 23:12:05 +01:00
|
|
|
if (Yap_has_signal( YAP_CREEP_SIGNAL ) ) {
|
2014-09-10 05:50:43 +01:00
|
|
|
return false;
|
2014-09-08 23:12:05 +01:00
|
|
|
}
|
|
|
|
if (Yap_has_signal( YAP_CDOVF_SIGNAL ) ) {
|
2014-09-10 05:50:43 +01:00
|
|
|
return false;
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
/* make sure we have the correct environment for continuation */
|
|
|
|
ENV = B->cp_env;
|
|
|
|
YENV = (CELL *)B;
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler( RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)) PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_execute( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-09-10 05:50:43 +01:00
|
|
|
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = P->y_u.pp.p0;
|
2015-07-23 00:58:23 +01:00
|
|
|
if ((P->y_u.pp.p->PredFlags & (NoTracePredFlag|HiddenPredFlag)) && Yap_only_has_signal(YAP_CREEP_SIGNAL)) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2013-12-12 14:24:40 +00:00
|
|
|
SET_ASP(YENV, E_CB*sizeof(CELL));
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
2015-08-07 22:57:53 +01:00
|
|
|
if ((v = stack_overflow(P->y_u.pp.p, ENV, CP, P->y_u.pp.p->ArityOfPE PASS_REGS )) >= 0) {
|
2014-04-23 22:41:12 +01:00
|
|
|
return v;
|
|
|
|
}
|
2014-05-30 01:06:09 +01:00
|
|
|
return interrupt_handler( P->y_u.pp.p PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_call( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-09-10 05:50:43 +01:00
|
|
|
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = P->y_u.Osbpp.p0;
|
2014-03-06 02:09:48 +00:00
|
|
|
if (Yap_only_has_signal(YAP_CREEP_SIGNAL) &&
|
2015-07-23 00:58:23 +01:00
|
|
|
(P->y_u.Osbpp.p->PredFlags & (NoTracePredFlag|HiddenPredFlag)) ) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-05-30 01:06:09 +01:00
|
|
|
SET_ASP(YENV, P->y_u.Osbpp.s);
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
2015-08-07 22:57:53 +01:00
|
|
|
if ((v = stack_overflow( P->y_u.Osbpp.p, YENV, NEXTOP(P, Osbpp), P->y_u.Osbpp.p->ArityOfPE PASS_REGS )) >= 0) {
|
2014-04-23 22:41:12 +01:00
|
|
|
return v;
|
|
|
|
}
|
2014-05-30 01:06:09 +01:00
|
|
|
return interrupt_handlerc( P->y_u.Osbpp.p PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_pexecute( PredEntry *pen USES_REGS )
|
|
|
|
{
|
|
|
|
int v;
|
|
|
|
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2013-12-12 14:24:40 +00:00
|
|
|
PP = NULL;
|
2014-04-23 22:41:12 +01:00
|
|
|
if (Yap_only_has_signal(YAP_CREEP_SIGNAL)) {
|
2013-12-13 08:42:57 +00:00
|
|
|
return 2; /* keep on creeping */
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-03-11 15:33:38 +00:00
|
|
|
SET_ASP(YENV, E_CB*sizeof(CELL));
|
2013-12-12 14:24:40 +00:00
|
|
|
/* setup GB */
|
|
|
|
YENV[E_CB] = (CELL) B;
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
2015-08-07 22:57:53 +01:00
|
|
|
if ((v = stack_overflow( pen, ENV, NEXTOP(P, Osbmp), pen->ArityOfPE PASS_REGS )) >= 0) {
|
2014-04-23 22:41:12 +01:00
|
|
|
return v;
|
|
|
|
}
|
2013-12-12 14:24:40 +00:00
|
|
|
CP = NEXTOP(P, Osbmp);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler( pen PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* don't forget I cannot creep at deallocate (where to?) */
|
|
|
|
/* also, this is unusual in that I have already done deallocate,
|
|
|
|
so I don't need to redo it.
|
2014-05-25 20:43:52 +01:00
|
|
|
*/
|
2013-12-12 14:24:40 +00:00
|
|
|
static int
|
|
|
|
interrupt_deallocate( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-09-10 05:50:43 +01:00
|
|
|
if ((v = check_alarm_fail_int( true PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-05-25 20:43:52 +01:00
|
|
|
/*
|
2013-12-12 14:24:40 +00:00
|
|
|
don't do a creep here; also, if our instruction is followed by
|
|
|
|
a execute_c, just wait a bit more */
|
2014-03-06 02:09:48 +00:00
|
|
|
if ( Yap_only_has_signal( YAP_CREEP_SIGNAL ) ||
|
2013-12-12 14:24:40 +00:00
|
|
|
/* keep on going if there is something else */
|
|
|
|
(P->opc != Yap_opcode(_procceed) &&
|
|
|
|
P->opc != Yap_opcode(_cut_e))) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
CELL cut_b = LCL0-(CELL *)(S[E_CB]);
|
|
|
|
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = PREVOP(P,p)->y_u.p.p;
|
2013-12-12 14:24:40 +00:00
|
|
|
ASP = YENV+E_CB;
|
|
|
|
/* cut_e */
|
2014-03-11 15:33:38 +00:00
|
|
|
SET_ASP(YENV, E_CB*sizeof(CELL));
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
2014-05-25 20:43:52 +01:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-03-06 02:09:48 +00:00
|
|
|
if (Yap_has_a_signal()) {
|
2014-05-25 20:43:52 +01:00
|
|
|
PredEntry *pe;
|
|
|
|
|
2013-12-12 14:24:40 +00:00
|
|
|
if (Yap_op_from_opcode(P->opc) == _cut_e) {
|
2014-05-25 20:43:52 +01:00
|
|
|
/* followed by a cut */
|
|
|
|
ARG1 = MkIntegerTerm(LCL0-(CELL *)S[E_CB]);
|
|
|
|
pe = RepPredProp(Yap_GetPredPropByFunc(FunctorCutBy,1));
|
2013-12-12 14:24:40 +00:00
|
|
|
} else {
|
2014-05-25 20:43:52 +01:00
|
|
|
pe = RepPredProp(Yap_GetPredPropByAtom(AtomTrue,0));
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler( pe PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
2014-04-23 22:41:12 +01:00
|
|
|
if (!Yap_locked_gc(0, ENV, CP)) {
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
S = ASP;
|
|
|
|
S[E_CB] = (CELL)(LCL0-cut_b);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_cut( USES_REGS1 )
|
|
|
|
{
|
2014-05-25 20:43:52 +01:00
|
|
|
Term t_cut = MkIntegerTerm(LCL0-(CELL *)YENV[E_CB]);
|
2013-12-16 13:05:08 +00:00
|
|
|
int v;
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-03-06 02:09:48 +00:00
|
|
|
if (!Yap_has_a_signal()
|
|
|
|
|| Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
/* find something to fool S */
|
|
|
|
P = NEXTOP(P,s);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler_either( t_cut, PredRestoreRegs PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_cut_t( USES_REGS1 )
|
|
|
|
{
|
2014-05-25 20:43:52 +01:00
|
|
|
Term t_cut = MkIntegerTerm(LCL0-(CELL *)YENV[E_CB]);
|
2013-12-16 13:05:08 +00:00
|
|
|
int v;
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-03-06 02:09:48 +00:00
|
|
|
if (!Yap_has_a_signal()
|
|
|
|
|| Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
/* find something to fool S */
|
|
|
|
P = NEXTOP(P,s);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler_either( t_cut, PredRestoreRegs PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-05-25 20:43:52 +01:00
|
|
|
interrupt_cut_e( USES_REGS1 )
|
2013-12-12 14:24:40 +00:00
|
|
|
{
|
2014-05-25 20:43:52 +01:00
|
|
|
Term t_cut = MkIntegerTerm(LCL0-(CELL *)S[E_CB]);
|
2013-12-16 13:05:08 +00:00
|
|
|
int v;
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-09-02 20:19:23 +01:00
|
|
|
if (!Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) {
|
2014-03-06 02:09:48 +00:00
|
|
|
return 2;
|
|
|
|
}
|
2013-12-12 14:24:40 +00:00
|
|
|
/* find something to fool S */
|
2014-05-25 20:43:52 +01:00
|
|
|
P = NEXTOP(P,s);
|
|
|
|
return interrupt_handler_either( t_cut, PredRestoreRegs PASS_REGS );
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_commit_y( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-30 01:06:09 +01:00
|
|
|
Term t_cut = YENV[P->y_u.yps.y];
|
2014-05-25 20:43:52 +01:00
|
|
|
|
|
|
|
#ifdef DEBUG_INTERRUPTS
|
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
|
|
|
#endif
|
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
if (!Yap_has_a_signal()
|
|
|
|
|| Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
/* find something to fool S */
|
2013-12-12 14:24:40 +00:00
|
|
|
P = NEXTOP(P,yps);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler_either( t_cut, PredRestoreRegs PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_commit_x( USES_REGS1 )
|
|
|
|
{
|
2013-12-16 13:05:08 +00:00
|
|
|
int v;
|
2014-05-30 01:06:09 +01:00
|
|
|
Term t_cut = XREG(P->y_u.xps.x);
|
2014-05-25 20:43:52 +01:00
|
|
|
|
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-09-02 20:19:23 +01:00
|
|
|
if (Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
|
|
|
}
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = P->y_u.xps.p0;
|
2013-12-12 14:24:40 +00:00
|
|
|
/* find something to fool S */
|
|
|
|
if (P->opc == Yap_opcode(_fcall)) {
|
|
|
|
/* fill it up */
|
|
|
|
CACHE_Y_AS_ENV(YREG);
|
|
|
|
ENV_YREG[E_CP] = (CELL) CP;
|
|
|
|
ENV_YREG[E_E] = (CELL) ENV;
|
|
|
|
#ifdef DEPTH_LIMIT
|
|
|
|
ENV_YREG[E_DEPTH] = DEPTH;
|
|
|
|
#endif /* DEPTH_LIMIT */
|
|
|
|
ENDCACHE_Y_AS_ENV();
|
|
|
|
}
|
|
|
|
P = NEXTOP(P,xps);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler_either( t_cut, PredRestoreRegs PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_either( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2015-01-30 07:25:34 +00:00
|
|
|
#ifdef DEBUGX
|
|
|
|
//if (trace_interrupts)
|
|
|
|
fprintf(stderr,"[%d] %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, \
|
2014-03-06 02:09:48 +00:00
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) {
|
2013-12-16 13:05:08 +00:00
|
|
|
return v;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
|
|
|
if (Yap_only_has_signal(YAP_CREEP_SIGNAL)) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
2014-04-23 22:41:12 +01:00
|
|
|
}
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = P->y_u.Osblp.p0;
|
2013-12-12 14:24:40 +00:00
|
|
|
/* find something to fool S */
|
2014-05-30 01:06:09 +01:00
|
|
|
SET_ASP(YENV, P->y_u.Osbpp.s);
|
2013-12-12 14:24:40 +00:00
|
|
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
|
|
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
2015-01-30 07:25:34 +00:00
|
|
|
//P = NEXTOP(P, Osblp);
|
2015-08-07 22:57:53 +01:00
|
|
|
if ((v = stack_overflow(RepPredProp(Yap_GetPredPropByFunc(FunctorRestoreRegs1,0)), YENV, NEXTOP(P,Osblp), 0 PASS_REGS )) >= 0) {
|
2015-04-13 13:14:36 +01:00
|
|
|
//P = PREVOP(P, Osblp);
|
2014-04-23 22:41:12 +01:00
|
|
|
return v;
|
|
|
|
}
|
2015-01-30 07:25:34 +00:00
|
|
|
// P = PREVOP(P, Osblp);
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler_either( MkIntTerm(0), RepPredProp(Yap_GetPredPropByFunc(FunctorRestoreRegs1,0)) PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
interrupt_dexecute( USES_REGS1 )
|
|
|
|
{
|
|
|
|
int v;
|
2014-05-25 20:43:52 +01:00
|
|
|
PredEntry *pe;
|
2013-12-12 14:24:40 +00:00
|
|
|
|
2013-12-14 12:35:18 +00:00
|
|
|
#ifdef DEBUG_INTERRUPTS
|
2014-03-06 02:09:48 +00:00
|
|
|
if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s/%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \
|
|
|
|
__FUNCTION__, __LINE__,YENV,ENV,ASP);
|
2013-12-14 12:35:18 +00:00
|
|
|
#endif
|
2014-10-19 01:48:38 +01:00
|
|
|
if (PP) UNLOCKPE(1,PP);
|
2014-05-30 01:06:09 +01:00
|
|
|
PP = P->y_u.pp.p0;
|
|
|
|
pe = P->y_u.pp.p;
|
2015-01-18 03:00:19 +00:00
|
|
|
if ((pe->PredFlags & (NoTracePredFlag|HiddenPredFlag)) && Yap_only_has_signal(YAP_CREEP_SIGNAL)) {
|
2013-12-12 14:24:40 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
/* set S for next instructions */
|
|
|
|
ASP = YENV+E_CB;
|
|
|
|
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
|
|
|
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
2014-04-23 22:41:12 +01:00
|
|
|
if ((v = code_overflow(YENV PASS_REGS)) >= 0) {
|
|
|
|
return v;
|
|
|
|
}
|
2015-08-07 22:57:53 +01:00
|
|
|
if ((v = stack_overflow( P->y_u.pp.p, (CELL *)YENV[E_E], (yamop *)YENV[E_CP], P->y_u.pp.p->ArityOfPE PASS_REGS )) >= 0) {
|
2014-04-23 22:41:12 +01:00
|
|
|
return v;
|
|
|
|
}
|
2013-12-12 14:24:40 +00:00
|
|
|
/* first, deallocate */
|
|
|
|
CP = (yamop *) YENV[E_CP];
|
|
|
|
ENV = YENV = (CELL *) YENV[E_E];
|
|
|
|
#ifdef DEPTH_LIMIT
|
|
|
|
YENV[E_DEPTH] = DEPTH;
|
|
|
|
#endif /* DEPTH_LIMIT */
|
|
|
|
#ifdef FROZEN_STACKS
|
2014-05-25 20:43:52 +01:00
|
|
|
{
|
2013-12-12 14:24:40 +00:00
|
|
|
choiceptr top_b = PROTECT_FROZEN_B(B);
|
|
|
|
#ifdef YAPOR_SBA
|
2014-02-05 16:21:21 +00:00
|
|
|
if (YENV > (CELL *) top_b || YENV < HR) YENV = (CELL *) top_b;
|
2013-12-12 14:24:40 +00:00
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) top_b) YENV = (CELL *) top_b;
|
|
|
|
#endif /* YAPOR_SBA */
|
|
|
|
else YENV = (CELL *) ((CELL)YENV + ENV_Size(CPREG));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (YENV > (CELL *) B) {
|
|
|
|
YENV = (CELL *) B;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
YENV = (CELL *) ((CELL) YENV + ENV_Size(CPREG));
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
/* setup GB */
|
|
|
|
YENV[E_CB] = (CELL) B;
|
|
|
|
|
|
|
|
/* and now CREEP */
|
2014-05-25 20:43:52 +01:00
|
|
|
return interrupt_handler( pe PASS_REGS );
|
2013-12-12 14:24:40 +00:00
|
|
|
}
|
|
|
|
|
2014-10-22 10:10:43 +01:00
|
|
|
static void
|
|
|
|
undef_goal( USES_REGS1 )
|
|
|
|
{
|
|
|
|
PredEntry *pe = PredFromDefCode(P);
|
|
|
|
BEGD(d0);
|
|
|
|
/* avoid trouble with undefined dynamic procedures */
|
|
|
|
/* I assume they were not locked beforehand */
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (!PP) {
|
|
|
|
PELOCK(19,pe);
|
|
|
|
PP = pe;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if ((pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag|MultiFileFlag)) ||
|
2016-01-03 01:03:37 +00:00
|
|
|
CurrentModule == PROLOG_MODULE ||
|
2014-10-22 10:10:43 +01:00
|
|
|
(UndefCode->OpcodeOfPred == UNDEF_OPCODE)) {
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
UNLOCKPE(19,PP);
|
|
|
|
PP = NULL;
|
|
|
|
#endif
|
|
|
|
P = FAILCODE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
UNLOCKPE(19,PP);
|
|
|
|
PP = NULL;
|
|
|
|
#endif
|
|
|
|
d0 = pe->ArityOfPE;
|
|
|
|
if (d0 == 0) {
|
|
|
|
HR[1] = MkAtomTerm((Atom)(pe->FunctorOfPred));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
HR[d0 + 2] = AbsAppl(HR);
|
|
|
|
*HR = (CELL) pe->FunctorOfPred;
|
|
|
|
HR++;
|
|
|
|
BEGP(pt1);
|
|
|
|
pt1 = XREGS + 1;
|
|
|
|
for (; d0 > 0; --d0) {
|
|
|
|
BEGD(d1);
|
|
|
|
BEGP(pt0);
|
|
|
|
pt0 = pt1++;
|
|
|
|
d1 = *pt0;
|
|
|
|
deref_head(d1, undef_unk);
|
|
|
|
undef_nonvar:
|
|
|
|
/* just copy it to the heap */
|
|
|
|
*HR++ = d1;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
derefa_body(d1, pt0, undef_unk, undef_nonvar);
|
|
|
|
if (pt0 <= HR) {
|
|
|
|
/* variable is safe */
|
|
|
|
*HR++ = (CELL)pt0;
|
|
|
|
} else {
|
|
|
|
/* bind it, in case it is a local variable */
|
|
|
|
d1 = Unsigned(HR);
|
|
|
|
RESET_VARIABLE(HR);
|
|
|
|
HR += 1;
|
|
|
|
Bind_Local(pt0, d1);
|
|
|
|
}
|
|
|
|
ENDP(pt0);
|
|
|
|
ENDD(d1);
|
|
|
|
}
|
|
|
|
ENDP(pt1);
|
|
|
|
}
|
|
|
|
ENDD(d0);
|
|
|
|
HR[0] = Yap_Module_Name(pe);
|
|
|
|
ARG1 = (Term) AbsPair(HR);
|
2015-06-17 23:53:13 +01:00
|
|
|
ARG2 = Yap_getUnknownModule(Yap_GetModuleEntry(HR[0]));
|
2014-10-22 10:10:43 +01:00
|
|
|
HR += 2;
|
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
if (Yap_do_low_level_trace)
|
|
|
|
low_level_trace(enter_pred,UndefCode,XREGS+1);
|
|
|
|
#endif /* LOW_LEVEL_TRACE */
|
|
|
|
P = UndefCode->CodeOfPred;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
spy_goal( USES_REGS1 )
|
|
|
|
{
|
|
|
|
PredEntry *pe = PredFromDefCode(P);
|
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (!PP) {
|
|
|
|
PELOCK(14,pe);
|
|
|
|
PP = pe;
|
2015-01-18 03:00:19 +00:00
|
|
|
}
|
2014-10-22 10:10:43 +01:00
|
|
|
#endif
|
|
|
|
BEGD(d0);
|
|
|
|
if (!(pe->PredFlags & IndexedPredFlag) &&
|
|
|
|
pe->cs.p_code.NOfClauses > 1) {
|
|
|
|
/* update ASP before calling IPred */
|
|
|
|
SET_ASP(YREG, E_CB*sizeof(CELL));
|
|
|
|
Yap_IPred(pe, 0, CP);
|
|
|
|
/* IPred can generate errors, it thus must get rid of the lock itself */
|
|
|
|
if (P == FAILCODE) {
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
2014-10-23 01:21:40 +01:00
|
|
|
if (PP && !(PP->PredFlags & LogUpdatePredFlag)){
|
2014-10-22 10:10:43 +01:00
|
|
|
UNLOCKPE(20,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* first check if we need to increase the counter */
|
|
|
|
if ((pe->PredFlags & CountPredFlag)) {
|
2015-04-21 23:09:43 +01:00
|
|
|
LOCK(pe->StatisticsForPred->lock);
|
|
|
|
pe->StatisticsForPred->NOfEntries++;
|
|
|
|
UNLOCK(pe->StatisticsForPred->lock);
|
2014-10-22 10:10:43 +01:00
|
|
|
LOCAL_ReductionsCounter--;
|
|
|
|
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (PP) {
|
|
|
|
UNLOCKPE(20,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT,"");
|
2014-10-22 10:10:43 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
LOCAL_PredEntriesCounter--;
|
|
|
|
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (PP) {
|
|
|
|
UNLOCKPE(21,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
|
2014-10-22 10:10:43 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((pe->PredFlags & (CountPredFlag|ProfiledPredFlag|SpiedPredFlag)) ==
|
|
|
|
CountPredFlag) {
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (PP) {
|
|
|
|
UNLOCKPE(22,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
P = pe->cs.p_code.TrueCodeOfPred;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* standard profiler */
|
|
|
|
if ((pe->PredFlags & ProfiledPredFlag)) {
|
2015-04-21 23:09:43 +01:00
|
|
|
LOCK(pe->StatisticsForPred->lock);
|
|
|
|
pe->StatisticsForPred->NOfEntries++;
|
|
|
|
UNLOCK(pe->StatisticsForPred->lock);
|
2014-10-22 10:10:43 +01:00
|
|
|
if (!(pe->PredFlags & SpiedPredFlag)) {
|
|
|
|
P = pe->cs.p_code.TrueCodeOfPred;
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (PP) {
|
|
|
|
UNLOCKPE(23,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
if (PP) {
|
|
|
|
UNLOCKPE(25,pe);
|
|
|
|
PP = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
d0 = pe->ArityOfPE;
|
|
|
|
/* save S for ModuleName */
|
|
|
|
if (d0 == 0) {
|
|
|
|
HR[1] = MkAtomTerm((Atom)(pe->FunctorOfPred));
|
|
|
|
} else {
|
|
|
|
*HR = (CELL) pe->FunctorOfPred;
|
|
|
|
HR[d0 + 2] = AbsAppl(HR);
|
|
|
|
HR++;
|
|
|
|
BEGP(pt1);
|
|
|
|
pt1 = XREGS + 1;
|
|
|
|
for (; d0 > 0; --d0) {
|
|
|
|
BEGD(d1);
|
|
|
|
BEGP(pt0);
|
|
|
|
pt0 = pt1++;
|
|
|
|
d1 = *pt0;
|
|
|
|
deref_head(d1, dospy_unk);
|
|
|
|
dospy_nonvar:
|
|
|
|
/* just copy it to the heap */
|
|
|
|
*HR++ = d1;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
derefa_body(d1, pt0, dospy_unk, dospy_nonvar);
|
|
|
|
if (pt0 <= HR) {
|
|
|
|
/* variable is safe */
|
|
|
|
*HR++ = (CELL)pt0;
|
|
|
|
} else {
|
|
|
|
/* bind it, in case it is a local variable */
|
|
|
|
d1 = Unsigned(HR);
|
|
|
|
RESET_VARIABLE(HR);
|
|
|
|
HR += 1;
|
|
|
|
Bind_Local(pt0, d1);
|
|
|
|
}
|
|
|
|
ENDP(pt0);
|
|
|
|
ENDD(d1);
|
|
|
|
}
|
|
|
|
ENDP(pt1);
|
|
|
|
}
|
|
|
|
ENDD(d0);
|
|
|
|
HR[0] = Yap_Module_Name(pe);
|
|
|
|
|
|
|
|
ARG1 = (Term) AbsPair(HR);
|
|
|
|
HR += 2;
|
|
|
|
{
|
|
|
|
PredEntry *pt0;
|
2014-11-14 16:51:42 +00:00
|
|
|
#if THREADS
|
2014-10-22 10:10:43 +01:00
|
|
|
LOCK(GLOBAL_ThreadHandlesLock);
|
2014-11-14 16:51:42 +00:00
|
|
|
#endif
|
2014-10-22 10:10:43 +01:00
|
|
|
pt0 = SpyCode;
|
|
|
|
P_before_spy = P;
|
|
|
|
P = pt0->CodeOfPred;
|
|
|
|
/* for profiler */
|
2014-11-14 16:51:42 +00:00
|
|
|
#if THREADS
|
2014-10-22 10:10:43 +01:00
|
|
|
UNLOCK(GLOBAL_ThreadHandlesLock);
|
2014-11-14 16:51:42 +00:00
|
|
|
#endif
|
2014-10-22 10:10:43 +01:00
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
if (Yap_do_low_level_trace)
|
|
|
|
low_level_trace(enter_pred,pt0,XREGS+1);
|
|
|
|
#endif /* LOW_LEVEL_TRACE */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-25 20:43:52 +01:00
|
|
|
Int
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_absmi(int inp)
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
2011-03-07 16:02:55 +00:00
|
|
|
CACHE_REGS
|
2001-04-09 20:54:03 +01:00
|
|
|
#if BP_FREE
|
|
|
|
/* some function might be using bp for an internal variable, it is the
|
|
|
|
callee's responsability to save it */
|
|
|
|
yamop* PCBACKUP = P1REG;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LONG_LIVED_REGISTERS
|
|
|
|
register CELL d0, d1;
|
|
|
|
register CELL *pt0, *pt1;
|
|
|
|
|
|
|
|
#endif /* LONG_LIVED_REGISTERS */
|
2014-05-25 20:43:52 +01:00
|
|
|
|
|
|
|
#ifdef SHADOW_P
|
2001-04-09 20:54:03 +01:00
|
|
|
register yamop *PREG = P;
|
|
|
|
#endif /* SHADOW_P */
|
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_CP
|
2001-04-09 20:54:03 +01:00
|
|
|
register yamop *CPREG = CP;
|
|
|
|
#endif /* SHADOW_CP */
|
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_HB
|
2001-04-09 20:54:03 +01:00
|
|
|
register CELL *HBREG = HB;
|
|
|
|
#endif /* SHADOW_HB */
|
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_Y
|
2002-11-18 18:18:05 +00:00
|
|
|
register CELL *YREG = Yap_REGS.YENV_;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif /* SHADOW_Y */
|
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_S
|
2002-11-18 18:18:05 +00:00
|
|
|
register CELL *SREG = Yap_REGS.S_;
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
|
|
|
#define SREG S
|
|
|
|
#endif /* SHADOW_S */
|
|
|
|
|
|
|
|
/* The indexing register so that we will not destroy ARG1 without
|
|
|
|
* reason */
|
|
|
|
#define I_R (XREGS[0])
|
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
#if YAP_JIT
|
2015-04-13 13:14:36 +01:00
|
|
|
Yap_ExpEnvP = & Yap_ExpEnv;
|
2015-01-20 03:00:42 +00:00
|
|
|
static void *control_labels[] = { &&fail, &&NoStackCut, &&NoStackCommitY, &&NoStackCutT, &&NoStackEither, &&NoStackExecute, &&NoStackCall, &&NoStackDExecute, &&NoStackDeallocate, &¬railleft, &&NoStackFail, &&NoStackCommitX };
|
2015-01-18 03:00:19 +00:00
|
|
|
curtrace = NULL;
|
|
|
|
curpreg = NULL;
|
|
|
|
globalcurblock = NULL;
|
|
|
|
ineedredefinedest = 0;
|
|
|
|
NativeArea = (NativeContext*)malloc(sizeof(NativeContext));
|
|
|
|
NativeArea->area.p = NULL;
|
|
|
|
NativeArea->area.ok = NULL;
|
|
|
|
NativeArea->area.pc = NULL;
|
|
|
|
#if YAP_STAT_PREDS
|
|
|
|
NativeArea->area.nrecomp = NULL;
|
|
|
|
NativeArea->area.compilation_time = NULL;
|
|
|
|
NativeArea->area.native_size_bytes = NULL;
|
|
|
|
NativeArea->area.trace_size_bytes = NULL;
|
|
|
|
NativeArea->success = NULL;
|
|
|
|
NativeArea->runs = NULL;
|
|
|
|
NativeArea->t_runs = NULL;
|
|
|
|
#endif
|
|
|
|
NativeArea->n = 0;
|
|
|
|
IntermediatecodeArea = (IntermediatecodeContext*)malloc(sizeof(IntermediatecodeContext));
|
|
|
|
IntermediatecodeArea->area.t = NULL;
|
|
|
|
IntermediatecodeArea->area.ok = NULL;
|
|
|
|
IntermediatecodeArea->area.isactive = NULL;
|
|
|
|
IntermediatecodeArea->area.lastblock = NULL;
|
|
|
|
#if YAP_STAT_PREDS
|
|
|
|
IntermediatecodeArea->area.profiling_time = NULL;
|
|
|
|
#endif
|
|
|
|
IntermediatecodeArea->n = 0;
|
|
|
|
nnexec = 0;
|
|
|
|
l = 0;
|
|
|
|
#endif /* YAP_JIT */
|
2015-04-13 13:14:36 +01:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#if USE_THREADED_CODE
|
|
|
|
/************************************************************************/
|
|
|
|
/* Abstract Machine Instruction Address Table */
|
|
|
|
/* This must be declared inside the function. We use the asm directive */
|
|
|
|
/* to make it available outside this function */
|
|
|
|
/************************************************************************/
|
|
|
|
static void *OpAddress[] =
|
|
|
|
{
|
2015-08-07 22:57:53 +01:00
|
|
|
#define OPCODE(OP,TYPE) && _##OP
|
2001-04-09 20:54:03 +01:00
|
|
|
#include "YapOpcodes.h"
|
|
|
|
#undef OPCODE
|
|
|
|
};
|
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
#if YAP_JIT
|
2015-02-06 18:11:52 +00:00
|
|
|
ExpEnv.config_struc.TOTAL_OF_OPCODES =
|
|
|
|
sizeof(OpAddress)/(2*sizeof(void*));
|
2015-01-18 03:00:19 +00:00
|
|
|
#endif
|
2015-04-13 13:14:36 +01:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif /* USE_THREADED_CODE */
|
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
/*static void* (*nat_glist_valx)(yamop**,yamop**,CELL**,void**,int*);
|
2015-04-13 13:14:36 +01:00
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
if (nat_glist_valx == NULL) {
|
|
|
|
nat_glist_valx = (void*(*)(yamop**,yamop**,CELL**,void**,int*))call_JIT_Compiler(J, _glist_valx);
|
|
|
|
}*/
|
2015-04-13 13:14:36 +01:00
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_REGS
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
/* work with a local pointer to the registers */
|
2002-11-18 18:18:05 +00:00
|
|
|
register REGSTORE *regp = &Yap_REGS;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#endif /* SHADOW_REGS */
|
|
|
|
|
|
|
|
#if PUSH_REGS
|
|
|
|
|
|
|
|
/* useful on a X86 with -fomit-frame-pointer optimisation */
|
|
|
|
/* The idea is to push REGS onto the X86 stack frame */
|
|
|
|
|
|
|
|
/* first allocate local space */
|
|
|
|
REGSTORE absmi_regs;
|
2002-11-18 18:18:05 +00:00
|
|
|
REGSTORE *old_regs = Yap_regp;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#endif /* PUSH_REGS */
|
|
|
|
|
2006-03-24 17:13:41 +00:00
|
|
|
#ifdef BEAM
|
|
|
|
CELL OLD_B=B;
|
|
|
|
extern PredEntry *bpEntry;
|
|
|
|
if (inp==-9000) {
|
|
|
|
#if PUSH_REGS
|
|
|
|
old_regs = &Yap_REGS;
|
|
|
|
init_absmi_regs(&absmi_regs);
|
2011-03-07 16:02:55 +00:00
|
|
|
#if THREADS
|
|
|
|
regcache = Yap_regp
|
2013-11-15 01:10:25 +00:00
|
|
|
LOCAL_PL_local_data_p->reg_cache = regcache;
|
2011-03-07 16:02:55 +00:00
|
|
|
#else
|
2006-03-24 17:13:41 +00:00
|
|
|
Yap_regp = &absmi_regs;
|
2011-03-07 16:02:55 +00:00
|
|
|
#endif
|
2006-03-24 17:13:41 +00:00
|
|
|
#endif
|
2006-04-12 18:14:58 +01:00
|
|
|
CACHE_A1();
|
2006-03-24 17:13:41 +00:00
|
|
|
PREG=bpEntry->CodeOfPred;
|
|
|
|
JMPNext(); /* go execute instruction at PREG */
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#if USE_THREADED_CODE
|
|
|
|
/* absmadr */
|
|
|
|
if (inp > 0) {
|
2015-02-07 01:08:32 +00:00
|
|
|
Yap_ABSMI_OPCODES = OpAddress;
|
|
|
|
#if YAP_JIT
|
|
|
|
Yap_ABSMI_ControlLabels = control_labels;
|
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
#if BP_FREE
|
|
|
|
P1REG = PCBACKUP;
|
|
|
|
#endif
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
#endif /* USE_THREADED_CODE */
|
|
|
|
|
|
|
|
#if PUSH_REGS
|
2002-11-18 18:18:05 +00:00
|
|
|
old_regs = &Yap_REGS;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2015-11-05 15:04:12 +00:00
|
|
|
/* done, let us now initialize this space */
|
2001-04-09 20:54:03 +01:00
|
|
|
init_absmi_regs(&absmi_regs);
|
|
|
|
|
|
|
|
/* the registers are all set up, let's swap */
|
2004-01-23 02:23:51 +00:00
|
|
|
#ifdef THREADS
|
2014-05-25 20:43:52 +01:00
|
|
|
pthread_setspecific(Yap_yaamregs_key, (const void *)&absmi_regs);
|
2011-05-09 19:55:06 +01:00
|
|
|
LOCAL_ThreadHandle.current_yaam_regs = &absmi_regs;
|
2011-03-07 16:02:55 +00:00
|
|
|
regcache = &absmi_regs;
|
2015-06-17 23:53:45 +01:00
|
|
|
// LOCAL_PL_local_data_p->reg_cache = regcache;
|
2004-01-23 02:23:51 +00:00
|
|
|
#else
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_regp = &absmi_regs;
|
2004-01-23 02:23:51 +00:00
|
|
|
#endif
|
2002-11-18 18:18:05 +00:00
|
|
|
#undef Yap_REGS
|
|
|
|
#define Yap_REGS absmi_regs
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#endif /* PUSH_REGS */
|
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_REGS
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
/* use regp as a copy of REGS */
|
2002-11-18 18:18:05 +00:00
|
|
|
regp = &Yap_REGS;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#ifdef REGS
|
|
|
|
#undef REGS
|
|
|
|
#endif
|
|
|
|
#define REGS (*regp)
|
|
|
|
|
|
|
|
#endif /* SHADOW_REGS */
|
|
|
|
|
|
|
|
setregs();
|
|
|
|
|
|
|
|
CACHE_A1();
|
|
|
|
|
2005-12-23 00:20:14 +00:00
|
|
|
reset_absmi:
|
2014-05-25 20:43:52 +01:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
SP = SP0;
|
|
|
|
|
|
|
|
#if USE_THREADED_CODE
|
2015-04-13 13:14:36 +01:00
|
|
|
//___androidlog_print(ANDROID_LOG_INFO, "YAP ", "%s", Yap_op_names[Yap_op_from_opcode(PREG->opc)]);
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
JMPNext(); /* go execute instruction at P */
|
|
|
|
|
|
|
|
#else
|
|
|
|
/* when we start we are not in write mode */
|
|
|
|
|
|
|
|
{
|
|
|
|
op_numbers opcode = _Ystop;
|
|
|
|
op_numbers old_op;
|
2005-07-06 16:10:18 +01:00
|
|
|
#ifdef DEBUG_XX
|
2001-04-09 20:54:03 +01:00
|
|
|
unsigned long ops_done;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
goto nextop;
|
|
|
|
|
|
|
|
nextop_write:
|
|
|
|
|
|
|
|
old_op = opcode;
|
2014-05-30 01:06:09 +01:00
|
|
|
opcode = PREG->y_u.o.opcw;
|
2001-04-09 20:54:03 +01:00
|
|
|
goto op_switch;
|
|
|
|
|
|
|
|
nextop:
|
|
|
|
|
|
|
|
old_op = opcode;
|
|
|
|
opcode = PREG->opc;
|
|
|
|
|
|
|
|
op_switch:
|
|
|
|
|
|
|
|
#ifdef ANALYST
|
2011-05-25 16:40:36 +01:00
|
|
|
GLOBAL_opcount[opcode]++;
|
|
|
|
GLOBAL_2opcount[old_op][opcode]++;
|
2001-04-09 20:54:03 +01:00
|
|
|
#ifdef DEBUG_XX
|
|
|
|
ops_done++;
|
|
|
|
/* if (B->cp_b > 0x103fff90)
|
|
|
|
fprintf(stderr,"(%ld) doing %s, done %s, B is %p, HB is %p, H is %p\n",
|
2014-02-05 16:21:21 +00:00
|
|
|
ops_done,Yap_op_names[opcode],Yap_op_names[old_op],B,B->cp_h,HR);*/
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
#endif /* ANALYST */
|
|
|
|
|
|
|
|
switch (opcode) {
|
|
|
|
#endif /* USE_THREADED_CODE */
|
|
|
|
|
|
|
|
#if !OS_HANDLES_TR_OVERFLOW
|
|
|
|
notrailleft:
|
|
|
|
/* if we are within indexing code, the system may have to
|
|
|
|
* update a S */
|
2007-04-10 23:13:21 +01:00
|
|
|
{
|
2007-10-17 10:18:27 +01:00
|
|
|
CELL cut_b;
|
2007-04-10 23:13:21 +01:00
|
|
|
|
2008-03-26 14:37:08 +00:00
|
|
|
#ifdef SHADOW_S
|
2007-04-10 23:13:21 +01:00
|
|
|
S = SREG;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
2007-10-17 10:18:27 +01:00
|
|
|
/* YREG was pointing to where we were going to build the
|
2007-04-10 23:13:21 +01:00
|
|
|
* next choice-point. The stack shifter will need to know this
|
|
|
|
* to move the local stack */
|
2011-02-14 19:29:20 +00:00
|
|
|
SET_ASP(YREG, E_CB*sizeof(CELL));
|
2007-10-17 10:18:27 +01:00
|
|
|
cut_b = LCL0-(CELL *)(ASP[E_CB]);
|
2007-04-10 23:13:21 +01:00
|
|
|
saveregs();
|
2014-09-10 05:50:43 +01:00
|
|
|
if(!Yap_growtrail (0, false)) {
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(RESOURCE_ERROR_TRAIL,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
|
2007-04-10 23:13:21 +01:00
|
|
|
setregs();
|
|
|
|
FAIL();
|
|
|
|
}
|
2002-09-03 21:14:13 +01:00
|
|
|
setregs();
|
2009-04-18 21:22:51 +01:00
|
|
|
#ifdef SHADOW_S
|
|
|
|
SREG = S;
|
|
|
|
#endif
|
|
|
|
if (SREG == ASP) {
|
|
|
|
SREG[E_CB] = (CELL)(LCL0-cut_b);
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
goto reset_absmi;
|
|
|
|
|
|
|
|
#endif /* OS_HANDLES_TR_OVERFLOW */
|
|
|
|
|
2015-01-18 03:00:19 +00:00
|
|
|
// move instructions to separate file
|
|
|
|
// so that they are easier to analyse.
|
|
|
|
#include "absmi_insts.h"
|
2001-10-30 16:42:05 +00:00
|
|
|
|
2015-04-13 13:14:36 +01:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#if !USE_THREADED_CODE
|
|
|
|
default:
|
2002-01-29 05:37:31 +00:00
|
|
|
saveregs();
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_Error(SYSTEM_ERROR_INTERNAL, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
|
2002-01-29 05:37:31 +00:00
|
|
|
setregs();
|
|
|
|
FAIL();
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-12 14:24:40 +00:00
|
|
|
#else
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#if PUSH_REGS
|
|
|
|
restore_absmi_regs(old_regs);
|
|
|
|
#endif
|
2013-12-12 14:24:40 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#if BP_FREE
|
|
|
|
P1REG = PCBACKUP;
|
|
|
|
#endif
|
2013-12-12 14:24:40 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
return (0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-06-29 20:04:46 +01:00
|
|
|
/* dummy function that is needed for profiler */
|
2004-07-23 22:08:45 +01:00
|
|
|
int Yap_absmiEND(void)
|
2004-06-29 20:04:46 +01:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|