<translate: false>?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

<translate: false>?

Andreas.Raab
 
Hi -

I haven't been following all this stuff but do we nowadays have some
pragma/annotation that actually prevents the code generator to translate
a particular method? The reason I'm asking is that it would be quite
helpful if one could augment a plugin with utility functions that map to
standard (or included) C functions along the lines of:

MyPlugin>>strlen: strPtr
   "Simulated function strlen(). Not translated."
   <translate: false>
   ^strPtr indexOf: 0 asCharacter ifAbsent:[self error: 'core dump'].

Cheers,
   - Andreas
Reply | Threaded
Open this post in threaded view
|

Re: <translate: false>?

Eliot Miranda-2
 
Hi Andreas,

    in the Qwaq VMMaker we do.  I would therefore ask that if this is implemented in the Squeak VMMaker (remember ossi ;) ) that we use the same pragma.  I'm using <doNotGenerate>.  Using this approach I don't need a simulator class for the JIT part of the Cog VM.  All its Smalltalk-only debug code is marked <doNotGenerate> or uses self cCode: '' inSmalltalk: [...simulation code...].

On Wed, Sep 16, 2009 at 11:05 AM, Andreas Raab <[hidden email]> wrote:

Hi -

I haven't been following all this stuff but do we nowadays have some pragma/annotation that actually prevents the code generator to translate a particular method? The reason I'm asking is that it would be quite helpful if one could augment a plugin with utility functions that map to standard (or included) C functions along the lines of:

MyPlugin>>strlen: strPtr
 "Simulated function strlen(). Not translated."
 <translate: false>
 ^strPtr indexOf: 0 asCharacter ifAbsent:[self error: 'core dump'].

Cheers,
 - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: <translate: false>?

Andreas.Raab
 
Thanks, I should read our own code more carefully ;-)

   - A.

Eliot Miranda wrote:

>  
>
>
> ------------------------------------------------------------------------
>
> Hi Andreas,
>
>     in the Qwaq VMMaker we do.  I would therefore ask that if this is
> implemented in the Squeak VMMaker (remember ossi ;) ) that we use the
> same pragma.  I'm using <doNotGenerate>.  Using this approach I don't
> need a simulator class for the JIT part of the Cog VM.  All its
> Smalltalk-only debug code is marked <doNotGenerate> or uses self cCode:
> '' inSmalltalk: [...simulation code...].
>
> On Wed, Sep 16, 2009 at 11:05 AM, Andreas Raab <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>
>     Hi -
>
>     I haven't been following all this stuff but do we nowadays have some
>     pragma/annotation that actually prevents the code generator to
>     translate a particular method? The reason I'm asking is that it
>     would be quite helpful if one could augment a plugin with utility
>     functions that map to standard (or included) C functions along the
>     lines of:
>
>     MyPlugin>>strlen: strPtr
>      "Simulated function strlen(). Not translated."
>      <translate: false>
>      ^strPtr indexOf: 0 asCharacter ifAbsent:[self error: 'core dump'].
>
>     Cheers,
>      - Andreas
>
>
Reply | Threaded
Open this post in threaded view
|

Re: <translate: false>?

Eliot Miranda-2
 
Andreas,

On Wed, Sep 16, 2009 at 11:55 AM, Andreas Raab <[hidden email]> wrote:

Thanks, I should read our own code more carefully ;-)

I just made a nice change, modifying cCode:inSmalltalk: and the translation machinery so that cCode:inSmalltalk: can also take a block as its first argument.  Then you can say in Smalltalk stuff that you don't want to have to translate to literal C, and avoid having to simulate it.  e.g.

self cCode:
[self mem: (self cCoerceSimple: savedReenterInterpreter to: #'void *')
cp: reenterInterpreter
y: (self sizeof: #'jmp_buf' asSymbol)]
inSmalltalk:
[savedReenterInterpreter := reenterInterpreter].
 

 - A.

Eliot Miranda wrote:
 

------------------------------------------------------------------------


Hi Andreas,

   in the Qwaq VMMaker we do.  I would therefore ask that if this is implemented in the Squeak VMMaker (remember ossi ;) ) that we use the same pragma.  I'm using <doNotGenerate>.  Using this approach I don't need a simulator class for the JIT part of the Cog VM.  All its Smalltalk-only debug code is marked <doNotGenerate> or uses self cCode: '' inSmalltalk: [...simulation code...].

On Wed, Sep 16, 2009 at 11:05 AM, Andreas Raab <[hidden email] <mailto:[hidden email]>> wrote:


   Hi -

   I haven't been following all this stuff but do we nowadays have some
   pragma/annotation that actually prevents the code generator to
   translate a particular method? The reason I'm asking is that it
   would be quite helpful if one could augment a plugin with utility
   functions that map to standard (or included) C functions along the
   lines of:

   MyPlugin>>strlen: strPtr
    "Simulated function strlen(). Not translated."
    <translate: false>
    ^strPtr indexOf: 0 asCharacter ifAbsent:[self error: 'core dump'].

   Cheers,
    - Andreas




slang-ccode-takes-block.st (1K) Download Attachment