Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove old bootstrap symbols < 0.20.0 #389

Closed
6 tasks done
timotheecour opened this issue Nov 26, 2020 · 4 comments
Closed
6 tasks done

remove old bootstrap symbols < 0.20.0 #389

timotheecour opened this issue Nov 26, 2020 · 4 comments

Comments

@timotheecour
Copy link
Owner

timotheecour commented Nov 26, 2020

cleanup old bootstrap stuff, eg:

  • when declared(echo)
  • instances with when (NimMajor, NimMinor, NimPatch) < (0, 19, 9):
  • instances w since
  • these:
      if version.startsWith "Nim Compiler Version 0.19.0":
        extraOption.add " -d:nimBoostrapCsources0_19_0"
        # remove this when csources get updated
    # Nim versions < (1, 1) expect Nim's exception type to have a 'raiseId' field for
    # C++ interop. Later Nim versions do this differently and removed the 'raiseId' field.
    # Thus we always bootstrap the first iteration with "c" and not with "cpp" as
    # a workaround.
    let defaultCommand = if useCpp and i > 0: "cpp" else: "c"

example

$nim_0200_X is the nim used for bootstrap (built from csources via sh build_all.sh)
$nim_0200_X -v
Nim Compiler Version 0.20.0 [MacOSX: amd64]

$nim_csources_local_X = $nim_0200_X
$nim_0200_X c -r --skipusercfg --skipparentcfg main
every symbol from condsyms.nim that passes this test can be removed:
$nim_0200_X c -r --skipusercfg --skipparentcfg main

doAssert defined(nimHasNilSeqs)
doAssert defined(nimNoNilSeqs2)
doAssert defined(nimNoNilSeqs)
doAssert defined(nimNewRoof)

nimHasStyleChecks

echo 'echo defined(nimHasStyleChecks)' | $nim_csources_local_X c -r -
false
defined in 0.20.2

note

the only thing that should be kept is the reference in condsyms.nim so that if some user has when defined(nimHasFoo), it'll still work

@ringabout
Copy link
Collaborator

ringabout commented Nov 27, 2020

  • when declared(echo)
  • instances with when (NimMajor, NimMinor, NimPatch) < (0, 19, 9):
  • instances w since
  • cleanup when defined(nimNewRoof): ... else: dead code for old defined symbols

@timotheecour
Copy link
Owner Author

timotheecour commented Nov 27, 2020

instances with when (NimMajor, NimMinor, NimPatch) < (0, 19, 9):

  • only this i guess:
    tests/tuples/tuple_with_nil.nim:15:31: when (NimMajor, NimMinor, NimPatch) > (0, 10, 2):
    (EDIT: done)

@timotheecour
Copy link
Owner Author

timotheecour commented Dec 3, 2020

this snippet gives an idea of how many times each condsym symbol is used:

# D20201203T131231
import std/[strformat,os,osproc,strutils,parseutils,sugar]
import pkg/regex
proc main() =
  let s = readFile("compiler/condsyms.nim")
  let a = collect(newSeq):
    for m in findAll(s, re"""defineSymbol\(\"(?P<name>\w+)\"\)"""):
      m.group(0, s)[0]
  echo a
  var tot = 0
  for ai in a:
    if ai == "nimnode": continue # skip special case otherwise matches NimNode etc
    let cmd = fmt"rg -i {ai} . | wc -l"
    var (outp, code) = execCmdEx(cmd)
    doAssert code == 0
    let num = outp.strip.parseInt
    tot += num
    echo (ai, num)
  echo (a.len, tot)
main()

results:

("nimhygiene", 9)
("niminheritable", 2)
("nimmixin", 1)
("nimeffects", 1)
("nimbabel", 2)
("nimcomputedgoto", 2)
("nimunion", 2)
("nimnewshared", 2)
("nimNewTypedesc", 2)
("nimrequiresnimframe", 1)
("nimparsebiggestfloatmagic", 1)
("nimalias", 1)
("nimlocks", 2)
("nimvarargstyped", 2)
("nimtypedescfixed", 2)
("nimKnowsNimvm", 1)
("nimArrIdx", 2)
("nimHasalignOf", 3)
("nimDistros", 1)
("nimHasCppDefine", 2)
("nimGenericInOutFlags", 1)
("nimHasOpt", 1)
("nimNoArrayToCstringConversion", 8)
("nimNewRoof", 3)
("nimHasRunnableExamples", 2)
("nimNewDot", 2)
("nimHasNilChecks", 2)
("nimSymKind", 7)
("nimVmEqIdent", 2)
("nimNoNil", 31)
("nimNoZeroTerminator", 2)
("nimNotNil", 1)
("nimVmExportFixed", 2)
("nimHasSymOwnerInMacro", 2)
("nimNewRuntime", 2)
("nimIncrSeqV3", 7)
("nimAshr", 3)
("nimNoNilSeqs", 28)
("nimNoNilSeqs2", 3)
("nimHasUserErrors", 2)
("nimUncheckedArrayTyp", 2)
("nimHasTypeof", 4)
("nimErrorProcCanHaveBody", 2)
("nimHasInstantiationOfInMacro", 2)
("nimHasHotCodeReloading", 4)
("nimHasNilSeqs", 1)
("nimHasSignatureHashInMacro", 2)
("nimHasDefault", 3)
("nimMacrosSizealignof", 2)
("nimNoZeroExtendMagic", 3)
("nimMacrosGetNodeId", 2)
("nimFixedOwned", 2)
("nimHasStyleChecks", 38)
("nimToOpenArrayCString", 6)
("nimHasUsed", 4)
("nimFixedForwardGeneric", 2)
("nimnomagic64", 1)
("nimNewShiftOps", 1)
("nimHasCursor", 2)
("nimAlignPragma", 3)
("nimHasExceptionsQuery", 2)
("nimHasIsNamedTuple", 2)
("nimHashOrdinalFixed", 2)
("nimHasLibFFIEnabled", 1)
("nimHasSinkInference", 8)
("nimNewIntegerOps", 2)
("nimHasInvariant", 5)
("nimHasStacktraceMsgs", 2)
("nimDoesntTrackDefects", 4)
("nimHasLentIterators", 2)
("nimHasDeclaredMagic", 3)
("nimHasStacktracesModule", 1)
("nimHasEffectTraitsModule", 2)
("nimHasCastPragmaBlocks", 1)
("nimHasDeclaredLocs", 1)
(76, 276)

@timotheecour
Copy link
Owner Author

timotheecour commented Dec 10, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants