On Thursday 02 January 2003 08:06, Robert Epprecht wrote:
> In gforth 0.5.0 I did
>
> : xt>string ( xt -- addr length )   look IF name>string THEN ;
>
> ' 0=  xt>string  cr type
> 0= ok
>
>
> This worked fine (at least in all situations that I used it).
> But In 0.5.9 it fails often:
>
> GForth 0.5.9-20021227
> ' words  xt>string  cr type
> words ok
>
> but:
>
> ' 0=  xt>string  cr type
> *the terminal*:8: Stack underflow
> ' 0=  xt>string  cr type
>                     ^^^^
> Backtrace:
> $40162294 write-file
>
>
> ' 0= xt>string  cr .s
> <1> 0  ok

Ah, that's because look doesn't know about mixed threading (xts obtained by ' 
and given to execute are indirect threaded, xts compiled are direct 
threaded). Since there's already an intermediate step to get from the 
supposed xt to the real code address (decompile-prim), I put the necessary 
code into the C code that knows which sort of threading there is. Add the 
lines marked with ! to decompile_code in main.c:

  Label decompile_code(Label code)
  {
! #ifdef DIRECT_THREADED
!   if((code >= (Cell)vm_prims) && (code < (Cell)(vm_prims+npriminfos)))
!     return *(Label *)code;
! #endif
  #ifdef NO_DYNAMIC
    return code;

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to