Hi .I am trying to compile gcc.pli module ( /pliant/language/optimizer/gcc.pli ).In the gcc.pli module there are some functions which are defined (such as error ,Shunt etc.).But these all Functions are already defined in some other module which are included in gcc.pli .

My questions are 1. Is it a try to Modify or Change the Functions. ? 2. If yes i) In what way it is possible ? ii) If not what is actually happening in gcc.pli ?

If you issue a command such as:pliant module /pliant/install/gcc.plithen what Pliant do is first load the default dump file (to avoiddynamically recompiling everything from scratch any time),then try to compile gcc.pliHere is why you get the error: the basic functions defined in gcc.pli havebeen loaded from the dump file.If you want to avoid loading the default dump file, just do:pliant reset module /pliant/install/gcc.pli

Here are a few more informations about the gcc.pli very special module:

gcc.pli must be compiled as the very first module,not after loading all modules contained in the standard dump file.It is intended to be loaded by module /pliant/install/ring1.plias a result of 'use_gcc' constant in this module to resolve as true.This is obtained through changing the this_computer.pdb main configuration file.

This is for production machine. On the other hand, if you want to debug gcc.plithen you should use some command like this one:pliant verbose 2 reset module /pliant/language/optimizer/gcc.pli module /pliant/install/precompile.pli'verbose 2' will display each line of code before compiling it,'reset' prevents the default dump file to be loaded.

In this case gcc.pli is compiled and after the compilation of gcc.pli , the compilation of precompile.pli take place.when precompile.pli is compiling I got the following error

Failed to compile error (Str r)

Now what is happening ?

I think we are using 'reset' , and because of this ,it may not found the definition of error , because default.dump file is not loaded .

But we are compiling gcc.pli first , and it has the definition of error . I think after the compilation of gcc.pli there should not be any issue like this because it has definition .If it is not true what is the reason of the above error.

Now the question is , why we are compiling precompile.pli after the compilation of gcc.pli ?

The other thing is , If we compile gcc.pli with reset , it dont give any error .And after the compilation of gcc.pli , I try to compile a module (which has only a function) with including gcc.pli without reset ,it gives the same previous ambiguous error .

What is the reason of this ?

And how to remove these error ?

Please guide me .

Message posted by maybe Hubert Tonneau on2009/02/25 14:29:40

> Now the question is , why we are compiling precompile.pli after the compilation of gcc.pli ?

Just because if this one is big enough to test the GCC interface be fullyworking.

You could as well change /pliant/sample/fact.pli with the listing bellow (oneline added), and try:pliant reset module /pliant/language/optimizer/gcc.pli module /pliant/sample/fact.pli

> The other thing is , If we compile gcc.pli with reset , it dont give any error .> And after the compilation of gcc.pli , I try to compile a module (which has only a function) with including gcc.pli without reset ,> it gives the same previous ambiguous error .

This is a dynamic compiler, not a static one !When you compile gcc.pli in one 'pliant' command, then issue a second one,the effect of the first one has been lost unless it generated a .dump file.

If you want to test your gcc interface, you have to start all your commandswith something like:pliant reset module /pliant/language/optimizer/gcc.pli ...

minimal.pli is the module you have to include to get a full Pliant language (pleaseremind that parts of Pliant are defined in C, and parts are defined in Pliant).precompile.pli is a larger set of module that contain what most applicationsare expected to need anyway so that it worth precompiling all this in thedefault dump file.

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

New version of /pliant/sample/fact.pli:

function fact x -> y arg Int x y if x=0 y := 1 else y := x*(fact x-1)

export fact

console ('convert to string' fact:5)+"[lf]" # added line

Message posted by maybe Md Muzzammil Ansari on2009/02/26 13:21:32

Hello Hubert .

I follow your suggestion and get success to compile gcc.pli with fact.pli with the command

gcc.pli currently inserts two stages in the Pliant code generator machinery:'generate_c_code' mainly calls 'generate_c_listing' to get a C equivalentlisting of the current function,'use_c_compiled_code' mainly calls 'load_compiled_code' to parse the 'as'output and put back the optimized executable version of the function back inPliant process memory.

So, if you want an external executable for your application,then you have to modify 'generate_c_listing' to make the C listing less relatedto Pliant current process memory layout (objects and some functions are currenlyreferenced directly by their address in the current Pliant process memory),then you have to remove the 'load_compiled_code' because what you want is nomore a better code generator for Pliant.