About producing assembly code for a simple concurrent programming language.

climber.cui@gmail.com
Sat, 23 Jun 2007 21:30:23 -0700

          From comp.compilers

Related articles
About producing assembly code for a simple concurrent programming lang climber.cui@gmail.com (2007-06-23)
| List of all articles for this month |

From: climber.cui@gmail.com
Newsgroups: comp.compilers
Date: Sat, 23 Jun 2007 21:30:23 -0700
Organization: Compilers Central
Keywords: parallel, question, code
Posted-Date: 25 Jun 2007 03:22:25 EDT

Hi All,


      I am going to implement a very simple concurrent progamming
language, which is desined on top of subset of Pascal. At the
beginning, I thought I better learn from existing implemenations, so I
looked at SR and GNAT ada. I spent most of my time on GNAT Ada's
implemenation on its tasking features(that support concurrent
programming). However, what I found out from GNAT is that it ueses
POSIX standard library and Pthread to implement tasking, and the GNAT
compiler produces a GCC-tree for the GCC backend; nevertheless, I am
required to write a compiler that directly produce assembly code(for
Intel architectures). Am I wasting my time if I continue my
investigation on GNAT Ada?


      I guess what I need to figure out is how to translate a concurrent
program into its assembly counterpart, according to the language's
semantic. For sequential programs, such translation is not hard. But
when it comes to concurrent programming, this is not trivial. Does
anyone know any relevant literatures / open-source project?


      Also, another thing I am concerned with is the "Intel architecture
software developer's manual". It conists of 3 volumes. I wonder if
this manual provides information on multi-threading in assembly
programming.


      Any suggestion is deeply appreciated..


cheers,
Tony


[Generating code for a concurrent language isn't very different from
generating code for any other kind of language. The main thing you
may need to do differently is to make the code reentrant if a routine
can be running instances in more than one thread. This typically
means referencing all the routine's local storage relative to a
register rather than directly, so your startup code can allocate a
suitably sized chunk for each thread and point the register at one
chunk per thread. You'll also need some sort of coroutine setup
to switch among threads. These are typically covered in operating
system texts rather than compiler texts. The Intel architecture manual
is pretty good but I wouldn't expect to find much there relevant
to concurrency or coroutines. -John]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.