nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.59k stars 1.47k forks source link

Regression - cannot instantiate Maybe generic arguments are missing #23853

Closed mratsim closed 3 months ago

mratsim commented 3 months ago

Here is a regression between Nim 2.0.4 and Nim 2.0.6 that also affects devel and Nim v2.2.0 RC1

import std/macros

type
  Algebra* = enum
    BN254_Snarks
    BLS12_381

  Fp*[Name: static Algebra] = object
    limbs*: array[4, uint64]

  QuadraticExt*[F] = object
    ## Quadratic Extension field
    coords*: array[2, F]

  CubicExt*[F] = object
    ## Cubic Extension field
    coords*: array[3, F]

  ExtensionField*[F] = QuadraticExt[F] or CubicExt[F]

  Fp2*[Name: static Algebra] =
    QuadraticExt[Fp[Name]]

  Fp4*[Name: static Algebra] =
    QuadraticExt[Fp2[Name]]

  Fp6*[Name: static Algebra] =
    CubicExt[Fp2[Name]]

  Fp12*[Name: static Algebra] =
    CubicExt[Fp4[Name]]
    # QuadraticExt[Fp6[Name]]

template Name*(E: type ExtensionField): Algebra =
  E.F.Name

const BLS12_381_Order = [uint64 0x1, 0x2, 0x3, 0x4]
const BLS12_381_Modulus = [uint64 0x5, 0x6, 0x7, 0x8]

{.experimental: "dynamicBindSym".}

macro baseFieldModulus*(Name: static Algebra): untyped =
  result = bindSym($Name & "_Modulus")

macro scalarFieldModulus*(Name: static Algebra): untyped =
  result = bindSym($Name & "_Order")

type FieldKind* = enum
  kBaseField
  kScalarField

template getBigInt*(Name: static Algebra, kind: static FieldKind): untyped =
  # Workaround:
  # in `ptr UncheckedArray[BigInt[EC.getScalarField().bits()]]
  # EC.getScalarField is not accepted by the compiler
  #
  # and `ptr UncheckedArray[BigInt[Fr[EC.F.Name].bits]]` gets undeclared field: 'Name'
  #
  # but `ptr UncheckedArray[getBigInt(EC.getName(), kScalarField)]` works fine
  when kind == kBaseField:
    Name.baseFieldModulus().typeof()
  else:
    Name.scalarFieldModulus().typeof()

# ------------------------------------------------------------------------------

type BenchMultiexpContext*[GT] = object
  elems: seq[GT]
  exponents: seq[getBigInt(GT.Name, kScalarField)]

proc createBenchMultiExpContext*(GT: typedesc, inputSizes: openArray[int]): BenchMultiexpContext[GT] =
  discard

# ------------------------------------------------------------------------------

proc main() =
  let ctx = createBenchMultiExpContext(Fp12[BLS12_381], [2, 4, 8, 16])

main()

This compiles on Nim 2.0.4 but not on Nim 2.0.6 or later, error is Error: cannot instantiate: 'ExtensionField[F]'; Maybe generic arguments are missing?

The issue comes from the usage of the getBigInt template in an object. However, I tried 2 other approaches and couldn't make them work for type parameter in functions.

juancarlospaco commented 3 months ago

!nim c

import std/macros

type
  Algebra* = enum
    BN254_Snarks
    BLS12_381

  Fp*[Name: static Algebra] = object
    limbs*: array[4, uint64]

  QuadraticExt*[F] = object
    ## Quadratic Extension field
    coords*: array[2, F]

  CubicExt*[F] = object
    ## Cubic Extension field
    coords*: array[3, F]

  ExtensionField*[F] = QuadraticExt[F] or CubicExt[F]

  Fp2*[Name: static Algebra] =
    QuadraticExt[Fp[Name]]

  Fp4*[Name: static Algebra] =
    QuadraticExt[Fp2[Name]]

  Fp6*[Name: static Algebra] =
    CubicExt[Fp2[Name]]

  Fp12*[Name: static Algebra] =
    CubicExt[Fp4[Name]]
    # QuadraticExt[Fp6[Name]]

template Name*(E: type ExtensionField): Algebra =
  E.F.Name

const BLS12_381_Order = [uint64 0x1, 0x2, 0x3, 0x4]
const BLS12_381_Modulus = [uint64 0x5, 0x6, 0x7, 0x8]

{.experimental: "dynamicBindSym".}

macro baseFieldModulus*(Name: static Algebra): untyped =
  result = bindSym($Name & "_Modulus")

macro scalarFieldModulus*(Name: static Algebra): untyped =
  result = bindSym($Name & "_Order")

type FieldKind* = enum
  kBaseField
  kScalarField

template getBigInt*(Name: static Algebra, kind: static FieldKind): untyped =
  when kind == kBaseField:
    Name.baseFieldModulus().typeof()
  else:
    Name.scalarFieldModulus().typeof()

type BenchMultiexpContext*[GT] = object
  elems: seq[GT]
  exponents: seq[getBigInt(GT.Name, kScalarField)]

proc createBenchMultiExpContext*(GT: typedesc, inputSizes: openArray[int]): BenchMultiexpContext[GT] =
  discard

proc main() =
  let ctx = createBenchMultiExpContext(Fp12[BLS12_381], [2, 4, 8, 16])

