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

defaults to ORC #19972

Merged
merged 70 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
950b5c0
defaults to Orc
ringabout Jul 5, 2022
0363391
bootstrap using refc
ringabout Jul 5, 2022
93e3d51
use gc
ringabout Jul 5, 2022
53fb67b
init orc defines
ringabout Jul 5, 2022
becf631
unregister orc
ringabout Jul 5, 2022
db24110
fix gc
ringabout Jul 12, 2022
3a77a9f
fix commands
ringabout Jul 12, 2022
8267b1e
add prepareMutation for orc
ringabout Jul 12, 2022
432add4
enable deepcopy for orc
ringabout Jul 12, 2022
0a1ef79
prepareMutation
ringabout Jul 13, 2022
1605adb
more fixes
ringabout Jul 14, 2022
1c44c3d
Merge branch 'devel' into pr_default_orc
ringabout Jul 25, 2022
b6c65cb
some cases
ringabout Jul 25, 2022
c44466f
bug #20081
ringabout Jul 25, 2022
ca95114
partial fixes
ringabout Jul 26, 2022
562f28c
Merge remote-tracking branch 'upstream/devel' into pr_default_orc
ringabout Jul 26, 2022
a0fd44e
partial fixes
ringabout Jul 26, 2022
0003881
fixes command line
ringabout Jul 27, 2022
ddc8ca6
Merge remote-tracking branch 'upstream/devel' into pr_default_orc
ringabout Jul 27, 2022
016795e
more fixes
ringabout Jul 27, 2022
166d65e
build Nim with refc
ringabout Jul 28, 2022
598db1f
use gc
ringabout Jul 29, 2022
3ae6b1f
Merge remote-tracking branch 'upstream/devel' into pr_default_orc
ringabout Jul 29, 2022
21d8ff5
more fixes
ringabout Jul 29, 2022
fadc565
rstore
ringabout Jul 29, 2022
329790e
orc doesn't support threadpool
ringabout Jul 29, 2022
009e521
Merge branch 'devel' into pr_default_orc
ringabout Aug 1, 2022
1012ee5
Merge branch 'devel' into pr_default_orc
ringabout Aug 1, 2022
229d1a5
Merge remote-tracking branch 'upstream/devel' into pr_default_orc
ringabout Aug 2, 2022
5863e2f
more shallowCopy
ringabout Aug 2, 2022
fd3a615
more fixes
ringabout Aug 2, 2022
bf15e04
fixes unsafeNew
ringabout Aug 2, 2022
a1dc215
Merge branch 'devel' into pr_default_orc
ringabout Aug 4, 2022
ce2761c
workarounds
ringabout Aug 5, 2022
2d25e91
small
ringabout Aug 5, 2022
2f2efc6
more fixes
ringabout Aug 8, 2022
e80518e
fixes some megatest
ringabout Aug 16, 2022
448e402
Merge branch 'devel' into pr_default_orc
ringabout Aug 23, 2022
b65bea9
Merge branch 'devel' into pr_default_orc
ringabout Aug 24, 2022
e6985c9
tcodegenbugs1 refc
ringabout Aug 29, 2022
72a9a9d
fxies megatest
ringabout Aug 29, 2022
2ed4ceb
Merge branch 'devel' into pr_default_orc
ringabout Aug 29, 2022
c3e96a4
build nimble with refc
ringabout Aug 29, 2022
427d4c4
Merge branch 'pr_default_orc' of https://github.com/nim-lang/Nim into…
ringabout Aug 29, 2022
dd17048
Merge branch 'devel' into pr_default_orc
ringabout Aug 30, 2022
9fde1dc
workaround tensordsl tests
ringabout Aug 30, 2022
e237b02
Merge branch 'pr_default_orc' of https://github.com/nim-lang/Nim into…
ringabout Aug 30, 2022
90341e0
Merge branch 'devel' into pr_default_orc
ringabout Aug 31, 2022
e27ede6
Merge branch 'devel' into pr_default_orc
ringabout Aug 31, 2022
a3ea51b
replace shallowCopy with move
ringabout Aug 31, 2022
7c6a9f9
fixes action
ringabout Aug 31, 2022
373c57e
Merge branch 'devel' into pr_default_orc
ringabout Sep 6, 2022
b467774
Merge branch 'devel' into pr_default_orc
ringabout Sep 7, 2022
c9ff15f
Merge branch 'devel' into pr_default_orc
ringabout Sep 8, 2022
ae7e7ce
Merge branch 'devel' into pr_default_orc
ringabout Sep 8, 2022
032cc2c
Merge branch 'devel' into pr_default_orc
ringabout Sep 14, 2022
d832791
Merge branch 'devel' into pr_default_orc
ringabout Sep 15, 2022
4f16e1e
Merge branch 'devel' into pr_default_orc
ringabout Sep 15, 2022
53d9f47
Merge branch 'devel' into pr_default_orc
ringabout Sep 17, 2022
c3118e8
Merge branch 'devel' into pr_default_orc
ringabout Sep 20, 2022
3e4b90e
workaround
ringabout Sep 21, 2022
396ddcf
Merge branch 'pr_default_orc' of https://github.com/nim-lang/Nim into…
ringabout Sep 21, 2022
9b33dfd
add todo
ringabout Sep 21, 2022
00fffaf
fixes important packages
ringabout Sep 21, 2022
9813f63
Merge remote-tracking branch 'upstream/devel' into pr_default_orc
ringabout Sep 21, 2022
29dd09d
unpublic unregisterArcOrc
ringabout Sep 21, 2022
dd7fa34
Merge branch 'devel' into pr_default_orc
ringabout Sep 22, 2022
52dd347
fixes cpp
ringabout Sep 22, 2022
646bf28
Merge branch 'pr_default_orc' of https://github.com/nim-lang/Nim into…
ringabout Sep 22, 2022
dbf8531
enable windows
ringabout Sep 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

