[Wisp-cvs] wisp/src/native wstrings.s,NONE,1.1 wstrings.wth,NONE,1.1 Makefile.am,1.152,1.153 boxes.s
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2002-09-07 22:02:45
|
Update of /cvsroot/wisp/wisp/src/native In directory usw-pr-cvs1:/tmp/cvs-serv6849/src/native Modified Files: Makefile.am boxes.s strings.nasm Added Files: wstrings.s wstrings.wth Log Message: Started the string format transition. --- NEW FILE: wstrings.s --- .section .text .align 16 N_c8string_huh: .byte 144,186,9,0,0,0,233 .long discriminator_body - (.+4) .global N_c8string_huh,NN_c8string_huh .equiv NN_c8string_huh, N_c8string_huh + 1 --- NEW FILE: wstrings.wth --- ;;;; wstrings.wth - string primitives ;; ;; Copyleft © 2002 by Andres Soolo (di...@us...) ;; This file is licensed under the GNU GPL v2. If you ;; don't know what that means, please do read the GPL. ;; ;;;; @(#) $Id: wstrings.wth,v 1.1 2002/09/07 22:02:43 digg Exp $ (include wisptyp) (extern RT_c16string) (extern WB_range) (extern cons$2) (extern decsi$1) (extern decui$1) (extern encsi$1) (extern encui$1) (extern salloc$1) (extern ws2zt) (macro decsi <: swap (flush) 'decsi$1 jump :>) (macro decui <: swap (flush) 'decui$1 jump :>) (macro encsi <: swap (flush) 'encsi$1 jump :>) (macro encui <: swap (flush) 'encui$1 jump :>) (macro salloc <: swap (flush) 'salloc$1 jump :>) (native c8string_huh NC_C8STRING go-discriminate) ; vim: ft=worth Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/Makefile.am,v retrieving revision 1.152 retrieving revision 1.153 diff -u -d -r1.152 -r1.153 --- Makefile.am 4 Sep 2002 14:31:42 -0000 1.152 +++ Makefile.am 7 Sep 2002 22:02:43 -0000 1.153 @@ -16,8 +16,8 @@ list.nasm memset.nasm records.nasm ref.nasm resignal.nasm \ signal.nasm strings.nasm sys_raw.nasm types.nasm valloc.nasm \ vectors.nasm wrap.nasm \ - boxes.wth cons.wth death.wth sys.wth \ - boxes.s cons.s death.s sys.s + boxes.wth cons.wth death.wth sys.wth wstrings.wth \ + boxes.s cons.s death.s sys.s wstrings.s EXTRA_DIST = .cvsignore Index: boxes.s =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/boxes.s,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- boxes.s 4 Sep 2002 14:26:57 -0000 1.6 +++ boxes.s 7 Sep 2002 22:02:43 -0000 1.7 @@ -5,9 +5,9 @@ .long N_signal_argcount - (.+4) .byte 88,88,104 .long N_box_empty_huh.L1 -.byte 80,185,1,0,0,0,186 +.byte 80,187,1,0,0,0,186 .long RT_box -.byte 187,1,0,0,0,233 +.byte 185,1,0,0,0,233 .long slot_accessor_body - (.+4) .byte 61,35,0,0,0,15,133,7,0,0,0,106,11,233,2,0,0,0,106,19,88,195 .global N_box_empty_huh,NN_box_empty_huh,N_box_empty_huh.L1 @@ -27,9 +27,9 @@ N_box_ref: .byte 144,81,131,249,1,15,133,10,0,0,0,88,91,83,104 .long box_ref.final -.byte 83,80,88,137,193,186 +.byte 83,80,187,1,0,0,0,186 .long RT_box -.byte 187,1,0,0,0,233 +.byte 88,137,193,233 .long slot_accessor_body - (.+4) .global N_box_ref,NN_box_ref .equiv NN_box_ref, N_box_ref + 1 @@ -45,9 +45,9 @@ .section .text .align 16 N_make_box: -.byte 144,81,133,201,15,133,5,0,0,0,88,64,106,35,80,88,137,193,186 +.byte 144,81,133,201,15,133,5,0,0,0,88,64,106,35,80,186 .long RT_box -.byte 233 +.byte 88,137,193,233 .long record_constructor_body - (.+4) .global N_make_box,NN_make_box .equiv NN_make_box, N_make_box + 1 Index: strings.nasm =================================================================== RCS file: /cvsroot/wisp/wisp/src/native/strings.nasm,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- strings.nasm 7 Sep 2002 21:54:06 -0000 1.51 +++ strings.nasm 7 Sep 2002 22:02:43 -0000 1.52 @@ -11,11 +11,10 @@ struc c16string .type: resd 1 .length: resd 1 -.body: resd 1 +.data: endstruc %define c16string#length(x) dword [(x) + c16string.length] -%define c16string#body(x) dword [(x) + c16string.body] ; {{{ |string?| native string_huh, 1 @@ -34,12 +33,6 @@ ret ; }}} -; {{{ |c8string?| -native c8string_huh, any - mov edx, NC_C8STRING - jmp discriminator_body -; }}} - ; {{{ |c8string-ref| global N_c8string_ref native c8string_ref, any @@ -121,10 +114,7 @@ endif cmp eax, ecx jnc signal_range_1 - shl eax, 1 - add eax, c16string#body(edx) - mov ax, [eax] - movzx eax, ax + movzx eax, word [edx + 8 + eax * 2] shl eax, 8 mov al, 3 drop @@ -146,9 +136,7 @@ endif cmp eax, ecx jnc signal_range_1 - shl eax, 1 - add eax, c16string#body(edx) - mov [eax], bx + mov [edx + 8 + eax * 2], bx drop 2 retvoid ; }}} @@ -245,22 +233,21 @@ req_char16 ecx mov eax, [esp + 4] ; length decui eax - cmp eax, 0xffffffff / 2 + cmp eax, (0xffffffff - 8) / 2 ja near out_of_memory mov [esp + 4], eax - shl eax, 1 + lea eax, [8 + eax * 2] gcall salloc$1, eax pop edx ; filler shr edx, 8 mov ecx, [esp] ; length push eax - mov edi, eax + lea edi, [eax + 8] cld mov eax, edx rep stosw - valloc 3 + pop eax mov dword [eax], RT_c16string - pop c16string#body(eax) pop c16string#length(eax) ret ; }}} @@ -319,162 +306,162 @@ ret ; }}} -; {{{ |string-move!| -native string_move, 5 ; dest destind src srcind amount - do_decui [esp + 12] ; destind - do_decui [esp + 4] ; srcind - do_decui [esp] ; amount - mov eax, [esp + 16] ; dest - test eax, eax - jz _signal_string_eax - test al, 3 - jnz _signal_string_eax - mov edx, type(eax) - mov bh, 1 - cmp edx, NC_C8STRING - je .dest_ok - mov bh, 2 - cmp edx, RT_c16string - jne _signal_string_eax -.dest_ok: - mov edi, eax - mov eax, [esp + 8] ; src - test eax, eax - jz _signal_string_eax - test al, 3 - jnz _signal_string_eax - mov esi, eax - mov edx, type(eax) - mov bl, 1 - cmp edx, NC_C8STRING - je .src_ok - mov bl, 2 - cmp edx, RT_c16string - jne _signal_string_eax -.src_ok: - mov ecx, [esp] - test ecx, ecx - jz .all_done - - ; Registers so far: - ; EDI = destination string node BH = destination token size - ; ESI = source string node BL = source token size - ; ECX = amount (surely positive--result of decui) - ; Types are checked and OK. Sizes are not--yet. - - mov eax, [esp + 12] ; destind - mov edx, eax - add eax, ecx - jc near _signal_range_encui_ecx - cmp eax, [edi + 4] - ja near _signal_range_encui_eax - mov edi, [edi + 8] ; ...#body - - mov eax, [esp + 4] ; srcind - mov ebp, eax - add eax, ecx - jc near _signal_range_encui_ecx - cmp eax, [esi + 4] - ja near _signal_range_encui_eax - mov esi, [esi + 8] ; ...#body - - ; Registers so far: - ; EDI = destination string body EDX = index BH = token size - ; ESI = source string body EBP = index BL = token size - ; ECX = amount - - cmp bh, bl - jne .size_changes - dec bl - jz .one_byte - dec bl - jz .two_bytes - dec bl - jz .three_bytes -.four_bytes: - ud0 ; there aren't c4string:s yet -.three_bytes: - ud0 ; there aren't c3string:s yet -.two_bytes: - add ecx, ecx - add edi, edx - add esi, ebp -.one_byte: - add edi, edx - add esi, ebp -.work: - gcall memmove$3, edi, esi, ecx -.all_done: - drop 5 - mov eax, VOID - ret -.size_changes: - mov eax, ebx - dec ah - jz .dest_one_byte - dec ah - jz .dest_two_bytes - dec ah - jz .dest_three_bytes -.dest_four_bytes: - add edi, edx -.dest_three_bytes: - add edi, edx -.dest_two_bytes: - add edi, edx -.dest_one_byte: - add edi, edx - dec al - jz .src_one_byte - dec al - jz .src_two_bytes - dec al - jz .src_three_bytes -.src_four_bytes: - add esi, ebp -.src_three_bytes: - add esi, ebp -.src_two_bytes: - add esi, ebp -.src_one_byte: - add esi, ebp - cld - cmp bx, 0x0102 - jz .move_12 - cmp bx, 0x0201 - jz .move_21 - ud0 ; can't happen -; Note that conversion moves always move in a single direction. -; That's OK--conversion moves will not be applied if source and -; destination are the same string since the char width will be same. -; Non-conversion moves are handled by |memmove| who uses the correct -; direction. -.move_21: - mov ah, 0 -.loop_21: - lodsb - stosw - loop .loop_21, ecx - drop 5 - mov eax, VOID - ret -.move_12: - lodsw - test ah, ah - jnz .range_12 - stosb - loop .move_12, ecx - drop 5 - mov eax, VOID - ret -.range_12: - movzx eax, ax - shl eax, 8 - mov al, 3 - push WB_char8_huh - push eax - jmp raise$2 -; }}} +; ; {{{ |string-move!| +; native string_move, 5 ; dest destind src srcind amount +; do_decui [esp + 12] ; destind +; do_decui [esp + 4] ; srcind +; do_decui [esp] ; amount +; mov eax, [esp + 16] ; dest +; test eax, eax +; jz _signal_string_eax +; test al, 3 +; jnz _signal_string_eax +; mov edx, type(eax) +; mov bh, 1 +; cmp edx, NC_C8STRING +; je .dest_ok +; mov bh, 2 +; cmp edx, RT_c16string +; jne _signal_string_eax +; .dest_ok: +; mov edi, eax +; mov eax, [esp + 8] ; src +; test eax, eax +; jz _signal_string_eax +; test al, 3 +; jnz _signal_string_eax +; mov esi, eax +; mov edx, type(eax) +; mov bl, 1 +; cmp edx, NC_C8STRING +; je .src_ok +; mov bl, 2 +; cmp edx, RT_c16string +; jne _signal_string_eax +; .src_ok: +; mov ecx, [esp] +; test ecx, ecx +; jz .all_done +; +; ; Registers so far: +; ; EDI = destination string node BH = destination token size +; ; ESI = source string node BL = source token size +; ; ECX = amount (surely positive--result of decui) +; ; Types are checked and OK. Sizes are not--yet. +; +; mov eax, [esp + 12] ; destind +; mov edx, eax +; add eax, ecx +; jc near _signal_range_encui_ecx +; cmp eax, [edi + 4] +; ja near _signal_range_encui_eax +; mov edi, [edi + 8] ; ...#body +; +; mov eax, [esp + 4] ; srcind +; mov ebp, eax +; add eax, ecx +; jc near _signal_range_encui_ecx +; cmp eax, [esi + 4] +; ja near _signal_range_encui_eax +; mov esi, [esi + 8] ; ...#body +; +; ; Registers so far: +; ; EDI = destination string body EDX = index BH = token size +; ; ESI = source string body EBP = index BL = token size +; ; ECX = amount +; +; cmp bh, bl +; jne .size_changes +; dec bl +; jz .one_byte +; dec bl +; jz .two_bytes +; dec bl +; jz .three_bytes +; .four_bytes: +; ud0 ; there aren't c4string:s yet +; .three_bytes: +; ud0 ; there aren't c3string:s yet +; .two_bytes: +; add ecx, ecx +; add edi, edx +; add esi, ebp +; .one_byte: +; add edi, edx +; add esi, ebp +; .work: +; gcall memmove$3, edi, esi, ecx +; .all_done: +; drop 5 +; mov eax, VOID +; ret +; .size_changes: +; mov eax, ebx +; dec ah +; jz .dest_one_byte +; dec ah +; jz .dest_two_bytes +; dec ah +; jz .dest_three_bytes +; .dest_four_bytes: +; add edi, edx +; .dest_three_bytes: +; add edi, edx +; .dest_two_bytes: +; add edi, edx +; .dest_one_byte: +; add edi, edx +; dec al +; jz .src_one_byte +; dec al +; jz .src_two_bytes +; dec al +; jz .src_three_bytes +; .src_four_bytes: +; add esi, ebp +; .src_three_bytes: +; add esi, ebp +; .src_two_bytes: +; add esi, ebp +; .src_one_byte: +; add esi, ebp +; cld +; cmp bx, 0x0102 +; jz .move_12 +; cmp bx, 0x0201 +; jz .move_21 +; ud0 ; can't happen +; ; Note that conversion moves always move in a single direction. +; ; That's OK--conversion moves will not be applied if source and +; ; destination are the same string since the char width will be same. +; ; Non-conversion moves are handled by |memmove| who uses the correct +; ; direction. +; .move_21: +; mov ah, 0 +; .loop_21: +; lodsb +; stosw +; loop .loop_21, ecx +; drop 5 +; mov eax, VOID +; ret +; .move_12: +; lodsw +; test ah, ah +; jnz .range_12 +; stosb +; loop .move_12, ecx +; drop 5 +; mov eax, VOID +; ret +; .range_12: +; movzx eax, ax +; shl eax, 8 +; mov al, 3 +; push WB_char8_huh +; push eax +; jmp raise$2 +; ; }}} rectype c16string rt_slot_count 2 |