All Packages Class Hierarchy This Package Previous Next Index
Class prolog.ClauseCodeGen
java.lang.Object
|
+----prolog.ClauseCodeGen
- public class ClauseCodeGen
- extends Object
Generates code for a single clause. Provides macros for code generation,
and is the repository for fragments of generated code.
- See Also:
- PredicateCodeGen
-
arity
-
-
bindings
-
-
canFail
- Can this clause fail?
-
class_name
-
-
functor
-
-
functors
-
-
next
-
-
predicates
- The set of predicates we invoke.
-
sideEffects
- Does this clause contain calls to predicates with side-effects? If
so, we need to retain it, even if it fails.
-
trail
-
-
types
-
-
ClauseCodeGen(PredicateCodeGen)
- Creates a new compilation context for a clause.
-
addFP(BranchInstruction)
- Adds a failure point to the list.
-
arg_load(short)
- Load an an element of a Term[] array (reference to it on top
of the stack).
-
arg_store_do()
- Stores the top element of the stack into a Term[] array.
-
arg_store_prep(short)
- Loads the arrayref and index in preparation for a
AASTORE operation.
-
binding_create()
-
-
binding_unify(TermInfo, TermInfo)
- Bind a Binding to something.
-
checkcast(ObjectType)
-
-
compile(Clause, TermInfo[], boolean)
- Compiles a clause.
-
compile_call(Predicate, Term[], boolean)
- Compiles a generic call to a predicate.
-
compile_eval(Compound)
- Leaves a Numeric object on the stack.
-
compound_args_load()
- Loads the args array of a Compound term, stores
them in a new LV.
-
compound_checkFunctor(TermInfo, int)
- Compare the functor_arity of a Term with type
CompoundType with a given one.
-
compound_create(TermInfo)
- Creates a new Compound object using the argument as a
template.
-
compound_unify(TermInfo, TermInfo)
- Assumptions: both have type CompoundType with identical
functor/arity.
-
dup()
-
-
dup_x2()
-
-
flonum_create(FloNum)
- Creates a new FloNum object.
-
if_acmpne()
-
-
if_icmpne()
-
-
ifeq()
-
-
ifne()
-
-
intnum_create(IntNum)
- Creates a new IntNum object.
-
is_compile(Term, Term)
-
-
is_not_eq_compile(Term, Term)
-
-
lv_alloc(Type)
- Allocates a local variable to a Term.
-
lv_load(LocalVariableGen)
-
-
lv_store(LocalVariableGen)
-
-
nop()
-
-
numeric_compare(TermInfo, TermInfo, int)
- Compare two numbers.
-
numeric_unify(TermInfo, TermInfo)
- Unify two numbers.
-
patchFP()
- Patches the failure points to branch to the end of the clause.
-
pop()
-
-
term_getBinding()
- Unravel binding chains.
-
term_getBinding_cast(ObjectType, InstructionHandle)
- Unravel binding chains.
-
term_unify()
- Unify two terms together.
-
toString()
-
-
variable_unify(TermInfo, TermInfo)
- Unify a variable against some other term.
next
ClauseCodeGen next
functor
String functor
arity
int arity
types
public TypeDictionary types
sideEffects
boolean sideEffects
- Does this clause contain calls to predicates with side-effects? If
so, we need to retain it, even if it fails.
canFail
boolean canFail
- Can this clause fail?
class_name
String class_name
predicates
Hashtable predicates
- The set of predicates we invoke.
functors
Hashtable functors
trail
TypeTrail trail
bindings
Vector bindings
ClauseCodeGen
ClauseCodeGen(PredicateCodeGen pcg)
- Creates a new compilation context for a clause.
- Parameters:
- tid - the parent (predicate-level) namespace.
compile
boolean compile(Clause clause,
TermInfo type[],
boolean ci_det)
- Compiles a clause. Assumes the clause has been normalised.
- Parameters:
- ci_det - this clause is in a determinate situ according to the
indexer.
- Returns:
- false if this clause fails with no side effects,
true otherwise.
patchFP
void patchFP()
- Patches the failure points to branch to the end of the clause.
compile_call
public boolean compile_call(Predicate predicate,
Term args[],
boolean lastcall)
- Compiles a generic call to a predicate.
addFP
public void addFP(BranchInstruction bi)
- Adds a failure point to the list. It is assumed that there is a
boolean value on the stack, with true == success, continue, false ==
branch to failure code.
checkcast
public void checkcast(ObjectType t)
dup
public void dup()
dup_x2
public void dup_x2()
ifeq
public BranchInstruction ifeq()
ifne
public BranchInstruction ifne()
if_icmpne
public BranchInstruction if_icmpne()
if_acmpne
public BranchInstruction if_acmpne()
pop
public void pop()
lv_alloc
public LocalVariableGen lv_alloc(Type type)
- Allocates a local variable to a Term.
lv_load
public void lv_load(LocalVariableGen lv)
lv_store
public void lv_store(LocalVariableGen lv)
nop
public InstructionHandle nop()
arg_load
void arg_load(short index)
- Load an an element of a Term[] array (reference to it on top
of the stack).
Stack: ..., Term[] Ref -> ..., Term
arg_store_prep
void arg_store_prep(short index)
- Loads the arrayref and index in preparation for a
AASTORE operation.
Stack: ..., Term[] ref -> ..., Term[] ref, index
arg_store_do
void arg_store_do()
- Stores the top element of the stack into a Term[] array.
Stack: ..., Term[] ref, index, Term -> ...
binding_unify
public boolean binding_unify(TermInfo arg0,
TermInfo arg1)
- Bind a Binding to something.
Stack: ... -> ...
binding_create
public void binding_create()
compound_args_load
public LocalVariableGen compound_args_load()
- Loads the args array of a Compound term, stores
them in a new LV.
Stack: ..., CompoundRef -> ..., Term[] args
compound_checkFunctor
public void compound_checkFunctor(TermInfo arg0,
int functor_arity)
- Compare the functor_arity of a Term with type
CompoundType with a given one.
compound_create
public void compound_create(TermInfo arg0)
- Creates a new Compound object using the argument as a
template. Allocates a local variable for the arguments array.
Stack: ... -> CompoundRef
compound_unify
public boolean compound_unify(TermInfo arg0,
TermInfo arg1)
- Assumptions: both have type CompoundType with identical
functor/arity.
Stack: ... -> ...
flonum_create
public void flonum_create(FloNum n)
- Creates a new FloNum object.
intnum_create
public void intnum_create(IntNum n)
- Creates a new IntNum object.
numeric_compare
public boolean numeric_compare(TermInfo arg0,
TermInfo arg1,
int mode)
- Compare two numbers. Both are assumed to have type
NumericType.
- Parameters:
- mode - if compare returns this, success, else failure.
- See Also:
- compare
numeric_unify
public void numeric_unify(TermInfo arg0,
TermInfo arg1)
- Unify two numbers. Both are assumed to have type
NumericType.
is_not_eq_compile
public boolean is_not_eq_compile(Term a0,
Term a1)
is_compile
public boolean is_compile(Term arg0,
Term arg1)
compile_eval
public boolean compile_eval(Compound t)
- Leaves a Numeric object on the stack.
variable_unify
public boolean variable_unify(TermInfo arg0,
TermInfo arg1)
- Unify a variable against some other term.
term_getBinding
public void term_getBinding()
- Unravel binding chains.
Stack: ..., TermRef -> (Term)TermRef
term_getBinding_cast
public void term_getBinding_cast(ObjectType t,
InstructionHandle ih)
- Unravel binding chains.
Stack: ..., TermRef -> (Term)TermRef
term_unify
public void term_unify()
- Unify two terms together.
Stack: ..., TermRef, TermRef -> boolean
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index