% ---------------------------------------------------------------------- % BEGIN LICENSE BLOCK % Version: CMPL 1.1 % % The contents of this file are subject to the Cisco-style Mozilla Public % License Version 1.1 (the "License"); you may not use this file except % in compliance with the License. You may obtain a copy of the License % at www.eclipse-clp.org/license. % % Software distributed under the License is distributed on an "AS IS" % basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See % the License for the specific language governing rights and limitations % under the License. % % The Original Code is The ECLiPSe Constraint Logic Programming System. % The Initial Developer of the Original Code is Cisco Systems, Inc. % Portions created by the Initial Developer are % Copyright (C) 1992-2006 Cisco Systems, Inc. All Rights Reserved. % % Contributor(s): ECRC GmbH % Contributor(s): IC-Parc, Imperal College London % % END LICENSE BLOCK % % System: ECLiPSe Constraint Logic Programming System % Version: $Id: asm.pl,v 1.10 2013/06/21 19:27:26 kish_shen Exp $ % ---------------------------------------------------------------------- % % SEPIA PROLOG LIBRARY MODULE % % IDENTIFICATION: asm.pl % % AUTHORS: Joachim Schimpf % Pierre Lim % Kish Shen -- Major changes to add disasm/2 and % generalisation of code % % CONTENTS: asm(+PredSpec, +WAMList) % disasm(+PredSpec, -WAMList) % pasm(+WAMList, -Size, -BTPos, -WordList) % wam(+PredSpec) % % DESCRIPTION: % % asm(+PredSpec, +WAMList) creates the predicate PredSpec % with the code specified by WAMList. % % disasm(+PredSpec, -WAMList) unifies WAMList to the WAM code of a % currently defined predicate PredSpec. % % pasm(+WAMList, -Size, -BTPos, -WordList) partially assembles WAMList to a % platform independent format of the words that need to be stored into % memory. BTPos is offset in words from start of code to the port/break, % table, or 0 if none. % % A single instruction is a term whose functor specifies the instruction % and whose arguments are the instruction operands, e.g. % % get_integer(a(3), 99) % move(a(1), y(3)) % branch(ref(Label)) % % Format of labels: % % label() variable should not occur in other labels % % % Instruction operands are of the form: % % ref() reference (refers to a label()) % integer constant or % offset % float value % atom did or % named variable or % attribute name % a(N) argument register N % y(N) permanent variable N % t(N) temporary variable N % N/A procedure descriptor for predicate N/A % M:N/A procedure descriptor for predicate N/A in M % N/A did for functor N/A % y() vmask % y() named vmask % tags() % switch labels for switch_on_type % % entries for a switch table % switches for try_parallel instruction % % vmask is a list of int, where each int is a variable to be initialised. % The first element should be the smallest argument number % % named vmask is a list of VarName-, where VarName is an atom % representing the name of the variable to be initialised. First element % should be the smallest argument number % % Tag switch list is a list of TagName: