* @return MethodSlot
   */
  public static MethodSlot lookupFunction(Symbol functionsymbol) {
    functionsymbol = functionsymbol.softPermanentify();
    { StandardObject function = ((StandardObject)(Stella.$FUNCTION_LOOKUP_TABLE$.lookup(functionsymbol)));

      if ((function != null) &&
          (function.primaryType() == Stella.SGT_STELLA_VECTOR)) {
        { Vector record = ((Vector)(function));
          String definition = ((StringWrapper)((record.theArray)[0])).wrapperValue;
          MethodSlot oldfunction = ((MethodSlot)((record.theArray)[1]));
          String modulename = ((StringWrapper)((record.theArray)[2])).wrapperValue;
          java.lang.reflect.Method code = (((record.theArray)[3] != null) ? ((FunctionCodeWrapper)((record.theArray)[3])).wrapperValue : null);
          java.lang.reflect.Method wrappercode = ((record.length() >= 5) ? ((FunctionCodeWrapper)((record.theArray)[4])).wrapperValue : null);

          Stella.$FUNCTION_LOOKUP_TABLE$.insertAt(functionsymbol, oldfunction);
          { Object old$Module$000 = Stella.$MODULE$.get();
            Object old$Context$000 = Stella.$CONTEXT$.get();

            try {
              Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule(modulename, true));
              Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
              function = Stella.defineMethodFromStringifiedSource(functionsymbol.symbolName, null, definition);

            } finally {
              Stella.$CONTEXT$.set(old$Context$000);
              Stella.$MODULE$.set(old$Module$000);
            }
          }
          if (function != null) {
            if (code != null) {
              ((MethodSlot)(function)).functionCode = code;
            }
            if (wrappercode != null) {
              KeyValueList.setDynamicSlotValue(((MethodSlot)(function)).dynamicSlots, Stella.SYM_STELLA_EVALUATOR_WRAPPER_CODE, FunctionCodeWrapper.wrapFunctionCode(wrappercode), Stella.NULL_FUNCTION_CODE_WRAPPER);
            }
          }
        }
      }
      return (((MethodSlot)(function)));
    }
  }