Diff for /gforth/prim between versions 1.139 and 1.146

version 1.139, 2003/08/20 09:23:45 version 1.146, 2003/10/09 20:25:59
Line 136 Line 136
 \ throw execute, cfa and NEXT1 out?  \ throw execute, cfa and NEXT1 out?
 \ macroize *ip, ip++, *ip++ (pipelining)?  \ macroize *ip, ip++, *ip++ (pipelining)?
   
   \ Stack caching setup
   
   \E register IPTOS Cell
   \E register spa Cell
   \E register spb Cell
   \E register spc Cell
   \E register spd Cell
   
   \E create IPregs IPTOS ,
   \E create regs spc , spb , spa ,
   
   \E IPregs 1 0 stack-state IPss1
   \E regs 3 cells + 0 0 stack-state ss0
   \E regs 2 cells + 1  0 stack-state ss1
   \E regs 1 cells + 2  1 stack-state ss2
   \E regs 0 cells + 3  2 stack-state ss3
   
   \ the first of these is the default state
   \E state S0
   \E state S1
   \E state S2
   \E state S3
   
   \E ss0 data-stack S0 set-ss
   \E ss1 data-stack S1 set-ss
   \E ss2 data-stack S2 set-ss
   \E ss3 data-stack S3 set-ss
   
   \E IPss1 inst-stream S0 set-ss
   \E IPss1 inst-stream S1 set-ss
   \E IPss1 inst-stream S2 set-ss
   \E IPss1 inst-stream S3 set-ss
   
   \E data-stack to cache-stack
   \E here 4 cache-states 2! s0 , s1 , s2 , s3 ,
   
   \ !! the following should be automatic
   \E S0 to state-default
   \E state-default to state-in
   \E state-default to state-out
   
 \ these m4 macros would collide with identifiers  \ these m4 macros would collide with identifiers
 undefine(`index')  undefine(`index')
 undefine(`shift')  undefine(`shift')
 undefine(`symbols')  undefine(`symbols')
   
   \F 0 [if]
   
 \ run-time routines for non-primitives.  They are defined as  \ run-time routines for non-primitives.  They are defined as
 \ primitives, because that simplifies things.  \ primitives, because that simplifies things.
   
 (docol) ( -- R:a_retaddr )      gforth-internal paren_docol  (docol) ( -- R:a_retaddr )      gforth-internal paren_docol
 ""run-time routine for colon definitions""  ""run-time routine for colon definitions""
 a_retaddr = (Cell *)ip;  a_retaddr = (Cell *)IP;
 SET_IP((Xt *)PFA(CFA));  SET_IP((Xt *)PFA(CFA));
   
 (docon) ( -- w )        gforth-internal paren_docon  (docon) ( -- w )        gforth-internal paren_docon
Line 163  a_user = (Cell *)(up+*(Cell *)PFA(CFA)); Line 206  a_user = (Cell *)(up+*(Cell *)PFA(CFA));
   
 (dodefer) ( -- )        gforth-internal paren_dodefer  (dodefer) ( -- )        gforth-internal paren_dodefer
 ""run-time routine for deferred words""  ""run-time routine for deferred words""
 SUPER_END;  ip=IP; /* undo any ip updating that may have been performed by NEXT_P0 */
   SUPER_END; /* !! probably unnecessary and may lead to measurement errors */
 EXEC(*(Xt *)PFA(CFA));  EXEC(*(Xt *)PFA(CFA));
   
 (dofield) ( n1 -- n2 )  gforth-internal paren_field  (dofield) ( n1 -- n2 )  gforth-internal paren_field
Line 172  n2 = n1 + *(Cell *)PFA(CFA); Line 216  n2 = n1 + *(Cell *)PFA(CFA);
   
 (dodoes) ( -- a_body R:a_retaddr )      gforth-internal paren_dodoes  (dodoes) ( -- a_body R:a_retaddr )      gforth-internal paren_dodoes
 ""run-time routine for @code{does>}-defined words""  ""run-time routine for @code{does>}-defined words""
 a_retaddr = (Cell *)ip;  a_retaddr = (Cell *)IP;
 a_body = PFA(CFA);  a_body = PFA(CFA);
 SET_IP(DOES_CODE1(CFA));  SET_IP(DOES_CODE1(CFA));
   
Line 180  SET_IP(DOES_CODE1(CFA)); Line 224  SET_IP(DOES_CODE1(CFA));
 ""just a slot to have an encoding for the DOESJUMP,   ""just a slot to have an encoding for the DOESJUMP, 
 which is no longer used anyway (!! eliminate this)""  which is no longer used anyway (!! eliminate this)""
   
   \F [endif]
   
 \g control  \g control
   
 noop    ( -- )          gforth  noop    ( -- )          gforth
Line 633  n = compare(c_addr1, u1, c_addr2, u2); Line 679  n = compare(c_addr1, u1, c_addr2, u2);
 :  :
  rot 2dup swap - >r min swap -text dup   rot 2dup swap - >r min swap -text dup
  IF  rdrop  ELSE  drop r> sgn  THEN ;   IF  rdrop  ELSE  drop r> sgn  THEN ;
   : -text ( c_addr1 u c_addr2 -- n )
    swap bounds
    ?DO  dup c@ I c@ = WHILE  1+  LOOP  drop 0
    ELSE  c@ I c@ - unloop  THEN  sgn ;
 : sgn ( n -- -1/0/1 )  : sgn ( n -- -1/0/1 )
  dup 0= IF EXIT THEN  0< 2* 1+ ;   dup 0= IF EXIT THEN  0< 2* 1+ ;
   
Line 1391  longname2=listlfind(c_addr, u, longname1 Line 1441  longname2=listlfind(c_addr, u, longname1
     REPEAT  THEN  nip nip ;      REPEAT  THEN  nip nip ;
 : (findl-samelen) ( u longname1 -- u longname2/0 )  : (findl-samelen) ( u longname1 -- u longname2/0 )
     BEGIN  2dup cell+ @ lcount-mask and <> WHILE  @  dup 0= UNTIL  THEN ;      BEGIN  2dup cell+ @ lcount-mask and <> WHILE  @  dup 0= UNTIL  THEN ;
   : capscomp ( c_addr1 u c_addr2 -- n )
    swap bounds
    ?DO  dup c@ I c@ <>
        IF  dup c@ toupper I c@ toupper =
        ELSE  true  THEN  WHILE  1+  LOOP  drop 0
    ELSE  c@ toupper I c@ toupper - unloop  THEN  sgn ;
   : sgn ( n -- -1/0/1 )
    dup 0= IF EXIT THEN  0< 2* 1+ ;
   
 \+hash  \+hash
   
Line 2262  u3 = 0; Line 2320  u3 = 0;
 #  endif  #  endif
 #endif  #endif
   
   wcall   ( u -- )        gforth
   IF_fpTOS(fp[0]=fpTOS);
   FP=fp;
   sp=(Cell*)(SYSCALL(Cell*(*)(Cell *, void *))u)(sp, &FP);
   fp=FP;
   IF_spTOS(spTOS=sp[0];)
   IF_fpTOS(fpTOS=fp[0]);
   
 \+FFCALL  \+FFCALL
   
 av-start-void   ( c_addr -- )   gforth  av_start_void  av-start-void   ( c_addr -- )   gforth  av_start_void
Line 2411  va-return-double ( r -- ) gforth va_retu Line 2477  va-return-double ( r -- ) gforth va_retu
 va_return_double(clist, r);  va_return_double(clist, r);
 return 0;  return 0;
   
 \-  \+
   
   \+OLDCALL
   
 define(`uploop',  define(`uploop',
        `pushdef(`$1', `$2')_uploop(`$1', `$2', `$3', `$4', `$5')`'popdef(`$1')')         `pushdef(`$1', `$2')_uploop(`$1', `$2', `$3', `$4', `$5')`'popdef(`$1')')
Line 2452  fcall(20) Line 2520  fcall(20)
 \+  \+
 \+  \+
   
 wcall   ( u -- )        gforth  \g peephole
 IF_fpTOS(fp[0]=fpTOS);  
 FP=fp;  
 sp=(Cell*)(SYSCALL(Cell*(*)(Cell *, void *))u)(sp, &FP);  
 fp=FP;  
 IF_spTOS(spTOS=sp[0];)  
 IF_fpTOS(fpTOS=fp[0]);  
   
 \+peephole  \+peephole
   
 \g peephole  
   
 compile-prim1 ( a_prim -- ) gforth compile_prim1  compile-prim1 ( a_prim -- ) gforth compile_prim1
 ""compile prim (incl. immargs) at @var{a_prim}""  ""compile prim (incl. immargs) at @var{a_prim}""
 compile_prim1(a_prim);  compile_prim1(a_prim);

Removed from v.1.139  
changed lines
  Added in v.1.146


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>