[fpc-devel] executing code snippets
Michael Schnell
mschnell at lumino.de
Mon Jan 26 10:29:32 CET 2015
Hi Linux and Java experts,
My son is about to start a project that aims to research variations in
small code snippets that are automatically generated by a kind of compiler.
Of course he uses fpc to do the "testing system", that also includes the
"compiler".
Now he needs to start the code snippets. As the system needs to do
billions of "starts" of such snippets, which are very small, saving them
in files as an executable does not seem appropriate.
We discussed the protection features done by the MMU hardware and agreed
to try two different ways to accomplish the task of running the code
snippets in a "sandbox".
1) The "traditional Linux" way would be to have the main process create
the code to be started in a RAM area *as X86-64 native code* and then
use "fork()" with the appropriate options to start it as a newly spawned
process. Here the question is how to use fork() (from fpc) for exactly
this: i.e. the code area needs to be "writable data" for the parent
process and "protected code" for the child. (Linux experts, please...)
2) The "modernistic" way would be to have the main process create the
code to be started in a RAM area *as Java Byte code* and then call a
Java "just-in-time" engine (as a DLL) to execute it. Here the question
is how an already initialized, extremely lightweight Java engine can be
called from fpc to execute a Byte Code sequence residing in the parent's
RAM, in a protected way. (Java experts, please...)
Thanks in Advance,
-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150126/85607646/attachment.html>
More information about the fpc-devel
mailing list