def METHOD_NAME(vw):
    flist = vw.getFunctions()
    tried = set()
    while True:
        docode = []
        bcode = []
        vatodo = set([va for va, name in vw.getNames() if vw.getLocation(va) is None and va not in tried])
        vatodo = vatodo.union([tova for _, tova, _, _ in vw.getXrefs(rtype=REF_PTR) if vw.getLocation(tova) is None and tova not in tried])
        for va in vatodo:
            loc = vw.getLocation(va)
            if loc is not None:
                if loc[L_LTYPE] == LOC_STRING:
                    vw.makeString(va)
                    tried.add(va)
                elif loc[L_LTYPE] == LOC_UNI:
                    vw.makeUnicode(va)
                    tried.add(va)
                continue
            if vw.isDeadData(va):
                continue
            # Skip it if we've tried it already.
            if va in tried:
                continue
            tried.add(va)
            # if it's not exectuable, check to see if it's at least readable, in which case
            # we can check for other location types
            # otherwise, try emulating it to see if it feels like code
            if not vw.isExecutable(va):
                if not vw.isReadable(va):
                    continue
                if vw.isProbablyUnicode(va):
                    vw.makeUnicode(va)
                elif vw.isProbablyString(va):
                    vw.makeString(va)
            else:
                emu = vw.getEmulator(va=va)
                wat = watcher(vw, va)
                emu.setEmulationMonitor(wat)
                try:
                    emu.runFunction(va, maxhit=1)
                except Exception:
                    continue
                if wat.looksgood():
                    docode.append(va)
                # flag to tell us to be greedy w/ finding code
                # XXX - visi is going to hate this..
                elif wat.iscode() and vw.greedycode:
                    bcode.append(va)
                else:
                    if vw.isProbablyUnicode(va):
                        vw.makeUnicode(va)
                    elif vw.isProbablyString(va):
                        vw.makeString(va)
                    else:
                        # if we get all the way down here, and it has a name, it's gotta be *something*
                        if vw.getName(va):
                            try:
                                vw.makePointer(va)
                            except Exception as e:
                                logger.warning('Emucode failed to make 0x.8%x due to %s', va, str(e))
                                continue
        if len(docode) == 0:
            break
        docode.sort()
        for va in docode:
            if vw.getLocation(va) is not None:
                continue
            try:
                logger.debug('discovered new function: 0x%x', va)
                vw.makeFunction(va)
            except:
                continue
        bcode.sort()
        for va in bcode:
            if vw.getLocation(va) is not None:
                continue
            # TODO: consider elevating to functions?
            vw.makeCode(va)
    dlist = vw.getFunctions()
    newfuncs = set(dlist) - set(flist)
    for fva in newfuncs:
        vw.setVaSetRow('EmucodeFunctions', (fva,))
    vw.vprint("emucode: %d new functions defined (now total: %d)" % (len(dlist)-len(flist), len(dlist)))