A forum for Spin users

You are not logged in.

#1 2011-01-31 15:13:18

From: China
Registered: 2011-01-27
Posts: 30

Extract Function for Concurrent Callers with MODEX?

MODEX has option to extract callable functions with -L -E or -L -e and Icall can be used on the caller side. But I found this extraction cannot correctly simulate the scenario of concurrent callers. For example,

void thread1_entry()

void thread2_entry()

void A();
  // do some complex stuff

The thread1_entry() and thread2_entry() run concurrently and can be extracted with -L -a directly. I can also use "%X -L A -E A" to extract function A(), but the problem is that there is only one process for A() so A() cannot be re-entered. But in real C code, A() can be re-entered and called concurrently by the two threads.

A possible way to solve this issue is to map A() as inline. But I found it is not easy to handle function parameters and return value then. Especially if A() has a deep call tree, like A() calls B(), B() calls C() etc. This will produce many inline functions and make things even worse...

Is there any better way to handle this issue? Thanks!

Last edited by jiong (2011-01-31 15:14:34)


#2 2011-01-31 18:52:32

Registered: 2010-11-18
Posts: 694

Re: Extract Function for Concurrent Callers with MODEX?

good point. no i don't think there's an easy way.
spin isn't good at modeling general function calls,
so this is a problem
if it is possible to rewrite the C code that modex
is called on, that could help, but that is of course
not always an option


Board footer

Powered by FluxBB