timotheecour / Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).
http://nim-lang.org/
Other
2 stars 0 forks source link

misc VM #109

Open timotheecour opened 4 years ago

timotheecour commented 4 years ago

eg: /Users/timothee/git_clone/nim/Nim_prs/lib/system/fatal.nim(49) sysFatal Error: unhandled exception: 'intVal' is not accessible using discriminant 'kind' of type 'TNode' [FieldError]

even when compiled w --stacktrace:on -d:debug eg:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  frame #0: 0x0000000100025810 nim.pr_dollar_ptr`raiseFieldError
  frame #1: 0x00000001002e36c6 nim.pr_dollar_ptr`rawExecute__hemGrN9b53Mp9aLYjv1tCS5g + 53030
  frame #2: 0x0000000100301b18 nim.pr_dollar_ptr`evalConstExprAux__m2sR4LMnyFV9c9cRHcUHxnVQ + 664
  frame #3: 0x0000000100301f4c nim.pr_dollar_ptr`evalStaticStmt__4ISne8kQ4QKaNjEY5dqxUg + 172
  frame #4: 0x00000001003cd803 nim.pr_dollar_ptr`semStaticStmt__7YxUILpPxooC5qqa89a54dw_63 + 611
  frame #5: 0x0000000100318859 nim.pr_dollar_ptr`semExpr__vJZwz9bfROKrfrtM50y74CQ_3 + 6265
  frame #6: 0x00000001003a94e1 nim.pr_dollar_ptr`semStmtList__vJZwz9bfROKrfrtM50y74CQ_30 + 801
  frame #7: 0x0000000100317c38 nim.pr_dollar_ptr`semExpr__vJZwz9bfROKrfrtM50y74CQ_3 + 3160
  frame #8: 0x00000001003a8e3d nim.pr_dollar_ptr`semBlock__vJZwz9bfROKrfrtM50y74CQ_29 + 1181
  frame #9: 0x0000000100317c19 nim.pr_dollar_ptr`semExpr__vJZwz9bfROKrfrtM50y74CQ_3 + 3129
  frame #10: 0x00000001003a94e1 nim.pr_dollar_ptr`semStmtList__vJZwz9bfROKrfrtM50y74CQ_30 + 801
  frame #11: 0x0000000100317c38 nim.pr_dollar_ptr`semExpr__vJZwz9bfROKrfrtM50y74CQ_3 + 3160
  frame #12: 0x0000000100316f78 nim.pr_dollar_ptr`semExprNoType__7YxUILpPxooC5qqa89a54dw_2 + 232
  frame #13: 0x00000001003d0325 nim.pr_dollar_ptr`semStmtAndGenerateGenerics__7YxUILpPxooC5qqa89a54dw_64 + 421
  frame #14: 0x00000001003d0821 nim.pr_dollar_ptr`myProcess__QAJdPOwMq9buTNGNGQO3ImA + 241
  frame #15: 0x00000001002170d5 nim.pr_dollar_ptr`processTopLevelStmt__BFNgyIpulW0dGrVuU3hyxQ + 373
  frame #16: 0x00000001002184e1 nim.pr_dollar_ptr`processModule__zPTa50e0M05UK8aJ9bS48aw + 3761
  frame #17: 0x00000001004d1a53 nim.pr_dollar_ptr`compileModule__G7A63DimkOmtueyLoB89c8w + 1011
  frame #18: 0x00000001004d2334 nim.pr_dollar_ptr`compileProject__KlDcF6rnOBDQLo439cvjPjg + 532
  frame #19: 0x00000001005702b8 nim.pr_dollar_ptr`commandCompileToC__ikP0vuP6oxqlYdG7q9cY7sA_2 + 2248
  frame #20: 0x0000000100573be4 nim.pr_dollar_ptr`mainCommand__ikP0vuP6oxqlYdG7q9cY7sA + 7924
  frame #21: 0x0000000100577831 nim.pr_dollar_ptr`loadConfigsAndRunMainCommand__Zakie0oLAV2ve6DuAr547w + 1537
  frame #22: 0x000000010057909e nim.pr_dollar_ptr`handleCmdLine__I9aitIr13Z1B6wHv5vzMf2w + 334
  frame #23: 0x00000001005796ad nim.pr_dollar_ptr`NimMainModule + 205
  frame #24: 0x000000010057975b nim.pr_dollar_ptr`main + 59
  frame #25: 0x00007fff6c97f7fd libdyld.dylib`start + 1
  frame #26: 0x00007fff6c97f7fd libdyld.dylib`start + 1
(lldb) ^D
timotheecour commented 4 years ago

can compilerapi be used to have user defined vmops? eg: see $nim_devel_D/tests/compilerapi/tcompilerapi.nim

intr.implementRoutine("*", "exposed", "addFloats", proc (a: VmArgs) =
    setResult(a, getFloat(a, 0) + getFloat(a, 1) + getFloat(a, 2))
  )
timotheecour commented 4 years ago
timotheecour commented 4 years ago
timotheecour commented 4 years ago

pure/cstrutils.nim(58, 14) Error: index 3 not in 0 .. 2 if suffix[i] == '\0': return true

when defined case2: #D20200507T213758:here gitissue
  import std/cstrutils
  template fun()=
    echo endsWith("foobar".cstring, "bar".cstring)
  static: fun()