/* Create a context and set it up. */
CallFrame ctx = new CallFrame();
ctx.tc = tc;
ctx.codeRef = staticCode;
StaticCodeInfo sci = staticCode.staticInfo;
if (sci.oLexicalNames != null)
ctx.oLex = sci.oLexStatic.clone();
if (sci.iLexicalNames != null)
ctx.iLex = new long[sci.iLexicalNames.length];
if (sci.nLexicalNames != null)
ctx.nLex = new double[sci.nLexicalNames.length];
if (sci.sLexicalNames != null)
ctx.sLex = new String[sci.sLexicalNames.length];
/* Set context data read position, and set current read buffer to the correct thing. */
orig.position(contextDataOffset + orig.getInt());
/* Deserialize lexicals. */
long syms = orig.getLong();
for (long j = 0; j < syms; j++) {
String sym = readStr();
Integer idx;
if ((idx = sci.oTryGetLexicalIdx(sym)) != null)
ctx.oLex[idx] = readRef();
else if ((idx = sci.iTryGetLexicalIdx(sym)) != null)
ctx.iLex[idx] = orig.getLong();
else if ((idx = sci.nTryGetLexicalIdx(sym)) != null)
ctx.nLex[idx] = orig.getDouble();
else if ((idx = sci.sTryGetLexicalIdx(sym)) != null)
ctx.sLex[idx] = readStr();
else
throw new RuntimeException("Failed to deserialize lexical " + sym);
}