js.tinyvm
Class InterfaceMap

java.lang.Object
  extended by js.tinyvm.WritableDataWithOffset
      extended by js.tinyvm.InterfaceMap
All Implemented Interfaces:
WritableData

public class InterfaceMap
extends WritableDataWithOffset

This class provides a represntation of an interface map. The map is used at run time to determine if a class implements a particular interface. The map is stored per interface and consists of a bitmap with 1 bits for each class that implements the interface. The linker sorts the classes to try and place classes that implement the same interfaces close to each other. The map then takes advantage of this by using a sparse implementation with a simple base and length positioning the actual variable sized bitmap over the part of the class space that contains the required classes.

Author:
andy

Constructor Summary
InterfaceMap(Binary iBinary, ClassRecord crec)
           
 
Method Summary
 void dump(IByteWriter aOut)
          Write the map to the executable file.
 int getFirst()
          Return the index of the first class implementing this interface.
 int getLength()
          return the number of bytes that make up this interface map.
 int getSize()
          Return the number of "live" bits in the map.
 
Methods inherited from class js.tinyvm.WritableDataWithOffset
getOffset, initOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceMap

public InterfaceMap(Binary iBinary,
                    ClassRecord crec)
             throws TinyVMException
Throws:
TinyVMException
Method Detail

getFirst

public int getFirst()
Return the index of the first class implementing this interface.

Returns:
index of the first class entry

getSize

public int getSize()
Return the number of "live" bits in the map. Any class index that is < firstClass or >= firstClass + size is not in the map.

Returns:
number of live bits

getLength

public int getLength()
return the number of bytes that make up this interface map.

Returns:
size in bytes

dump

public void dump(IByteWriter aOut)
          throws TinyVMException
Write the map to the executable file.

Parameters:
aOut - access to the file writer
Throws:
TinyVMException