about summary refs log tree commit diff stats
path: root/html/archive/2.vm/resources.mu
blob: 79bb999f5bd5bef85c3c8afaf5f6ec0c2062ecc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  assume-resources [
    # contents for a local file
    [/foo/bar] <- [
      |def|  # lines delimited by '|'
    ]

    # contents for a URL
    [example.com/foo/bar] <- [
      |abc|
    ]
  ]
erly restored. # Registers can be spilled, but that modifies the stack and needs to be # cleaned up. # Overhead: # 62 + n*6 instructions to push n bytes. # If we just emitted code to push n zeroes, it would be: # 5 bytes for 4 zero bytes, so 1.25 bytes per zero. And that's not even # instructions. # But on the other hand it would destroy the instruction cache, where this # approach requires 15 instructions, fixed. # n must be positive push-n-zero-bytes: # n: int $push-n-zero-bytes:prologue: 89/<- *Push-n-zero-bytes-ebp 5/r32/ebp # spill ebp without affecting stack 89/<- %ebp 4/r32/esp $push-n-zero-bytes:copy-ra: # -- esp = ebp 50/push-eax # -- esp+8 = ebp+4 # -- esp+4 = ebp 8b/-> *(esp+4) 0/r32/eax 2b/subtract *(ebp+4) 4/r32/esp # -- esp+4+n = ebp 89/<- *(esp+4) 0/r32/eax 58/pop-to-eax # -- esp+n = ebp $push-n-zero-bytes:bulk-cleaning: 89/<- *Push-n-zero-bytes-esp 4/r32/esp 81 0/subop/add *Push-n-zero-bytes-esp 4/imm32 81 0/subop/add *(ebp+4) 4/imm32 (zero-out *Push-n-zero-bytes-esp *(ebp+4)) # n+4 $push-n-zero-bytes:epilogue: 8b/-> *Push-n-zero-bytes-ebp 5/r32/ebp # restore spill c3/return == data Push-n-zero-bytes-ebp: # (addr int) 0/imm32 Push-n-zero-bytes-esp: # (addr int) 0/imm32