lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/compiler/WAMCompiledQuery.java
public void emmitCode(ByteBuffer buffer, WAMMachine machine, WAMCallPoint callPoint) throws LinkageException
    {
        // Ensure that the size of the instruction listing does not exceed max int (highly unlikely).
        if (sizeof() > Integer.MAX_VALUE)
        {
            throw new IllegalStateException("The instruction listing size exceeds Integer.MAX_VALUE.");
        }

        // Used to keep track of the size of the emitted code, in bytes, as it is written.
        int length = 0;

        // Insert the compiled code into the byte code machine's code area.
        for (WAMInstruction instruction : instructions)
        {
            instruction.emmitCode(buffer, machine);
            length += instruction.sizeof();
        }

        // Keep record of the machine that the code is hosted in, and the call point of the functor within the machine.
        this.machine = machine;
        this.callPoint = callPoint;

        // Record the fact that the code is now linked into a machine.
        this.status = LinkStatus.Linked;
    }
public void emmitCode(ByteBuffer buffer, WAMMachine machine, WAMCallPoint callPoint) throws LinkageException
    {
        // Ensure that the size of the instruction listing does not exceed max int (highly unlikely).
        if (sizeof() > Integer.MAX_VALUE)
        {
            throw new IllegalStateException("The instruction listing size exceeds Integer.MAX_VALUE.");
        }

        // Used to keep track of the size of the emitted code, in bytes, as it is written.
        int length = 0;

        // Insert the compiled code into the byte code machine's code area.
        for (WAMInstruction instruction : instructions)
        {
            instruction.emmitCode(buffer, machine);
            length += instruction.sizeof();
        }

        // Keep record of the machine that the code is hosted in, and the call point of the functor within the machine.
        this.machine = machine;
        this.callPoint = callPoint;

        // Record the fact that the code is now linked into a machine.
        this.status = LinkStatus.Linked;
    }
public void emmitCode ( ByteBuffer buffer , WAMMachine machine , WAMCallPoint callPoint ) throws LinkageException { // Ensure that the size of the instruction listing does not exceed max int (highly unlikely). if ( sizeof ( ) > Integer . MAX_VALUE ) { throw new IllegalStateException ( "The instruction listing size exceeds Integer.MAX_VALUE." ) ; } // Used to keep track of the size of the emitted code, in bytes, as it is written. int length = 0 ; // Insert the compiled code into the byte code machine's code area. for ( WAMInstruction instruction : instructions ) { instruction . emmitCode ( buffer , machine ) ; length += instruction . sizeof ( ) ; } // Keep record of the machine that the code is hosted in, and the call point of the functor within the machine. this . machine = machine ; this . callPoint = callPoint ; // Record the fact that the code is now linked into a machine. this . status = LinkStatus . Linked ; }
Emmits the binary byte code for the clause into a machine, writing into the specified byte array. The state of
this clause is changed to 'Linked' to indicate that it has been linked into a binary machine.

@param  buffer    The code buffer to write to.
@param  machine   The binary machine to resolve call-points against, and to record as being linked into.
@param  callPoint The call point within the machine, at which the code is to be stored.

@throws LinkageException If required symbols to link to cannot be found in the binary machine.
Emmits the binary byte code for the clause into a machine writing into the specified byte array . The state of this clause is changed to Linked to indicate that it has been linked into a binary machine .