main()
github-actions[bot] commented 3 months ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim(47, 39) Error: cannot instantiate: 'ExtensionField[F]'; Maybe generic arguments are missing? assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-07-18T00:50:23
  • Finished 2024-07-18T00:50:24
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("macros") ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Algebra") ), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("BN254_Snarks"), newIdentNode("BLS12_381") ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("limbs") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(4), newIdentNode("uint64") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("QuadraticExt") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("coords") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(2), newIdentNode("F") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("CubicExt") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("coords") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(3), newIdentNode("F") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("ExtensionField") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkInfix.newTree( newIdentNode("or"), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), newIdentNode("F") ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), newIdentNode("F") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp2") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), nnkBracketExpr.newTree( newIdentNode("Fp"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp4") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), nnkBracketExpr.newTree( newIdentNode("Fp2"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp6") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), nnkBracketExpr.newTree( newIdentNode("Fp2"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp12") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), nnkBracketExpr.newTree( newIdentNode("Fp4"), newIdentNode("Name") ) ) ) ), nnkTemplateDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Name") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("Algebra"), nnkIdentDefs.newTree( newIdentNode("E"), nnkCommand.newTree( newIdentNode("type"), newIdentNode("ExtensionField") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( nnkDotExpr.newTree( newIdentNode("E"), newIdentNode("F") ), newIdentNode("Name") ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("BLS12_381_Order"), newEmptyNode(), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("uint64"), newLit(1) ), newLit(2), newLit(3), newLit(4) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("BLS12_381_Modulus"), newEmptyNode(), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("uint64"), newLit(5) ), newLit(6), newLit(7), newLit(8) ) ) ), nnkPragma.newTree( nnkExprColonExpr.newTree( newIdentNode("experimental"), newLit("dynamicBindSym") ) ), nnkMacroDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("baseFieldModulus") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkAsgn.newTree( newIdentNode("result"), nnkCall.newTree( newIdentNode("bindSym"), nnkInfix.newTree( newIdentNode("&"), nnkPrefix.newTree( newIdentNode("$"), newIdentNode("Name") ), newLit("_Modulus") ) ) ) ) ), nnkMacroDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("scalarFieldModulus") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkAsgn.newTree( newIdentNode("result"), nnkCall.newTree( newIdentNode("bindSym"), nnkInfix.newTree( newIdentNode("&"), nnkPrefix.newTree( newIdentNode("$"), newIdentNode("Name") ), newLit("_Order") ) ) ) ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("FieldKind") ), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("kBaseField"), newIdentNode("kScalarField") ) ) ), nnkTemplateDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("getBigInt") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("kind"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("FieldKind") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkWhenStmt.newTree( nnkElifBranch.newTree( nnkInfix.newTree( newIdentNode("=="), newIdentNode("kind"), newIdentNode("kBaseField") ), nnkStmtList.newTree( nnkCall.newTree( nnkDotExpr.newTree( nnkCall.newTree( nnkDotExpr.newTree( newIdentNode("Name"), newIdentNode("baseFieldModulus") ) ), newIdentNode("typeof") ) ) ) ), nnkElse.newTree( nnkStmtList.newTree( nnkCall.newTree( nnkDotExpr.newTree( nnkCall.newTree( nnkDotExpr.newTree( newIdentNode("Name"), newIdentNode("scalarFieldModulus") ) ), newIdentNode("typeof") ) ) ) ) ) ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("BenchMultiexpContext") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("GT"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("elems"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("GT") ), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("exponents"), nnkBracketExpr.newTree( newIdentNode("seq"), nnkCall.newTree( newIdentNode("getBigInt"), nnkDotExpr.newTree( newIdentNode("GT"), newIdentNode("Name") ), newIdentNode("kScalarField") ) ), newEmptyNode() ) ) ) ) ), nnkProcDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("createBenchMultiExpContext") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("BenchMultiexpContext"), newIdentNode("GT") ), nnkIdentDefs.newTree( newIdentNode("GT"), newIdentNode("typedesc"), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("inputSizes"), nnkBracketExpr.newTree( newIdentNode("openArray"), newIdentNode("int") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDiscardStmt.newTree( newEmptyNode() ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("ctx"), newEmptyNode(), nnkCall.newTree( newIdentNode("createBenchMultiExpContext"), nnkBracketExpr.newTree( newIdentNode("Fp12"), newIdentNode("BLS12_381") ), nnkBracket.newTree( newLit(2), newLit(4), newLit(8), newLit(16) ) ) ) ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
stable :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim(47, 39) Error: cannot instantiate: 'ExtensionField[F]'; Maybe generic arguments are missing? assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(682, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-07-18T00:50:27
  • Finished 2024-07-18T00:50:28
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("macros") ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Algebra") ), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("BN254_Snarks"), newIdentNode("BLS12_381") ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("limbs") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(4), newIdentNode("uint64") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("QuadraticExt") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("coords") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(2), newIdentNode("F") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("CubicExt") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("coords") ), nnkBracketExpr.newTree( newIdentNode("array"), newLit(3), newIdentNode("F") ), newEmptyNode() ) ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("ExtensionField") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("F"), newEmptyNode(), newEmptyNode() ) ), nnkInfix.newTree( newIdentNode("or"), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), newIdentNode("F") ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), newIdentNode("F") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp2") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), nnkBracketExpr.newTree( newIdentNode("Fp"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp4") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("QuadraticExt"), nnkBracketExpr.newTree( newIdentNode("Fp2"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp6") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), nnkBracketExpr.newTree( newIdentNode("Fp2"), newIdentNode("Name") ) ) ), nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Fp12") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), nnkBracketExpr.newTree( newIdentNode("CubicExt"), nnkBracketExpr.newTree( newIdentNode("Fp4"), newIdentNode("Name") ) ) ) ), nnkTemplateDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("Name") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("Algebra"), nnkIdentDefs.newTree( newIdentNode("E"), nnkCommand.newTree( newIdentNode("type"), newIdentNode("ExtensionField") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( nnkDotExpr.newTree( newIdentNode("E"), newIdentNode("F") ), newIdentNode("Name") ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("BLS12_381_Order"), newEmptyNode(), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("uint64"), newLit(1) ), newLit(2), newLit(3), newLit(4) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("BLS12_381_Modulus"), newEmptyNode(), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("uint64"), newLit(5) ), newLit(6), newLit(7), newLit(8) ) ) ), nnkPragma.newTree( nnkExprColonExpr.newTree( newIdentNode("experimental"), newLit("dynamicBindSym") ) ), nnkMacroDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("baseFieldModulus") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkAsgn.newTree( newIdentNode("result"), nnkCall.newTree( newIdentNode("bindSym"), nnkInfix.newTree( newIdentNode("&"), nnkPrefix.newTree( newIdentNode("$"), newIdentNode("Name") ), newLit("_Modulus") ) ) ) ) ), nnkMacroDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("scalarFieldModulus") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkAsgn.newTree( newIdentNode("result"), nnkCall.newTree( newIdentNode("bindSym"), nnkInfix.newTree( newIdentNode("&"), nnkPrefix.newTree( newIdentNode("$"), newIdentNode("Name") ), newLit("_Order") ) ) ) ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("FieldKind") ), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("kBaseField"), newIdentNode("kScalarField") ) ) ), nnkTemplateDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("getBigInt") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("untyped"), nnkIdentDefs.newTree( newIdentNode("Name"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("Algebra") ), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("kind"), nnkCommand.newTree( newIdentNode("static"), newIdentNode("FieldKind") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkWhenStmt.newTree( nnkElifBranch.newTree( nnkInfix.newTree( newIdentNode("=="), newIdentNode("kind"), newIdentNode("kBaseField") ), nnkStmtList.newTree( nnkCall.newTree( nnkDotExpr.newTree( nnkCall.newTree( nnkDotExpr.newTree( newIdentNode("Name"), newIdentNode("baseFieldModulus") ) ), newIdentNode("typeof") ) ) ) ), nnkElse.newTree( nnkStmtList.newTree( nnkCall.newTree( nnkDotExpr.newTree( nnkCall.newTree( nnkDotExpr.newTree( newIdentNode("Name"), newIdentNode("scalarFieldModulus") ) ), newIdentNode("typeof") ) ) ) ) ) ) ), nnkTypeSection.newTree( nnkTypeDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("BenchMultiexpContext") ), nnkGenericParams.newTree( nnkIdentDefs.newTree( newIdentNode("GT"), newEmptyNode(), newEmptyNode() ) ), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("elems"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("GT") ), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("exponents"), nnkBracketExpr.newTree( newIdentNode("seq"), nnkCall.newTree( newIdentNode("getBigInt"), nnkDotExpr.newTree( newIdentNode("GT"), newIdentNode("Name") ), newIdentNode("kScalarField") ) ), newEmptyNode() ) ) ) ) ), nnkProcDef.newTree( nnkPostfix.newTree( newIdentNode("*"), newIdentNode("createBenchMultiExpContext") ), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("BenchMultiexpContext"), newIdentNode("GT") ), nnkIdentDefs.newTree( newIdentNode("GT"), newIdentNode("typedesc"), newEmptyNode() ), nnkIdentDefs.newTree( newIdentNode("inputSizes"), nnkBracketExpr.newTree( newIdentNode("openArray"), newIdentNode("int") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDiscardStmt.newTree( newEmptyNode() ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("ctx"), newEmptyNode(), nnkCall.newTree( newIdentNode("createBenchMultiExpContext"), nnkBracketExpr.newTree( newIdentNode("Fp12"), newIdentNode("BLS12_381") ), nnkBracket.newTree( newLit(2), newLit(4), newLit(8), newLit(16) ) ) ) ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
2.0.4 :+1: OK