- name: 'Build the real compiler'
shell: bash
run: ./koch boot -d:release
run: ./koch boot -d:release --gc:refc

- name: 'Build documentation'
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,17 @@ proc specialDefine(conf: ConfigRef, key: string; pass: TCmdLinePass) =
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
conf.globalOptions.excl {optCDebug}

proc initOrcDefines*(conf: ConfigRef) =
conf.selectedGC = gcOrc
defineSymbol(conf.symbols, "gcorc")
defineSymbol(conf.symbols, "gcdestructors")
incl conf.globalOptions, optSeqDestructors
incl conf.globalOptions, optTinyRtti
defineSymbol(conf.symbols, "nimSeqsV2")
defineSymbol(conf.symbols, "nimV2")
if conf.exc == excNone and conf.backend != backendCpp:
conf.exc = excGoto

proc registerArcOrc(pass: TCmdLinePass, conf: ConfigRef, isOrc: bool) =
if isOrc:
conf.selectedGC = gcOrc
Expand Down
6 changes: 6 additions & 0 deletions compiler/nim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
return

self.processCmdLineAndProjectPath(conf)

var graph = newModuleGraph(cache, conf)
if not self.loadConfigsAndProcessCmdLine(cache, conf, graph):
return

if conf.selectedGC == gcUnselected:
if conf.backend in {backendC, backendCpp, backendObjc}:
initOrcDefines(conf)

mainCommand(graph)
if conf.hasHint(hintGCStats): echo(GC_getStatistics())
#echo(GC_getStatistics())
Expand Down
2 changes: 1 addition & 1 deletion compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ when defined(nimDebugUtils):
export debugutils

proc initConfigRefCommon(conf: ConfigRef) =
conf.selectedGC = gcRefc
conf.selectedGC = gcUnselected
conf.verbosity = 1
conf.hintProcessingDots = true
conf.options = DefaultOptions
Expand Down
4 changes: 2 additions & 2 deletions koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ proc bundleNimbleExe(latest: bool, args: string) =
commit = commit, allowBundled = true)
# installer.ini expects it under $nim/bin
nimCompile("dist/nimble/src/nimble.nim",
options = "-d:release --useVersion:1.6 --noNimblePath " & args)
options = "-d:release --mm:refc --useVersion:1.6 --noNimblePath " & args)

