diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1e46e05448..52b2d80b44 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,6 +10,16 @@ body: Please provide a minimal code example that reproduces the bug if possible. Reports with a reproducible example or detailed information will likely receive fixes faster. +- type: textarea + id: nim-version + attributes: + label: Nim Version + description: | + Can be obtained from `nim -v` on the command line along with the OS/architecture. + For development versions, including the commit hash may help. + validations: + required: true + - type: textarea id: description attributes: @@ -19,16 +29,6 @@ body: placeholder: Bug reports with reproducible code or detailed information will be fixed faster. validations: required: true - -- type: textarea - id: nim-version - attributes: - label: Nim Version - description: | - Can be obtained from `nim -v` on the command line along with the OS/architecture. - For development versions, make sure to include the commit hash. - validations: - required: true - type: textarea id: current-logs diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 7d754bfedd..8461fb5432 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -41,7 +41,7 @@ jobs: target: [linux, windows, osx] include: - target: linux - os: ubuntu-20.04 + os: ubuntu-22.04 - target: windows os: windows-2019 - target: osx diff --git a/.github/workflows/ci_packages.yml b/.github/workflows/ci_packages.yml index 7dcfdd418a..fec634966b 100644 --- a/.github/workflows/ci_packages.yml +++ b/.github/workflows/ci_packages.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-22.04, macos-13] cpu: [amd64] batch: ["allowed_failures", "0_3", "1_3", "2_3"] # list of `index_num` name: '${{ matrix.os }} (batch: ${{ matrix.batch }})' diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index decfe953ec..39fae32fea 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-22.04] cpu: [amd64] name: '${{ matrix.os }}' runs-on: ${{ matrix.os }} @@ -21,10 +21,10 @@ jobs: with: fetch-depth: 2 - - name: 'Install node.js 20.x' + - name: 'Install node.js' uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version: '' - name: 'Install dependencies (Linux amd64)' if: runner.os == 'Linux' && matrix.cpu == 'amd64' @@ -34,17 +34,6 @@ jobs: sudo apt-fast install --no-install-recommends -yq \ libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev \ valgrind libc6-dbg libblas-dev xorg-dev - - name: 'Install dependencies (macOS)' - if: runner.os == 'macOS' - run: brew install boehmgc make sfml gtk+3 - - name: 'Install dependencies (Windows)' - if: runner.os == 'Windows' - shell: bash - run: | - set -e - . ci/funs.sh - nimInternalInstallDepsWindows - echo_run echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}" - name: 'Add build binaries to PATH' shell: bash diff --git a/changelogs/changelog_1_2_0.md b/changelogs/changelog_1_2_0.md index 1f76df0b49..11390fee17 100644 --- a/changelogs/changelog_1_2_0.md +++ b/changelogs/changelog_1_2_0.md @@ -169,7 +169,7 @@ echo f - The Nim compiler now supports a new pragma called ``.localPassc`` to pass specific compiler options to the C(++) backend for the C(++) file that was produced from the current Nim module. -- The compiler now inferes "sink parameters". To disable this for a specific routine, +- The compiler now infers "sink parameters". To disable this for a specific routine, annotate it with `.nosinks`. To disable it for a section of code, use `{.push sinkInference: off.}`...`{.pop.}`. - The compiler now supports a new switch `--panics:on` that turns runtime @@ -261,7 +261,7 @@ echo f ([#12812](https://github.com/nim-lang/Nim/issues/12812)) - Fixed "Produce static/const initializations for variables when possible" ([#12216](https://github.com/nim-lang/Nim/issues/12216)) -- Fixed "Assigning descriminator field leads to internal assert with --gc:destructors" +- Fixed "Assigning discriminator field leads to internal assert with --gc:destructors" ([#12821](https://github.com/nim-lang/Nim/issues/12821)) - Fixed "nimsuggest `use` command does not return all instances of symbol" ([#12832](https://github.com/nim-lang/Nim/issues/12832)) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 2d4a46412c..fdd8553a3e 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2198,6 +2198,13 @@ proc genArrayLen(p: BProc, e: PNode, d: var TLoc, op: TMagic) = else: putIntoDest(p, d, e, cIntValue(lengthOrd(p.config, typ))) else: internalError(p.config, e.info, "genArrayLen()") +proc isTrivialTypesToSnippet(t: PType): Snippet = + if containsGarbageCollectedRef(t) or + hasDestructor(t): + result = NimFalse + else: + result = NimTrue + proc genSetLengthSeq(p: BProc, e: PNode, d: var TLoc) = if optSeqDestructors in p.config.globalOptions: e[1] = makeAddr(e[1], p.module.idgen) @@ -2220,7 +2227,8 @@ proc genSetLengthSeq(p: BProc, e: PNode, d: var TLoc) = pExpr = cIfExpr(ra, cAddr(derefField(ra, "Sup")), NimNil) else: pExpr = ra - call.snippet = cCast(rt, cgCall(p, "setLengthSeqV2", pExpr, rti, rb)) + call.snippet = cCast(rt, cgCall(p, "setLengthSeqV2", pExpr, rti, rb, + isTrivialTypesToSnippet(t.skipTypes(abstractInst)[0]))) genAssignment(p, a, call, {}) gcUsage(p.config, e) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index b3e03f5749..a49ea802ac 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -57,11 +57,15 @@ proc mangleField(m: BModule; name: PIdent): string = proc mangleProc(m: BModule; s: PSym; makeUnique: bool): string = result = "_Z" # Common prefix in Itanium ABI - result.add encodeSym(m, s, makeUnique) + var params = "" + var staticLists = "" if s.typ.len > 1: #we dont care about the return param for i in 1.. conf.target.floatSize*3) or (optByRef in s.options) + if s.typ.kind == tySink: + # it's a sink, so we pass it by value + result = false + else: + result = (getSize(conf, pt) > conf.target.floatSize*3) or (optByRef in s.options) else: result = false # first parameter and return type is 'lent T'? --> use pass by pointer @@ -120,14 +124,14 @@ proc makeUnique(m: BModule; s: PSym, name: string = ""): string = result.add "_u" result.add $s.itemId.item -proc encodeSym*(m: BModule; s: PSym; makeUnique: bool = false): string = +proc encodeSym*(m: BModule; s: PSym; makeUnique: bool = false; extra: string = ""): string = #Module::Type - var name = s.name.s + var name = s.name.s & extra if makeUnique: name = makeUnique(m, s, name) "N" & encodeName(s.skipGenericOwner.name.s) & encodeName(name) & "E" -proc encodeType*(m: BModule; t: PType): string = +proc encodeType*(m: BModule; t: PType; staticLists: var string): string = result = "" var kindName = ($t.kind)[2..^1] kindName[0] = toLower($kindName[0])[0] @@ -138,10 +142,10 @@ proc encodeType*(m: BModule; t: PType): string = result = encodeName(t[0].sym.name.s) result.add "I" for i in 1..