- Subject: Re: [slang-users] Using the tcc module
- From: "John E. Davis" <jed@xxxxxxxxxxx>
- Date: Thu, 21 Jan 2021 02:32:08 -0500
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> I saw some exciting posts in the archives about an embedded, jit C compiler
> – tcc. I wonder how the support is going, is the module in the main S-Lang
> distribution maybe? In general I would like to know how to run my first C
> code (`printf("hi");`, probably) from within a S-Lang script. I'm working
> on a S-Lang support in Midnight Commander (mcedit, mainly), I think that
> such C support would be a nice extension/sophistication of it.
The slang interpreter provides interfaces to many C functions,
including printf. So, I am not sure exactly what you mean.
The promising thing about tcc is that one would be able to execute
small code fragments that cannot be vectorized much faster than is
possible by the interpreter.
The one thing stopping me from adding the module to the distribution
is that current implementation does not guarantee that a user cannot
crash the interpreter and the application embedding it via interpreter
statements. For example, suppose the slang interpreter invokes tcc
via an intrinsic called `tcc`:
define some_function ()
{
.
% interpreter code
%
% now involke tcc to evaluate something
%
result = tcc ("x=*0;");
}
Invoking `some_function` will crash the application via the NULL
pointer dereference. I think that the only way to avoid this would be
for tcc to run as a separate process. Then the problem becomes how
best to communicate the result of the computation back to the
interpreter.
Agathoklis Chatzimanikas has worked quite a bit on this and would be
the person to comment on its current state.
--John
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.
[2021 date index]
[2021 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]