ClassRecord aClassRec, Binary aBinary, RecordTable<RecordTable<ExceptionRecord>> aExceptionTables,
HashVector<Signature> aSignatures) throws TinyVMException
{
iClassRecord = aClassRec;
iMethod = aEntry;
Code pCodeAttrib = iMethod.getCode();
boolean pNoBody = iMethod.isAbstract() || iMethod.isNative();
assert pCodeAttrib != null || pNoBody: "Check: body is present";
assert pCodeAttrib == null || !pNoBody: "Check: no body is present";
aSignatures.addElement(aSignature);
iSignatureId = aSignatures.indexOf(aSignature);
if (iSignatureId >= TinyVMConstants.MAX_SIGNATURES)
{
throw new TinyVMException(
"The total number of unique signatures exceeds "
+ TinyVMConstants.MAX_SIGNATURES);
}
iNumLocals = pCodeAttrib == null? 0 : pCodeAttrib.getMaxLocals();
if (iNumLocals > TinyVMConstants.MAX_LOCALS)
{
throw new TinyVMException("Method " + aClassRec.getName() + "."
+ iMethod.getName() + " has " + iNumLocals + " local words. Only "
+ TinyVMConstants.MAX_LOCALS + " are allowed.");
}
iNumOperands = pCodeAttrib == null? 0 : pCodeAttrib.getMaxStack();
if (iNumOperands > TinyVMConstants.MAX_OPERANDS)
{
throw new TinyVMException("Method " + aClassRec.getName() + "."
+ iMethod.getName() + " has an operand stack "
+ " whose potential size is " + iNumOperands + ". " + "Only "
+ TinyVMConstants.MAX_OPERANDS + " are allowed.");
}
iNumParameters = getNumParamWords(iMethod);
if (iNumParameters > TinyVMConstants.MAX_PARAMETER_WORDS)
{
throw new TinyVMException("Method " + aClassRec.getName() + "."
+ iMethod.getName() + " has " + iNumParameters
+ " parameter words. Only " + TinyVMConstants.MAX_PARAMETER_WORDS
+ " are allowed.");
}
if (iMethod.isNative() && !aBinary.isSpecialSignature(aSignature))
{
throw new TinyVMException("Method " + aClassRec.getName() + "."
+ iMethod.getName() + " is an unknown native method."
+ " You are probably using JDK APIs"
+ " or libraries that cannot be run under leJOS.");
}
if (pCodeAttrib != null)
{
iExceptionTable = new RecordTable<ExceptionRecord>("exceptions", true, false);
CodeException[] pExcepTable = pCodeAttrib.getExceptionTable();
iNumExceptionHandlers = pExcepTable.length;
if (iNumExceptionHandlers > TinyVMConstants.MAX_EXCEPTION_HANDLERS)
{
throw new TinyVMException("Method " + aClassRec.getName() + "."
+ iMethod.getName() + " has " + iNumExceptionHandlers