Overview Package Class Use Tree Deprecated Index Help
GNU Prolog for Java
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

gnu.prolog.vm.interpreter
Class InterpretedByteCode

java.lang.Object
 extended by gnu.prolog.vm.interpreter.InterpretedByteCode
All Implemented Interfaces:
Installable, PrologCode, PrologCodeListener, EventListener

public class InterpretedByteCode
extends Object
implements PrologCode, PrologCodeListener

Interpreted Code. This class is used by call_term instruction and InterpretedCode


Field Summary
protected CompoundTermTag codeTag
tag of this code
protected AtomicTerm[] constants
constants used by code
protected ExceptionHandlerInfo[] exceptionHandlers
set of exception handlers
static int IALLOCATE
static int ICALL
static int ICREATE_COMPOUND
static int ICREATE_VARIABLE
static int ICUT
static int IDUP
static int IFAIL
static int IJUMP
protected byte[] instructions
set of instructions
static int IPOP
static int IPUSH_ARGUMENT
static int IPUSH_CONSTANT
static int IPUSH_ENVIRONMENT
static int IRETRY_ME_ELSE
static int IRETURN
static int ISAVE_CUT
static int ISTORE_ENVIRONMENT
static int ITHROW
static int ITRUE
static int ITRUST_ME
static int ITRY_ME_ELSE
static int IUNIFY
protected PrologCode[] predicateCodes
predicate codes used by code
protected CompoundTermTag[] tags
tags used by code
Fields inherited from interface gnu.prolog.vm.PrologCode
FAIL, HALT, SUCCESS, SUCCESS_LAST
Constructor Summary
protected InterpretedByteCode(CompoundTermTag codeTag, Instruction[] isrc, ExceptionHandlerInfo[] ehs)
constructor of code
Method Summary
int execute(Interpreter interpreter, boolean backtrackMode, Term[] args)
this method is used for execution of code
String getIntruction(int currentPosition)
convert code to string
void install(Environment env)
this method is called when code is installed to the environment code can be installed only for one environment.
protected void pass1(Instruction[] isrc, int[] ipos, Map<CompoundTermTag,Integer> tag2idx, Map<AtomicTerm,Integer> constant2idx)
protected void pass2(Instruction[] isrc, int[] ipos, Map<CompoundTermTag,Integer> tag2idx, Map<AtomicTerm,Integer> constant2idx)
void prologCodeUpdated(PrologCodeUpdatedEvent evt)
this method is called when prolog code was updated
String toString()
convert code to string
void uninstall(Environment env)
this method is called when code is uninstalled from the environment
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

codeTag

protected CompoundTermTag codeTag
tag of this code


tags

protected CompoundTermTag[] tags
tags used by code


constants

protected AtomicTerm[] constants
constants used by code


predicateCodes

protected PrologCode[] predicateCodes
predicate codes used by code


instructions

protected byte[] instructions
set of instructions


exceptionHandlers

protected ExceptionHandlerInfo[] exceptionHandlers
set of exception handlers


IALLOCATE

public static final int IALLOCATE
See Also:
Constant Field Values

ICALL

public static final int ICALL
See Also:
Constant Field Values

ICREATE_COMPOUND

public static final int ICREATE_COMPOUND
See Also:
Constant Field Values

ICREATE_VARIABLE

public static final int ICREATE_VARIABLE
See Also:
Constant Field Values

ICUT

public static final int ICUT
See Also:
Constant Field Values

IDUP

public static final int IDUP
See Also:
Constant Field Values

IFAIL

public static final int IFAIL
See Also:
Constant Field Values

IJUMP

public static final int IJUMP
See Also:
Constant Field Values

IPOP

public static final int IPOP
See Also:
Constant Field Values

IPUSH_ARGUMENT

public static final int IPUSH_ARGUMENT
See Also:
Constant Field Values

IPUSH_CONSTANT

public static final int IPUSH_CONSTANT
See Also:
Constant Field Values

IPUSH_ENVIRONMENT

public static final int IPUSH_ENVIRONMENT
See Also:
Constant Field Values

IRETRY_ME_ELSE

public static final int IRETRY_ME_ELSE
See Also:
Constant Field Values

IRETURN

public static final int IRETURN
See Also:
Constant Field Values

ISAVE_CUT

public static final int ISAVE_CUT
See Also:
Constant Field Values

ISTORE_ENVIRONMENT

public static final int ISTORE_ENVIRONMENT
See Also:
Constant Field Values

ITHROW

public static final int ITHROW
See Also:
Constant Field Values

ITRUE

public static final int ITRUE
See Also:
Constant Field Values

ITRUST_ME

public static final int ITRUST_ME
See Also:
Constant Field Values

ITRY_ME_ELSE

public static final int ITRY_ME_ELSE
See Also:
Constant Field Values

IUNIFY

public static final int IUNIFY
See Also:
Constant Field Values
Constructor Detail

InterpretedByteCode

protected InterpretedByteCode(CompoundTermTag codeTag,
 Instruction[] isrc,
 ExceptionHandlerInfo[] ehs)
constructor of code

Method Detail

pass1

protected void pass1(Instruction[] isrc,
 int[] ipos,
 Map<CompoundTermTag,Integer> tag2idx,
 Map<AtomicTerm,Integer> constant2idx)

pass2

protected void pass2(Instruction[] isrc,
 int[] ipos,
 Map<CompoundTermTag,Integer> tag2idx,
 Map<AtomicTerm,Integer> constant2idx)

execute

public int execute(Interpreter interpreter,
 boolean backtrackMode,
 Term[] args)
 throws PrologException
this method is used for execution of code

Specified by:
execute in interface PrologCode
Parameters:
interpreter - interpreter in which context code is executed
backtrackMode - true if predicate is called on backtracking and false otherwise
args - arguments of code
Returns:
either SUCCESS, SUCCESS_LAST, or FAIL.
Throws:
PrologException

prologCodeUpdated

public void prologCodeUpdated(PrologCodeUpdatedEvent evt)
this method is called when prolog code was updated

Specified by:
prologCodeUpdated in interface PrologCodeListener

install

public void install(Environment env)
this method is called when code is installed to the environment code can be installed only for one environment.

Specified by:
install in interface Installable
Parameters:
env - Environment to install the predicate

uninstall

public void uninstall(Environment env)
this method is called when code is uninstalled from the environment

Specified by:
uninstall in interface Installable
Parameters:
env - Environment to install the predicate

toString

public String toString()
convert code to string

Overrides:
toString in class Object

getIntruction

public String getIntruction(int currentPosition)
convert code to string


Overview Package Class Use Tree Deprecated Index Help
GNU Prolog for Java
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

AltStyle によって変換されたページ (->オリジナル) /