frysk.value
Class ArrayType

java.lang.Object
  extended by frysk.value.Type
      extended by frysk.value.ArrayType

public class ArrayType
extends Type

Type for an array.


Nested Class Summary
private  class ArrayType.ArrayIterator
          Iterate through the array members.
 
Field Summary
private  int[] dimension
           
private  int nrElements
           
private  int[] stride
           
private  Type type
           
 
Constructor Summary
ArrayType(Type type, int size, ArrayList dimensions)
          Create an ArrayType XXX: dimensions needs to be a set of ranges; this upper bound is sooooo confusing.
 
Method Summary
 boolean completeMember(String incomplete, List candidates)
          Complete the type's member; return false if nothing completed.
 Value dereference(Value var1, ByteBuffer taskMem)
          Dereference operation on array type.
 ArithmeticUnit getALU(int wordSize)
           
 ArithmeticUnit getALU(IntegerType type, int wordSize)
           
 ArithmeticUnit getALU(PointerType type, int wordSize)
           
 ArithmeticUnit getALU(Type type, int wordSize)
           
 Type getSliceType()
          Get the type of slice.
 Type getType()
          Return the element type for array or pointer type.
 Value index(Value v, Value idx, ByteBuffer taskMem)
          Index Operation on array V and index IDX.
private  Location slice(Location location, int idx, int count)
           
 Value slice(Value v, Value i, Value j, ByteBuffer taskMem)
          Slice returns a slice of an array.
(package private)  void toPrint(PrintWriter writer, Location location, ByteBuffer memory, Format format, int indent)
          Print Location as Type in user-readable form; use Format to print basic types.
 void toPrint(StringBuilder stringBuilder, int indent)
          Print this Type after indenting INDENT spaces.
private  boolean toPrintVector(PrintWriter writer, Type type, ArrayType.ArrayIterator e, ByteBuffer memory, Format format, int indent)
           
 String toString()
          For debugging and tracing; just dump the Type's name.
 
Methods inherited from class frysk.value.Type
addressOf, assign, completeFollowSym, getALU, getALU, getName, getSize, getUltimateType, member, pack, toPrint, toPrint, toPrintBrief
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

private final Type type

dimension

private final int[] dimension

stride

private final int[] stride

nrElements

private int nrElements
Constructor Detail

ArrayType

public ArrayType(Type type,
                 int size,
                 ArrayList dimensions)
Create an ArrayType XXX: dimensions needs to be a set of ranges; this upper bound is sooooo confusing.

Parameters:
typep - - Type of each array element
dimensions - - ArrayList of dimension upper bounds.
Method Detail

toString

public String toString()
Description copied from class: Type
For debugging and tracing; just dump the Type's name.

Overrides:
toString in class Type

getType

public Type getType()
Description copied from class: Type
Return the element type for array or pointer type.

Overrides:
getType in class Type

slice

private Location slice(Location location,
                       int idx,
                       int count)

index

public Value index(Value v,
                   Value idx,
                   ByteBuffer taskMem)
Index Operation on array V and index IDX.

Overrides:
index in class Type
Parameters:
taskMem - - unused here.

slice

public Value slice(Value v,
                   Value i,
                   Value j,
                   ByteBuffer taskMem)
Slice returns a slice of an array. For example: SLICE[1:2] on {9, 8, 7, 6} returns {8, 7} SLICE[1:2] on { {11, 11}, {0, 0}, {9, 9} } returns { {0, 0}, {9, 9} } Note: j should be greater than i.

Overrides:
slice in class Type

getSliceType

public Type getSliceType()
Description copied from class: Type
Get the type of slice.

Overrides:
getSliceType in class Type

dereference

public Value dereference(Value var1,
                         ByteBuffer taskMem)
Dereference operation on array type.

Overrides:
dereference in class Type

toPrint

void toPrint(PrintWriter writer,
             Location location,
             ByteBuffer memory,
             Format format,
             int indent)
Description copied from class: Type
Print Location as Type in user-readable form; use Format to print basic types. If needed, and when memory is non-NULL, it can be used for dereferencing pointers. Indent before printing.

Specified by:
toPrint in class Type

toPrintVector

private boolean toPrintVector(PrintWriter writer,
                              Type type,
                              ArrayType.ArrayIterator e,
                              ByteBuffer memory,
                              Format format,
                              int indent)

toPrint

public void toPrint(StringBuilder stringBuilder,
                    int indent)
Description copied from class: Type
Print this Type after indenting INDENT spaces.

Specified by:
toPrint in class Type
Parameters:
stringBuilder - TODO

getALU

public ArithmeticUnit getALU(Type type,
                             int wordSize)
Overrides:
getALU in class Type

getALU

public ArithmeticUnit getALU(IntegerType type,
                             int wordSize)
Overrides:
getALU in class Type

getALU

public ArithmeticUnit getALU(PointerType type,
                             int wordSize)
Overrides:
getALU in class Type

getALU

public ArithmeticUnit getALU(int wordSize)
Overrides:
getALU in class Type

completeMember

public boolean completeMember(String incomplete,
                              List candidates)
Description copied from class: Type
Complete the type's member; return false if nothing completed.

Overrides:
completeMember in class Type