Output

``` ```

IR

Compiled filesize 91.05 Kb (93,232 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw; typedef struct tySequence__VLKY2uBPko3l83XCwghOlQ tySequence__VLKY2uBPko3l83XCwghOlQ; typedef struct tySequence__VLKY2uBPko3l83XCwghOlQ_Content tySequence__VLKY2uBPko3l83XCwghOlQ_Content; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew_Content tySequence__c2UMJ9c6611FrPrhhM19csew_Content; typedef struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w; typedef struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA; typedef struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw; typedef struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw; struct tySequence__VLKY2uBPko3l83XCwghOlQ { NI len; tySequence__VLKY2uBPko3l83XCwghOlQ_Content* p; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { NI len; tySequence__c2UMJ9c6611FrPrhhM19csew_Content* p; }; struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw { tySequence__VLKY2uBPko3l83XCwghOlQ elems; tySequence__c2UMJ9c6611FrPrhhM19csew exponents; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyArray__IKDINchqjr6ajMZhW1z77g[2]; struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw { tyArray__IKDINchqjr6ajMZhW1z77g coords; }; typedef tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyArray__qy7lj9bAu8cZHpl7tDatcAQ[2]; struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA { tyArray__qy7lj9bAu8cZHpl7tDatcAQ coords; }; typedef tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyArray__9a2ShoLrCUfee2tTxEaAueg[3]; struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w { tyArray__9a2ShoLrCUfee2tTxEaAueg coords; }; struct tySequence__VLKY2uBPko3l83XCwghOlQ_Content { NI cap; tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew_Content { NI cap; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u78)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u83)(NI* inputSizes_p1, NI inputSizes_p1Len_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u130)(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u148)(tySequence__VLKY2uBPko3l83XCwghOlQ dest_p0); N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u310)(tySequence__c2UMJ9c6611FrPrhhM19csew dest_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI)2), ((NI)4), ((NI)8), ((NI)16)} ; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403; extern NIM_THREADVAR TFrame* framePtr__system_u4020; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4403); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4020; framePtr__system_u4020 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4621(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4020 = (*framePtr__system_u4020).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u83)(NI* inputSizes_p1, NI inputSizes_p1Len_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)Result, sizeof(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u148)(tySequence__VLKY2uBPko3l83XCwghOlQ dest_p0) { if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) { alignedDealloc(dest_p0.p, NIM_ALIGNOF(tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w)); } } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u310)(tySequence__c2UMJ9c6611FrPrhhM19csew dest_p0) { if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) { alignedDealloc(dest_p0.p, NIM_ALIGNOF(tyArray__WOK9agWVIFrysHjlc69b06uA)); } } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u130)(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* dest_p0) { eqdestroy___temp_u148((*dest_p0).elems); eqdestroy___temp_u310((*dest_p0).exponents); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u78)(void) { tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw ctx; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw)); createBenchMultiExpContext__temp_u83(TM__SRd76hP9cMfCzdUO857UhQQ_2, 4, (&ctx)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u130((&ctx)); }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 0 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); main__temp_u78(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-07-18T00:50:31
  • Finished 2024-07-18T00:50:32
  • Duration
2.0.0 :+1: OK

Output

``` ```

IR

Compiled filesize 91.05 Kb (93,232 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw; typedef struct tySequence__VLKY2uBPko3l83XCwghOlQ tySequence__VLKY2uBPko3l83XCwghOlQ; typedef struct tySequence__VLKY2uBPko3l83XCwghOlQ_Content tySequence__VLKY2uBPko3l83XCwghOlQ_Content; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew_Content tySequence__c2UMJ9c6611FrPrhhM19csew_Content; typedef struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w; typedef struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA; typedef struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw; typedef struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw; struct tySequence__VLKY2uBPko3l83XCwghOlQ { NI len; tySequence__VLKY2uBPko3l83XCwghOlQ_Content* p; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { NI len; tySequence__c2UMJ9c6611FrPrhhM19csew_Content* p; }; struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw { tySequence__VLKY2uBPko3l83XCwghOlQ elems; tySequence__c2UMJ9c6611FrPrhhM19csew exponents; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyArray__IKDINchqjr6ajMZhW1z77g[2]; struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw { tyArray__IKDINchqjr6ajMZhW1z77g coords; }; typedef tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyArray__qy7lj9bAu8cZHpl7tDatcAQ[2]; struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA { tyArray__qy7lj9bAu8cZHpl7tDatcAQ coords; }; typedef tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyArray__9a2ShoLrCUfee2tTxEaAueg[3]; struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w { tyArray__9a2ShoLrCUfee2tTxEaAueg coords; }; struct tySequence__VLKY2uBPko3l83XCwghOlQ_Content { NI cap; tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew_Content { NI cap; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u78)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u83)(NI* inputSizes_p1, NI inputSizes_p1Len_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u130)(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u148)(tySequence__VLKY2uBPko3l83XCwghOlQ dest_p0); N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u310)(tySequence__c2UMJ9c6611FrPrhhM19csew dest_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI)2), ((NI)4), ((NI)8), ((NI)16)} ; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389; extern NIM_THREADVAR TFrame* framePtr__system_u4006; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u4389); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4006; framePtr__system_u4006 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4607(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4006 = (*framePtr__system_u4006).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u83)(NI* inputSizes_p1, NI inputSizes_p1Len_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)Result, sizeof(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u148)(tySequence__VLKY2uBPko3l83XCwghOlQ dest_p0) { if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) { alignedDealloc(dest_p0.p, NIM_ALIGNOF(tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w)); } } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u310)(tySequence__c2UMJ9c6611FrPrhhM19csew dest_p0) { if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) { alignedDealloc(dest_p0.p, NIM_ALIGNOF(tyArray__WOK9agWVIFrysHjlc69b06uA)); } } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u130)(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* dest_p0) { eqdestroy___temp_u148((*dest_p0).elems); eqdestroy___temp_u310((*dest_p0).exponents); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u78)(void) { tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw ctx; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw)); createBenchMultiExpContext__temp_u83(TM__SRd76hP9cMfCzdUO857UhQQ_2, 4, (&ctx)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u130((&ctx)); }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 0 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); main__temp_u78(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-07-18T00:50:34
  • Finished 2024-07-18T00:50:35
  • Duration
1.6.20 :+1: OK

Output

``` ```

IR

Compiled filesize 95.74 Kb (98,040 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw; typedef struct tySequence__VLKY2uBPko3l83XCwghOlQ tySequence__VLKY2uBPko3l83XCwghOlQ; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct TGenericSeq TGenericSeq; typedef struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w; typedef struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA; typedef struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw; typedef struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw; struct tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw { tySequence__VLKY2uBPko3l83XCwghOlQ* elems; tySequence__c2UMJ9c6611FrPrhhM19csew* exponents; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; struct TGenericSeq { NI len; NI reserved; }; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__eNw4U6SnurKcL2CQJc6qcw tyArray__IKDINchqjr6ajMZhW1z77g[2]; struct tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw { tyArray__IKDINchqjr6ajMZhW1z77g coords; }; typedef tyObject_QuadraticExt__fnc1By4CKzloiumq0xJngw tyArray__qy7lj9bAu8cZHpl7tDatcAQ[2]; struct tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA { tyArray__qy7lj9bAu8cZHpl7tDatcAQ coords; }; typedef tyObject_QuadraticExt__9bTZZQzyZ9aDAZUrnhXPq6AA tyArray__9a2ShoLrCUfee2tTxEaAueg[3]; struct tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w { tyArray__9a2ShoLrCUfee2tTxEaAueg coords; }; struct tySequence__VLKY2uBPko3l83XCwghOlQ { TGenericSeq Sup; tyObject_CubicExt__bA7EGgaYah7shnybXbvO7w data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { TGenericSeq Sup; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u87)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u92)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result); N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u2997)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 2), ((NI) 4), ((NI) 8), ((NI) 16)} ; extern TFrame* framePtr__system_u2564; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__systemZmemory_u7(p, ((int) 0), size); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u2564 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u2564).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u2564; framePtr__system_u2564 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u2997(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2564 = (*framePtr__system_u2564).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__temp_u92)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); unsureAsgnRef((void**)&(*Result).elems, NIM_NIL); unsureAsgnRef((void**)&(*Result).exponents, NIM_NIL); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u87)(void) { tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw ctx; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__4SOYlsnUkvEk9aSk9bbJSuqw)); createBenchMultiExpContext__temp_u92(TM__SRd76hP9cMfCzdUO857UhQQ_2, 4, (&ctx)); popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); main__temp_u87(); popFrame(); } } ```

Stats

  • Started 2024-07-18T00:50:37
  • Finished 2024-07-18T00:50:38
  • Duration
1.4.8 :+1: OK

Output

``` ```

IR

Compiled filesize 91.43 Kb (93,624 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g; typedef struct tySequence__ssgmplwPbekzfermlBzIGg tySequence__ssgmplwPbekzfermlBzIGg; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct TGenericSeq TGenericSeq; typedef struct tyObject_CubicExt__YMUnYTQtFplSNJjtUES6Gg tyObject_CubicExt__YMUnYTQtFplSNJjtUES6Gg; typedef struct tyObject_QuadraticExt__WAJlzyaK1LQ5WqYf9cHr9bwQ tyObject_QuadraticExt__WAJlzyaK1LQ5WqYf9cHr9bwQ; typedef struct tyObject_QuadraticExt__mMB9cLWpbLb5fbANGQHRQMA tyObject_QuadraticExt__mMB9cLWpbLb5fbANGQHRQMA; typedef struct tyObject_Fp__B69a6JkLMZS2sQD3DiOcPmQ tyObject_Fp__B69a6JkLMZS2sQD3DiOcPmQ; struct tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g { tySequence__ssgmplwPbekzfermlBzIGg* elems; tySequence__c2UMJ9c6611FrPrhhM19csew* exponents; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; struct TGenericSeq { NI len; NI reserved; }; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__B69a6JkLMZS2sQD3DiOcPmQ { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__B69a6JkLMZS2sQD3DiOcPmQ tyArray__nqDQhNIYVlx3SlUz8kpvDw[2]; struct tyObject_QuadraticExt__mMB9cLWpbLb5fbANGQHRQMA { tyArray__nqDQhNIYVlx3SlUz8kpvDw coords; }; typedef tyObject_QuadraticExt__mMB9cLWpbLb5fbANGQHRQMA tyArray__7Gv482g8fLS02Es3UnR8pA[2]; struct tyObject_QuadraticExt__WAJlzyaK1LQ5WqYf9cHr9bwQ { tyArray__7Gv482g8fLS02Es3UnR8pA coords; }; typedef tyObject_QuadraticExt__WAJlzyaK1LQ5WqYf9cHr9bwQ tyArray__WxtIqnDy8oeV7001tnv3wg[3]; struct tyObject_CubicExt__YMUnYTQtFplSNJjtUES6Gg { tyArray__WxtIqnDy8oeV7001tnv3wg coords; }; struct tySequence__ssgmplwPbekzfermlBzIGg { TGenericSeq Sup; tyObject_CubicExt__YMUnYTQtFplSNJjtUES6Gg data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { TGenericSeq Sup; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__PRSxGjFIiTWoYmw9bnBv0Rw)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g* Result); N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 2), ((NI) 4), ((NI) 8), ((NI) 16)} ; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__PRSxGjFIiTWoYmw9bnBv0Rw)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); unsureAsgnRef((void**)&(*Result).elems, NIM_NIL); unsureAsgnRef((void**)&(*Result).exponents, NIM_NIL); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g ctx; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__JxWxgRMK7vOPV5bpgLEZ5g)); createBenchMultiExpContext__PRSxGjFIiTWoYmw9bnBv0Rw(TM__SRd76hP9cMfCzdUO857UhQQ_2, 4, (&ctx)); popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-07-18T00:50:40
  • Finished 2024-07-18T00:50:40
  • Duration
1.2.18 :+1: OK

Output

``` ```

IR

Compiled filesize 91.47 Kb (93,664 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg; typedef struct tySequence__MIJql2j4wHnRQziHINc50g tySequence__MIJql2j4wHnRQziHINc50g; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct TGenericSeq TGenericSeq; typedef struct tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA; typedef struct tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw; typedef struct tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw; typedef struct tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ; struct tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg { tySequence__MIJql2j4wHnRQziHINc50g* elems; tySequence__c2UMJ9c6611FrPrhhM19csew* exponents; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; struct TGenericSeq { NI len; NI reserved; }; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ tyArray__PsRPFeiJeTmVCtPiNsVJhw[2]; struct tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw { tyArray__PsRPFeiJeTmVCtPiNsVJhw coords; }; typedef tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw tyArray__qemONRkOATPzLVqsiKRqYQ[2]; struct tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw { tyArray__qemONRkOATPzLVqsiKRqYQ coords; }; typedef tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw tyArray__pUBssAfummFAoVNM9bNt2Ow[3]; struct tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA { tyArray__pUBssAfummFAoVNM9bNt2Ow coords; }; struct tySequence__MIJql2j4wHnRQziHINc50g { TGenericSeq Sup; tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { TGenericSeq Sup; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg* Result); N_LIB_PRIVATE N_NOINLINE(void, chckNil)(void* p); N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 2), ((NI) 4), ((NI) 8), ((NI) 16)} ; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); chckNil((void*)Result); unsureAsgnRef((void**)&(*Result).elems, NIM_NIL); unsureAsgnRef((void**)&(*Result).exponents, NIM_NIL); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg ctx; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg)); createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ(TM__SRd76hP9cMfCzdUO857UhQQ_2, 4, (&ctx)); popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-07-18T00:50:42
  • Finished 2024-07-18T00:50:42
  • Duration
1.0.10 :+1: OK

Output

``` ```

IR

Compiled filesize 87.59 Kb (89,688 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg; typedef struct tySequence__MIJql2j4wHnRQziHINc50g tySequence__MIJql2j4wHnRQziHINc50g; typedef struct tySequence__c2UMJ9c6611FrPrhhM19csew tySequence__c2UMJ9c6611FrPrhhM19csew; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA; typedef struct tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw; typedef struct tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw; typedef struct tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ; typedef struct TGenericSeq TGenericSeq; struct tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg { tySequence__MIJql2j4wHnRQziHINc50g* elems; tySequence__c2UMJ9c6611FrPrhhM19csew* exponents; }; typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A; typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p); struct TNimType { NI size; tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind; tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; typedef NU64 tyArray__WOK9agWVIFrysHjlc69b06uA[4]; struct tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ { tyArray__WOK9agWVIFrysHjlc69b06uA limbs; }; typedef tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ tyArray__PsRPFeiJeTmVCtPiNsVJhw[2]; struct tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw { tyArray__PsRPFeiJeTmVCtPiNsVJhw coords; }; typedef tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw tyArray__qemONRkOATPzLVqsiKRqYQ[2]; struct tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw { tyArray__qemONRkOATPzLVqsiKRqYQ coords; }; typedef tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw tyArray__pUBssAfummFAoVNM9bNt2Ow[3]; struct tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA { tyArray__pUBssAfummFAoVNM9bNt2Ow coords; }; typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ; struct TNimNode { tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind; NI offset; TNimType* typ; NCSTRING name; NI len; TNimNode** sons; }; struct TGenericSeq { NI len; NI reserved; }; typedef NI tyArray__OQPb4glXtXQGOV29cAX1uQg[4]; struct tySequence__MIJql2j4wHnRQziHINc50g { TGenericSeq Sup; tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA data[SEQ_DECL_SIZE]; }; struct tySequence__c2UMJ9c6611FrPrhhM19csew { TGenericSeq Sup; tyArray__WOK9agWVIFrysHjlc69b06uA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg* Result); N_NOINLINE(void, chckNil)(void* p); N_NIMCALL(void, genericReset)(void* dest, TNimType* mt); static N_NIMCALL(void, Marker_tySequence__MIJql2j4wHnRQziHINc50g)(void* p, NI op); static N_NIMCALL(void, Marker_tySequence__c2UMJ9c6611FrPrhhM19csew)(void* p, NI op); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); TNimType NTI__uqFN31Uk4LOnlIvszeUoCg_; TNimType NTI__FbJb2yQ9bFfez63Blq7RUpA_; TNimType NTI__AdjTaRnn5nZWC3wShUTwnw_; TNimType NTI__8c9b9a2r89cLS4WabCCh32Mnw_; TNimType NTI__O1lss0Pb5ya1tPwRY9bdclQ_; extern TNimType NTI__wMtfD88jmrPZwfzTH9c8e9cA_; TNimType NTI__WOK9agWVIFrysHjlc69b06uA_; TNimType NTI__PsRPFeiJeTmVCtPiNsVJhw_; TNimType NTI__qemONRkOATPzLVqsiKRqYQ_; TNimType NTI__pUBssAfummFAoVNM9bNt2Ow_; TNimType NTI__MIJql2j4wHnRQziHINc50g_; TNimType NTI__c2UMJ9c6611FrPrhhM19csew_; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; NIM_CONST tyArray__OQPb4glXtXQGOV29cAX1uQg TM__SRd76hP9cMfCzdUO857UhQQ_3 = {((NI) 2), ((NI) 4), ((NI) 8), ((NI) 16)} ; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_NIMCALL(void, Marker_tySequence__MIJql2j4wHnRQziHINc50g)(void* p, NI op) { tySequence__MIJql2j4wHnRQziHINc50g* a; NI T1_; NI T2_; NI T3_; NI T4_; NI T5_; a = (tySequence__MIJql2j4wHnRQziHINc50g*)p; T1_ = (NI)0; for (T1_ = 0; T1_ < (a ? a->Sup.len : 0); T1_++) { T2_ = (NI)0; for (T2_ = 0; T2_ < 3; T2_++) { T3_ = (NI)0; for (T3_ = 0; T3_ < 2; T3_++) { T4_ = (NI)0; for (T4_ = 0; T4_ < 2; T4_++) { T5_ = (NI)0; } } } } } static N_NIMCALL(void, Marker_tySequence__c2UMJ9c6611FrPrhhM19csew)(void* p, NI op) { tySequence__c2UMJ9c6611FrPrhhM19csew* a; NI T1_; NI T2_; a = (tySequence__c2UMJ9c6611FrPrhhM19csew*)p; T1_ = (NI)0; for (T1_ = 0; T1_ < (a ? a->Sup.len : 0); T1_++) { T2_ = (NI)0; } } static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_; T1_ = (NI)0; { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_; T1_ = ((NI) 0); } goto LA2_; LA4_: ; { T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)))); } LA2_: ; (*s).calldepth = ((NI16) (T1_)); (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA9_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ)(NI* inputSizes, NI inputSizesLen_0, tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg* Result) { nimfr_("createBenchMultiExpContext", "/home/runner/work/Nim/Nim/temp.nim"); chckNil((void*)Result); genericReset((void*)Result, (&NTI__uqFN31Uk4LOnlIvszeUoCg_)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg ctx; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)(&ctx), sizeof(tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg)); createBenchMultiExpContext__Pd0dWqPGb1EipjS9bmbIMJQ(TM__SRd76hP9cMfCzdUO857UhQQ_3, 4, (&ctx)); popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } void PreMainInner(void) { } int cmdCount; char** cmdLine; char** gEnv; void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); tempDatInit000(); (*inner)(); } N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) { static TNimNode* TM__SRd76hP9cMfCzdUO857UhQQ_2_2[2]; static TNimNode TM__SRd76hP9cMfCzdUO857UhQQ_0[7]; NTI__uqFN31Uk4LOnlIvszeUoCg_.size = sizeof(tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg); NTI__uqFN31Uk4LOnlIvszeUoCg_.kind = 18; NTI__uqFN31Uk4LOnlIvszeUoCg_.base = 0; NTI__uqFN31Uk4LOnlIvszeUoCg_.flags = 2; TM__SRd76hP9cMfCzdUO857UhQQ_2_2[0] = &TM__SRd76hP9cMfCzdUO857UhQQ_0[1]; NTI__FbJb2yQ9bFfez63Blq7RUpA_.size = sizeof(tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA); NTI__FbJb2yQ9bFfez63Blq7RUpA_.kind = 18; NTI__FbJb2yQ9bFfez63Blq7RUpA_.base = 0; NTI__FbJb2yQ9bFfez63Blq7RUpA_.flags = 3; NTI__AdjTaRnn5nZWC3wShUTwnw_.size = sizeof(tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw); NTI__AdjTaRnn5nZWC3wShUTwnw_.kind = 18; NTI__AdjTaRnn5nZWC3wShUTwnw_.base = 0; NTI__AdjTaRnn5nZWC3wShUTwnw_.flags = 3; NTI__8c9b9a2r89cLS4WabCCh32Mnw_.size = sizeof(tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw); NTI__8c9b9a2r89cLS4WabCCh32Mnw_.kind = 18; NTI__8c9b9a2r89cLS4WabCCh32Mnw_.base = 0; NTI__8c9b9a2r89cLS4WabCCh32Mnw_.flags = 3; NTI__O1lss0Pb5ya1tPwRY9bdclQ_.size = sizeof(tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ); NTI__O1lss0Pb5ya1tPwRY9bdclQ_.kind = 18; NTI__O1lss0Pb5ya1tPwRY9bdclQ_.base = 0; NTI__O1lss0Pb5ya1tPwRY9bdclQ_.flags = 3; NTI__WOK9agWVIFrysHjlc69b06uA_.size = sizeof(tyArray__WOK9agWVIFrysHjlc69b06uA); NTI__WOK9agWVIFrysHjlc69b06uA_.kind = 16; NTI__WOK9agWVIFrysHjlc69b06uA_.base = (&NTI__wMtfD88jmrPZwfzTH9c8e9cA_); NTI__WOK9agWVIFrysHjlc69b06uA_.flags = 3; TM__SRd76hP9cMfCzdUO857UhQQ_0[5].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[5].offset = offsetof(tyObject_Fp__O1lss0Pb5ya1tPwRY9bdclQ, limbs); TM__SRd76hP9cMfCzdUO857UhQQ_0[5].typ = (&NTI__WOK9agWVIFrysHjlc69b06uA_); TM__SRd76hP9cMfCzdUO857UhQQ_0[5].name = "limbs"; NTI__O1lss0Pb5ya1tPwRY9bdclQ_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[5]; NTI__PsRPFeiJeTmVCtPiNsVJhw_.size = sizeof(tyArray__PsRPFeiJeTmVCtPiNsVJhw); NTI__PsRPFeiJeTmVCtPiNsVJhw_.kind = 16; NTI__PsRPFeiJeTmVCtPiNsVJhw_.base = (&NTI__O1lss0Pb5ya1tPwRY9bdclQ_); NTI__PsRPFeiJeTmVCtPiNsVJhw_.flags = 3; TM__SRd76hP9cMfCzdUO857UhQQ_0[4].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[4].offset = offsetof(tyObject_QuadraticExt__8c9b9a2r89cLS4WabCCh32Mnw, coords); TM__SRd76hP9cMfCzdUO857UhQQ_0[4].typ = (&NTI__PsRPFeiJeTmVCtPiNsVJhw_); TM__SRd76hP9cMfCzdUO857UhQQ_0[4].name = "coords"; NTI__8c9b9a2r89cLS4WabCCh32Mnw_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[4]; NTI__qemONRkOATPzLVqsiKRqYQ_.size = sizeof(tyArray__qemONRkOATPzLVqsiKRqYQ); NTI__qemONRkOATPzLVqsiKRqYQ_.kind = 16; NTI__qemONRkOATPzLVqsiKRqYQ_.base = (&NTI__8c9b9a2r89cLS4WabCCh32Mnw_); NTI__qemONRkOATPzLVqsiKRqYQ_.flags = 3; TM__SRd76hP9cMfCzdUO857UhQQ_0[3].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[3].offset = offsetof(tyObject_QuadraticExt__AdjTaRnn5nZWC3wShUTwnw, coords); TM__SRd76hP9cMfCzdUO857UhQQ_0[3].typ = (&NTI__qemONRkOATPzLVqsiKRqYQ_); TM__SRd76hP9cMfCzdUO857UhQQ_0[3].name = "coords"; NTI__AdjTaRnn5nZWC3wShUTwnw_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[3]; NTI__pUBssAfummFAoVNM9bNt2Ow_.size = sizeof(tyArray__pUBssAfummFAoVNM9bNt2Ow); NTI__pUBssAfummFAoVNM9bNt2Ow_.kind = 16; NTI__pUBssAfummFAoVNM9bNt2Ow_.base = (&NTI__AdjTaRnn5nZWC3wShUTwnw_); NTI__pUBssAfummFAoVNM9bNt2Ow_.flags = 3; TM__SRd76hP9cMfCzdUO857UhQQ_0[2].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[2].offset = offsetof(tyObject_CubicExt__FbJb2yQ9bFfez63Blq7RUpA, coords); TM__SRd76hP9cMfCzdUO857UhQQ_0[2].typ = (&NTI__pUBssAfummFAoVNM9bNt2Ow_); TM__SRd76hP9cMfCzdUO857UhQQ_0[2].name = "coords"; NTI__FbJb2yQ9bFfez63Blq7RUpA_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[2]; NTI__MIJql2j4wHnRQziHINc50g_.size = sizeof(tySequence__MIJql2j4wHnRQziHINc50g*); NTI__MIJql2j4wHnRQziHINc50g_.kind = 24; NTI__MIJql2j4wHnRQziHINc50g_.base = (&NTI__FbJb2yQ9bFfez63Blq7RUpA_); NTI__MIJql2j4wHnRQziHINc50g_.flags = 2; NTI__MIJql2j4wHnRQziHINc50g_.marker = Marker_tySequence__MIJql2j4wHnRQziHINc50g; TM__SRd76hP9cMfCzdUO857UhQQ_0[1].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[1].offset = offsetof(tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg, elems); TM__SRd76hP9cMfCzdUO857UhQQ_0[1].typ = (&NTI__MIJql2j4wHnRQziHINc50g_); TM__SRd76hP9cMfCzdUO857UhQQ_0[1].name = "elems"; TM__SRd76hP9cMfCzdUO857UhQQ_2_2[1] = &TM__SRd76hP9cMfCzdUO857UhQQ_0[6]; NTI__c2UMJ9c6611FrPrhhM19csew_.size = sizeof(tySequence__c2UMJ9c6611FrPrhhM19csew*); NTI__c2UMJ9c6611FrPrhhM19csew_.kind = 24; NTI__c2UMJ9c6611FrPrhhM19csew_.base = (&NTI__WOK9agWVIFrysHjlc69b06uA_); NTI__c2UMJ9c6611FrPrhhM19csew_.flags = 2; NTI__c2UMJ9c6611FrPrhhM19csew_.marker = Marker_tySequence__c2UMJ9c6611FrPrhhM19csew; TM__SRd76hP9cMfCzdUO857UhQQ_0[6].kind = 1; TM__SRd76hP9cMfCzdUO857UhQQ_0[6].offset = offsetof(tyObject_BenchMultiexpContext__uqFN31Uk4LOnlIvszeUoCg, exponents); TM__SRd76hP9cMfCzdUO857UhQQ_0[6].typ = (&NTI__c2UMJ9c6611FrPrhhM19csew_); TM__SRd76hP9cMfCzdUO857UhQQ_0[6].name = "exponents"; TM__SRd76hP9cMfCzdUO857UhQQ_0[0].len = 2; TM__SRd76hP9cMfCzdUO857UhQQ_0[0].kind = 2; TM__SRd76hP9cMfCzdUO857UhQQ_0[0].sons = &TM__SRd76hP9cMfCzdUO857UhQQ_2_2[0]; NTI__uqFN31Uk4LOnlIvszeUoCg_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[0]; } ```

