aboutsummaryrefslogtreecommitdiff
path: root/compiler/elymasGlobalSys.ey
blob: 2f2b7639eb0b49885fd733488bfce1bd890b76f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<
  "sys" enterSubScope

  <
    # handle an identifier in the current scope according to current quote level
    # 0 -> scope to execute identifier in
    # 1 -> identifier to handle
    # 0 <- scope after execution
    [[
      8 /r15 :subqImm8Reg
      /r15 :popqMem
      
      ::currentScope /rax :movqImmReg
      8 /r15 :subqImm8Reg
      /rax /rcx :movqMemReg
      /rcx /r15 :movqRegMem
      /rax :popqMem # load scope from argument

      internalExecuteIdentifier /rax :movqImmReg
      /rax :callqReg

      ::currentScope /rax :movqImmReg
      /rax :pushqMem
      /r15 /rcx :movqMemReg
      /rcx /rax :movqRegMem # restore old scope
      8 /r15 :addqImm8Reg

      /r15 :pushqMem
      8 /r15 :addqImm8Reg
      :retn
    ]] /eyexecuteIdentifier defv
  > _ ==globalFunctions { defv }' ::allocateOffsetStruct

  [
    globalFunctions keys eydeff { | }' createScopeEntries
    createScopeExtensionEntries
  ] :execute

  "elymasGlobalSysAsm.ey" include
  "elymasGlobalSysTyped.ey" include

  leaveSubScope
> --

# vim: syn=elymas