about summary refs log tree commit diff stats
path: root/html/http-client.mu.html
Commit message (Expand)AuthorAgeFilesLines
* 4003Kartik K. Agaram2017-09-231-2/+2
* 3951Kartik K. Agaram2017-06-241-1/+1
* 3901Kartik K. Agaram2017-06-091-1/+1
* 3867Kartik K. Agaram2017-05-191-5/+6
* 3837Kartik K. Agaram2017-04-191-1/+1
* 3831Kartik K. Agaram2017-04-181-1/+1
* 3830 - crosslink shape-shifting containers in htmlKartik K. Agaram2017-04-181-2/+2
* 3829Kartik K. Agaram2017-04-181-2/+2
* 3764 - better colors for cross-linksKartik K. Agaram2017-03-081-3/+4
* 3761Kartik K. Agaram2017-03-071-8/+9
* 3725Kartik K. Agaram2016-12-271-1/+1
* 3716Kartik K. Agaram2016-12-261-0/+2
* 3713 - cross-link calls with definitions in htmlKartik K. Agaram2016-12-261-3/+3
* 3710Kartik K. Agaram2016-12-261-21/+21
* 3709 - line numbers in htmlKartik K. Agaram2016-12-261-24/+48
* 3604Kartik K. Agaram2016-10-271-3/+0
* 3569Kartik K. Agaram2016-10-231-8/+8
* 3567Kartik K. Agaram2016-10-231-1/+1
* 3543Kartik K. Agaram2016-10-221-3/+3
* 3525Kartik K. Agaram2016-10-201-3/+3
* 3524Kartik K. Agaram2016-10-201-0/+60
ring.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
== code

copy-array-object:  # src: (addr array T), dest-ah: (addr handle array T)
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (copy-array Heap *(ebp+8) *(ebp+0xc))
$copy-array-object:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

# create an independent copy of file src into dest
# there's no way to do this without knowing the filename
copy-file:  # src: (addr buffered-file), dest-ah: (addr handle buffered-file), filename: (addr array byte)
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    52/push-edx
    53/push-ebx
    56/push-esi
    57/push-edi
    # esi = src
    8b/-> *(ebp+8) 6/r32/esi
    # var n/ecx: int = src->buffer->size + 16
    8b/-> *(esi+0xc) 0/r32/eax
    05/add-to-eax 0x10/imm32  # buffered-file fields before buffer contents
    89/<- %ecx 0/r32/eax
    #
    (allocate Heap %ecx *(ebp+0xc))
    # var dest/edi: (addr buffered-file) = lookup(*dest-ah)
    8b/-> *(ebp+0xc) 0/r32/eax
    (lookup *eax *(eax+4))  # => eax
    89/<- %edi 0/r32/eax
    #
    (copy-bytes %esi %edi %ecx)
    # var offset/ecx: int = lseek(src->fd, 0, SEEK_CUR)
    8b/-> *esi 3/r32/ebx
    b9/copy-to-ecx 0/imm32/offset
    ba/copy-to-edx 1/imm32/whence:SEEK_CUR
    (syscall_lseek)
    89/<- %ecx 0/r32/eax
    # at this point dest is identical to src, including file descriptor. Now
    # create an independent copy of the file descriptor
    (open-fd *(ebp+0x10) 0)  # false => eax
    89/<- *edi 0/r32/eax
    # replicate offset in the new fd
    89/<- %ebx 0/r32/eax  # fd
    51/push-ecx  # offset
    ba/copy-to-edx 0/imm32/whence:SEEK_SET
    (syscall_lseek)
$copy-file:end:
    # . restore registers
    5f/pop-to-edi
    5e/pop-to-esi
    5b/pop-to-ebx
    5a/pop-to-edx
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return