1 package edu.berkeley.fleet.loops;
2 import edu.berkeley.fleet.api.*;
7 * A CodeBag represents the instructions of a Context along with
8 * (compile-time) knowledge of where it resides. Consequently, it is
9 * meaningful to say "give me the sequence of instructions which will
10 * invoke this CodeBag".
12 public class CodeBag {
15 * SF works works @diff ok for non size ships
16 * Dispatch Method Crossings @inbox? docks? tail call? limit consumed
17 * ------------------------------------------------------------------------------------------
19 * Inline 0 Y N N Small None
21 * Inline literals 1 N Y Y Tiny None
24 * Send CBD to 2+ N Y Y None None (mem ship)
27 * Send token to 3+ Y Y Y None One Output Dock
28 * assistant outbox first
30 * Release from FIFO 2 Y Y Y Med 1x FIFO, but can be shared
34 final Program program;
35 final Instruction[] instructions;
36 final long baseAddress;
39 * Given a Context, creates a CodeBag which will live in the
40 * Memory ship memoryShip at the address given by baseAddress.
42 CodeBag(Program program, Instruction[] instructions, long baseAddress) {
43 this.program = program;
44 this.instructions = instructions;
45 this.baseAddress = baseAddress;
48 if (instructions.length >= (1<<7))
49 throw new RuntimeException("code bag size is "+instructions.length+", which exceeds maximum of "+((1<<7)-1));