Stats

  • Started 2024-07-18T00:50:44
  • Finished 2024-07-18T00:50:45
  • Duration
#f1789cc46 :arrow_right: :bug:

Diagnostics

metagn introduced a bug at 2023-09-01 10:00:15 +0300 on commit #f1789cc46 with message: ``` resolve local symbols in generic type call RHS (#22610) resolve local symbols in generic type call fixes #14509 ``` The bug is in the files: ``` compiler/semtypes.nim tests/generics/m14509.nim tests/generics/t14509.nim ``` The bug can be in the commits: (Diagnostics sometimes off-by-one).
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-07-18T00:49:54Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

:robot: Bug found in 28 minutes bisecting 709 commits at 25 commits per second

juancarlospaco commented 3 months ago

@metagn See https://github.com/nim-lang/Nim/issues/23853#issuecomment-2235098777

metagn commented 3 months ago

Simplified

type
  QuadraticExt[F] = object
    coords: array[2, F]

template Name(E: type QuadraticExt): int =
  123

template getBigInt(Name: static int): untyped =
  int

type Foo[GT] = object
  a: getBigInt(GT.Name)

var x: Foo[QuadraticExt[int]]
mratsim commented 3 months ago

In my full example

reordering

type BenchMultiexpContext*[GT] = object
  tp: Threadpool
  numInputs: int
  elems: seq[GT]
  exponents: seq[getBigInt(GT.Name, kScalarField)]

to

type BenchMultiexpContext*[GT] = object
  tp: Threadpool
  numInputs: int
  exponents: seq[getBigInt(GT.Name(), kScalarField)]
  elems: seq[GT]

makes things compile

https://github.com/mratsim/constantine/pull/436/commits/70a27fc38cab42e1a04a78c444879d94ed4ba26b

EDIT: actually it's the parenthesis that mattered