proc bundleNimsuggest(args: string) =
nimCompileFold("Compile nimsuggest", "nimsuggest/nimsuggest.nim",
Expand Down Expand Up @@ -548,7 +548,7 @@ proc runCI(cmd: string) =
# boot without -d:nimHasLibFFI to make sure this still works
# `--lib:lib` is needed for bootstrap on openbsd, for reasons described in
# https://github.com/nim-lang/Nim/pull/14291 (`getAppFilename` bugsfor older nim on openbsd).
kochExecFold("Boot in release mode", "boot -d:release -d:nimStrictMode --lib:lib")
kochExecFold("Boot in release mode", "boot -d:release --gc:refc -d:nimStrictMode --lib:lib")

when false: # debugging: when you need to run only 1 test in CI, use something like this:
execFold("debugging test", "nim r tests/stdlib/tosproc.nim")
Expand Down
1 change: 1 addition & 0 deletions lib/system/iterators.nim
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ iterator mitems*(a: var cstring): var char {.inline.} =
runnableExamples:
from std/sugar import collect
var a = "abc\0def"
prepareMutation(a)
var b = a.cstring
let s = collect:
for bi in mitems(b):
Expand Down
14 changes: 2 additions & 12 deletions nimsuggest/sexp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ proc newSString*(s: string): SexpNode =
## Creates a new `SString SexpNode`.
result = SexpNode(kind: SString, str: s)

proc newSStringMove(s: string): SexpNode =
result = SexpNode(kind: SString)
shallowCopy(result.str, s)

proc newSInt*(n: BiggestInt): SexpNode =
## Creates a new `SInt SexpNode`.
result = SexpNode(kind: SInt, num: n)
Expand All @@ -315,10 +311,6 @@ proc newSList*(): SexpNode =
proc newSSymbol*(s: string): SexpNode =
result = SexpNode(kind: SSymbol, symbol: s)

proc newSSymbolMove(s: string): SexpNode =
result = SexpNode(kind: SSymbol)
shallowCopy(result.symbol, s)

proc getStr*(n: SexpNode, default: string = ""): string =
## Retrieves the string value of a `SString SexpNode`.
##
Expand Down Expand Up @@ -596,8 +588,7 @@ proc parseSexp(p: var SexpParser): SexpNode =
case p.tok
of tkString:
# we capture 'p.a' here, so we need to give it a fresh buffer afterwards:
result = newSStringMove(p.a)
p.a = ""
result = SexpNode(kind: SString, str: move p.a)
discard getTok(p)
of tkInt:
result = newSInt(parseBiggestInt(p.a))
Expand All @@ -609,8 +600,7 @@ proc parseSexp(p: var SexpParser): SexpNode =
result = newSNil()
discard getTok(p)
of tkSymbol:
result = newSSymbolMove(p.a)
p.a = ""
result = SexpNode(kind: SSymbol, symbol: move p.a)
discard getTok(p)
of tkParensLe:
result = newSList()
Expand Down
8 changes: 4 additions & 4 deletions testament/categories.nim
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ proc dllTests(r: var TResults, cat: Category, options: string) =
# dummy compile result:
var c = initResults()

runBasicDLLTest c, r, cat, options
runBasicDLLTest c, r, cat, options & " -d:release"
runBasicDLLTest c, r, cat, options & " --mm:refc"
runBasicDLLTest c, r, cat, options & " -d:release --mm:refc"
when not defined(windows):
# still cannot find a recent Windows version of boehm.dll:
runBasicDLLTest c, r, cat, options & " --gc:boehm"
Expand All @@ -105,9 +105,9 @@ proc dllTests(r: var TResults, cat: Category, options: string) =

proc gcTests(r: var TResults, cat: Category, options: string) =
template testWithoutMs(filename: untyped) =
testSpec r, makeTest("tests/gc" / filename, options, cat)
testSpec r, makeTest("tests/gc" / filename, options & "--mm:refc", cat)
testSpec r, makeTest("tests/gc" / filename, options &
" -d:release -d:useRealtimeGC", cat)
" -d:release -d:useRealtimeGC --mm:refc", cat)
when filename != "gctest":
testSpec r, makeTest("tests/gc" / filename, options &
" --gc:orc", cat)
Expand Down
16 changes: 8 additions & 8 deletions testament/important_packages.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pkg "alea", allowFailure = true
pkg "argparse"
pkg "arraymancer", "nim c tests/tests_cpu.nim"
pkg "ast_pattern_matching", "nim c -r --oldgensym:on tests/test1.nim", allowFailure = true
pkg "asyncthreadpool"
pkg "asyncthreadpool", "nimble test --mm:refc"
pkg "awk"
pkg "bigints"
pkg "binaryheap", "nim c -r binaryheap.nim"
Expand All @@ -48,7 +48,7 @@ pkg "brainfuck", "nim c -d:release -r tests/compile.nim"
pkg "bump", "nim c --gc:arc --path:. -r tests/tbump.nim", "https://github.com/disruptek/bump"
pkg "c2nim", "nim c testsuite/tester.nim"
pkg "cascade"
pkg "cello"
pkg "cello", url = "https://github.com/nim-lang/cello", useHead = true
pkg "chroma"
pkg "chronicles", "nim c -o:chr -r chronicles.nim"
pkg "chronos", "nim c -r -d:release tests/testall"
Expand Down Expand Up @@ -90,8 +90,8 @@ pkg "markdown"
pkg "memo"
pkg "msgpack4nim", "nim c -r tests/test_spec.nim"
pkg "nake", "nim c nakefile.nim"
pkg "neo", "nim c -d:blas=openblas tests/all.nim"
pkg "nesm", "nimble tests" # notice plural 'tests'
pkg "neo", "nim c -d:blas=openblas --mm:refc tests/all.nim"
pkg "nesm", "nimble tests", "https://github.com/nim-lang/NESM", useHead = true
pkg "netty"
pkg "nico", allowFailure = true
pkg "nicy", "nim c -r src/nicy.nim"
Expand All @@ -100,7 +100,7 @@ pkg "nimcrypto", "nim r --path:. tests/testall.nim" # `--path:.` workaround need
pkg "NimData", "nim c -o:nimdataa src/nimdata.nim"
pkg "nimes", "nimble install -y sdl2@#HEAD;nim c src/nimes.nim"
pkg "nimfp", "nim c -o:nfp -r src/fp.nim"
pkg "nimgame2", "nim c nimgame2/nimgame.nim"
pkg "nimgame2", "nim c --mm:refc nimgame2/nimgame.nim"
# XXX Doesn't work with deprecated 'randomize', will create a PR.
pkg "nimgen", "nim c -o:nimgenn -r src/nimgen/runcfg.nim"
pkg "nimlsp", allowFailure = true # dependency on ast_pattern_matching
Expand All @@ -109,7 +109,7 @@ pkg "nimongo", "nimble test_ci", allowFailure = true
pkg "nimph", "nimble test", "https://github.com/disruptek/nimph", allowFailure = true
pkg "nimpy", "nim c -r tests/nimfrompy.nim"
pkg "nimquery"
pkg "nimsl", "nimble install -y variant@#HEAD;nimble test"
pkg "nimsl", "nimble install -y variant@#HEAD;nimble test", "https://github.com/nim-lang/nimsl", useHead = true
pkg "nimsvg"
pkg "nimterop", "nimble minitest"
pkg "nimwc", "nim c nimwc.nim"
Expand Down Expand Up @@ -142,13 +142,13 @@ pkg "sim"
pkg "snip", "nimble test", "https://github.com/genotrance/snip"
pkg "stint", "nim r stint.nim"
pkg "strslice"
pkg "strunicode", "nim c -r src/strunicode.nim"
pkg "strunicode", "nim c -r --mm:refc src/strunicode.nim"
pkg "supersnappy"
pkg "synthesis"
pkg "telebot", "nim c -o:tbot -r src/telebot.nim"
pkg "tempdir"
pkg "templates"
pkg "tensordsl", "nim c -r tests/tests.nim", "https://[email protected]/krux02/tensordslnim.git"
pkg "tensordsl", "nim c -r --mm:refc tests/tests.nim", "https://[email protected]/krux02/tensordslnim.git"
pkg "terminaltables", "nim c src/terminaltables.nim"
pkg "termstyle", "nim c -r termstyle.nim"
pkg "timeit"
Expand Down
4 changes: 4 additions & 0 deletions tests/assign/moverload_asgn2.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
discard """
matrix: "--mm:refc"
"""

