diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 4ec2f1a8e7..686e102fee 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,36 +1,38 @@ 72/73: -- [ [ dup call ] dup call ] infer hangs -- move tuple to generic vocab - update plugin docs - word preview for remote words -- vectors: ensure its ok with bignum indices -- code gc +- faster completion + +- [ [ dup call ] dup call ] infer hangs - type inference fails with some assembler words; displaced, register and other predicates need to inherit from list not cons, and need stronger branch partial eval - print warning on null class - optimize away dispatch -- faster completion + +- move tuple to generic vocab + +- vectors: ensure its ok with bignum indices +- code gc - ppc register decls +- unit test failure +- #jump-f #jump-f-label - extract word inside M:, C:, and structure browsing for these - fix checkbox alignment - begin-scan, next-object, end-scan primitives - each-object, each-slot combinators -- port leak - references primitive - ditch % for tuples? - resize window: world not updated until mouse moved - x>offset - fix completion invoke in middle of word -- html: word links - don't hardcode so many colors - ffi unicode strings: null char security hole - utf16 string boxing - slot compile problem - sdl console crash -- x86 register decl - UI: don't roll over if mouse button is down + compiler/ffi: diff --git a/library/compiler/x86/fixnum.factor b/library/compiler/x86/fixnum.factor index 08ae3d23b5..c2b92c1c4b 100644 --- a/library/compiler/x86/fixnum.factor +++ b/library/compiler/x86/fixnum.factor @@ -47,16 +47,14 @@ USE: math-internals : fixnum-insn ( overflow opcode -- ) #! This needs to be factored. - ECX DS> - EAX [ ECX -4 ] MOV - EAX [ ECX ] rot execute + EAX [ ESI -4 ] MOV + EAX [ ESI ] rot execute 0 JNO fixup swap compile-call 0 JMP fixup >r compiled-offset swap patch - ECX 4 SUB - [ ECX ] EAX MOV - ECX >DS + ESI 4 SUB + [ ESI ] EAX MOV r> compiled-offset swap patch ; \ fixnum+ [ @@ -73,17 +71,15 @@ USE: math-internals \ fixnum* [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV EAX 3 SHR - EAX [ ECX ] IMUL + EAX [ ESI ] IMUL 0 JNO fixup \ fixnum* compile-call 0 JMP fixup >r compiled-offset swap patch - ECX 4 SUB - [ ECX ] EAX MOV - ECX >DS + ESI 4 SUB + [ ESI ] EAX MOV r> compiled-offset swap patch ] "generator" set-word-property @@ -91,18 +87,16 @@ USE: math-internals \ fixnum/i [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV CDQ - [ ECX ] IDIV + [ ESI ] IDIV EAX 3 SHL 0 JNO fixup \ fixnum/i compile-call 0 JMP fixup >r compiled-offset swap patch - ECX 4 SUB - [ ECX ] EAX MOV - ECX >DS + ESI 4 SUB + [ ESI ] EAX MOV r> compiled-offset swap patch ] "generator" set-word-property @@ -110,18 +104,16 @@ USE: math-internals \ fixnum-mod [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV CDQ - [ ECX ] IDIV + [ ESI ] IDIV EAX 3 SHL 0 JNO fixup \ fixnum/i compile-call 0 JMP fixup >r compiled-offset swap patch - ECX 4 SUB - [ ECX ] EDX MOV - ECX >DS + ESI 4 SUB + [ ESI ] EDX MOV r> compiled-offset swap patch ] "generator" set-word-property @@ -129,18 +121,16 @@ USE: math-internals \ fixnum/mod [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV CDQ - [ ECX ] IDIV + [ ESI ] IDIV EAX 3 SHL 0 JNO fixup \ fixnum/mod compile-call 0 JMP fixup >r compiled-offset swap patch - [ ECX -4 ] EAX MOV - [ ECX ] EDX MOV - ECX >DS + [ ESI -4 ] EAX MOV + [ ESI ] EDX MOV r> compiled-offset swap patch ] "generator" set-word-property @@ -148,10 +138,9 @@ USE: math-internals \ arithmetic-type [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV EAX BIN: 111 AND - EDX [ ECX ] MOV + EDX [ ESI ] MOV EDX BIN: 111 AND EAX EDX CMP 0 JE fixup >r diff --git a/library/compiler/x86/generator.factor b/library/compiler/x86/generator.factor index 1a6bdbce3b..568c82f1dd 100644 --- a/library/compiler/x86/generator.factor +++ b/library/compiler/x86/generator.factor @@ -6,9 +6,8 @@ math memory namespaces words ; \ slot [ PEEK-DS - ( EAX [ EAX 3 ] MOV ) 2unlist type-tag >r cell * r> - EAX swap 2list EAX swap MOV - [ ECX ] EAX MOV + [ ESI ] EAX MOV ] "generator" set-word-property : compile-call-label ( label -- ) diff --git a/library/compiler/x86/stack.factor b/library/compiler/x86/stack.factor index 8c49b996d8..d52e379eea 100644 --- a/library/compiler/x86/stack.factor +++ b/library/compiler/x86/stack.factor @@ -3,15 +3,6 @@ IN: compiler USING: inference kernel assembler words lists alien memory ; -: rel-ds ( -- ) - #! Add an entry to the relocation table for the 32-bit - #! immediate just compiled. - "ds" f f rel-dlsym ; - -: DS ( -- [ address ] ) "ds" f dlsym unit ; -: DS> ( register -- ) DS MOV rel-ds ; -: >DS ( register -- ) DS swap MOV rel-ds ; - : rel-cs ( -- ) #! Add an entry to the relocation table for the 32-bit #! immediate just compiled. @@ -23,20 +14,17 @@ USING: inference kernel assembler words lists alien memory ; : PEEK-DS ( -- ) #! Peek datastack to EAX. - ECX DS> - EAX [ ECX ] MOV ; + EAX [ ESI ] MOV ; : POP-DS ( -- ) #! Pop datastack to EAX. PEEK-DS - ECX 4 SUB - ECX >DS ; + ESI 4 SUB ; : PUSH-DS ( -- ) #! Push EAX to datastack. - ECX 4 ADD - [ ECX ] EAX MOV - ECX >DS ; + ESI 4 ADD + [ ESI ] EAX MOV ; : PEEK-CS ( -- ) #! Peek return stack to EAX. @@ -56,41 +44,33 @@ USING: inference kernel assembler words lists alien memory ; ECX >CS ; : immediate-literal ( obj -- ) - [ ECX ] swap address MOV ; + [ ESI ] swap address MOV ; : indirect-literal ( obj -- ) - ( EAX [ obj ] MOV ) EAX swap intern-literal unit MOV rel-address ; #push-immediate [ - ECX DS> - ECX 4 ADD + ESI 4 ADD immediate-literal - ECX >DS ] "generator" set-word-property #push-indirect [ - ECX DS> indirect-literal PUSH-DS ] "generator" set-word-property #replace-immediate [ - ECX DS> immediate-literal ] "generator" set-word-property #replace-indirect [ - ECX DS> indirect-literal - [ ECX ] EAX MOV + [ ESI ] EAX MOV ] "generator" set-word-property \ drop [ drop - ECX DS> - ECX 4 SUB - ECX >DS + ESI 4 SUB ] "generator" set-word-property \ dup [ @@ -101,24 +81,21 @@ USING: inference kernel assembler words lists alien memory ; \ swap [ drop - ECX DS> - EAX [ ECX ] MOV - EDX [ ECX -4 ] MOV - [ ECX ] EDX MOV - [ ECX -4 ] EAX MOV + EAX [ ESI ] MOV + EDX [ ESI -4 ] MOV + [ ESI ] EDX MOV + [ ESI -4 ] EAX MOV ] "generator" set-word-property \ over [ drop - ECX DS> - EAX [ ECX -4 ] MOV + EAX [ ESI -4 ] MOV PUSH-DS ] "generator" set-word-property \ pick [ drop - ECX DS> - EAX [ ECX -8 ] MOV + EAX [ ESI -8 ] MOV PUSH-DS ] "generator" set-word-property @@ -132,6 +109,5 @@ USING: inference kernel assembler words lists alien memory ; \ r> [ drop POP-CS - ECX DS> PUSH-DS ] "generator" set-word-property diff --git a/native/factor.h b/native/factor.h index dc1e0143e0..1dc542d37b 100644 --- a/native/factor.h +++ b/native/factor.h @@ -19,7 +19,7 @@ typedef unsigned long int CELL; CELL ds_bot; /* raw pointer to datastack top */ -DLLEXPORT CELL ds; +register DLLEXPORT CELL ds asm("esi"); /* raw pointer to callstack bottom */ CELL cs_bot;