Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Jul 3, 2019
1 parent 5abd406 commit 93b0b68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/vm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
VmArgs(ra: ra, rb: rb, rc: rc, slots: cast[pointer](regs),
currentException: c.currentExceptionA,
currentLineInfo: c.debug[pc]))
elif importcVMCond(prc):
elif shouldImportcSymbol(prc):
if compiletimeFFI notin c.config.features:
globalError(c.config, c.debug[pc], "VM not allowed to do FFI, see `compiletimeFFI`")
# we pass 'tos.slots' instead of 'regs' so that the compiler can keep
Expand Down
6 changes: 4 additions & 2 deletions compiler/vmgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1547,9 +1547,11 @@ proc genTypeLit(c: PCtx; t: PType; dest: var TDest) =
proc importcCond(s: PSym): bool {.inline.} =
sfImportc in s.flags and (lfDynamicLib notin s.loc.flags or s.ast == nil)

proc importcVMCond*(s: PSym): bool =
proc shouldImportcSymbol*(s: PSym): bool =
## return true to importc `s`, false to execute its body instead (refs #8405)
sfImportc in s.flags and s.ast == nil
if sfImportc in s.flags:
assert s.kind == skProc
return s.ast.sons[bodyPos].kind == nkEmpty

proc importcSym(c: PCtx; info: TLineInfo; s: PSym) =
when hasFFI:
Expand Down

0 comments on commit 93b0b68

Please sign in to comment.