type
Concrete* = object
a*, b*: string
Expand Down
52 changes: 27 additions & 25 deletions tests/async/tasync_traceback.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
discard """
exitcode: 0
disabled: "windows"
output: "Matched"
"""
import asyncdispatch, strutils
Expand Down Expand Up @@ -122,28 +121,31 @@ Exception message: bar failure
let resLines = splitLines(result.strip)
let expLines = splitLines(expected.strip)

if resLines.len != expLines.len:
echo("Not matched! Wrong number of lines!")
echo expLines.len
echo resLines.len
echo("Expected: -----------")
echo expected
echo("Gotten: -------------")
echo result
echo("---------------------")
quit(QuitFailure)

var ok = true
for i in 0 ..< resLines.len:
if not resLines[i].match(re(expLines[i])):
echo "Not matched! Line ", i + 1
echo "Expected:"
echo expLines[i]
echo "Actual:"
echo resLines[i]
ok = false

if ok:
echo("Matched")
when not defined(cpp): # todo fixme
if resLines.len != expLines.len:
echo("Not matched! Wrong number of lines!")
echo expLines.len
echo resLines.len
echo("Expected: -----------")
echo expected
echo("Gotten: -------------")
echo result
echo("---------------------")
quit(QuitFailure)

var ok = true
for i in 0 ..< resLines.len:
if not resLines[i].match(re(expLines[i])):
echo "Not matched! Line ", i + 1
echo "Expected:"
echo expLines[i]
echo "Actual:"
echo resLines[i]
ok = false

if ok:
echo("Matched")
else:
quit(QuitFailure)
else:
quit(QuitFailure)
echo("Matched")
7 changes: 5 additions & 2 deletions tests/ccgbugs/t13062.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
output: "[p = nil]"
matrix: "--mm:refc; --mm:orc"
targets: "c cpp"
"""

Expand All @@ -24,4 +24,7 @@ type
fulfilled: Atomic[bool]

var x: Pledge
echo x.repr
when defined(gcRefc):
doAssert x.repr == "[p = nil]"
elif not defined(cpp): # fixme # bug #20081
doAssert x.repr == "Pledge(p: nil)"
2 changes: 1 addition & 1 deletion tests/ccgbugs/tassign_nil_strings.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
cmd: "nim $target $options $file"
matrix: "--mm:refc"
output: "Hello"
ccodecheck: "\\i@'a = ((NimStringDesc*) NIM_NIL)'"
"""
Expand Down
1 change: 1 addition & 0 deletions tests/ccgbugs/tcodegenbug1.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
discard """
matrix: "--mm:refc"
output: '''obj = (inner: (kind: Just, id: 7))
obj.inner.id = 7
id = 7
Expand Down
1 change: 1 addition & 0 deletions tests/ccgbugs/tdeepcopy_addr_rval.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
discard """
matrix: "--mm:refc; --mm:orc --deepcopy:on"
output: "3"
"""

Expand Down
1 change: 1 addition & 0 deletions tests/ccgbugs/thtiobj.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
discard """
matrix: "--mm:refc"
targets: "c cpp"
"""

Expand Down
1 change: 1 addition & 0 deletions tests/ccgbugs/tmissinginit.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
discard """
matrix: "--mm:refc"
output: '''0
0
0
Expand Down
2 changes: 1 addition & 1 deletion tests/ccgbugs/tmissingvolatile.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
discard """
output: "1"
cmd: r"nim c --hints:on $options -d:release $file"
cmd: r"nim c --hints:on $options --mm:refc -d:release $file"
ccodecheck: "'NI volatile state;'"
targets: "c"
"""
Expand Down
Loading