[Vm-dev] How to think about cogit.c compile error that is consistent in both gnu an cmake builds

gettimothy gettimothy at zoho.com
Tue Jul 22 17:38:47 UTC 2014


Hi Eliot.

Thank you. I have to switch gears for a couple of days to make some $$. I will study this in detail later this week.


Cordially,

tty

---- On Tue, 22 Jul 2014 08:59:12 -0700 Eliot Miranda <eliot.miranda at gmail.com> wrote ---- 


 Hi Timothy,


On Sun, Jul 20, 2014 at 12:40 PM, gettimothy <gettimothy at zoho.com> wrote:
  
 Hi Eliot.



I was able to get the code to compile by modifiying the function declarations in cogit.c and gcc3x-interp.c


Apologies in advance if my terms are not exact--I am a bit tired and my brain is duller than usual.
 

Taking the first compile error as representative,

 
/home/wm/usr/src/smalltalk/CMake.oscog/cogVMMaker/Contents/Resources/oscogvm/src/vm/cogit.c:1820:1: error: conflicting types for 'abstractRegisterForConcreteRegister'
 abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg)
 ^
/home/wm/usr/src/smalltalk/CMake.oscog/cogVMMaker/Contents/Resources/oscogvm/src/vm/cogit.c:384:14: note: previous declaration of 'abstractRegisterForConcreteRegister' was here
 static sqInt abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg) NoDbgRegParms;


 the problem was the "NoDbgRegParms" tacked on to the end of the function declaration at line 384 and not being there on the function implementation at 1820--that error happened for all the declarations.
 



Read the commit comment for r2922:


Slang:
In non-production VMs add an attribute to disable register parameters (at least
for GCC-compliant compilers), allowing all static functions to be called from
 gdb even in the -O1 assert VMs.



These defines, which precede the external declaration of e.g. abstractRegisterForConcreteRegister:


#if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms)
 # define NoDbgRegParms __attribute__ ((regparm (0)))
#endif


#if !defined(NoDbgRegParms)
# define NoDbgRegParms /*empty*/
#endif


should result in 
 

static sqInt abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg) __attribute__ ((regparm (0)));
...
static sqInt
 abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg)
{
...




or



 static sqInt abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg);
...
static sqInt
abstractRegisterForConcreteRegister(AbstractInstruction * self_in_abstractRegisterForConcreteRegister, sqInt reg)
 {
...


The first is legal input to gcc.  The second is legal C.
 
 you can see them here:




 http://www.squeakvm.org/svn/squeak/branches/Cog/src/vm/cogit.c
 


I noticed too that my old branch did not have those NoDbgRegParms tacked on while the live Cog trunk does.
 



So, I edited both cogit.c and gcc3x-cointerp.c and got rid of those NoDbgRegParms and then torched the -DNDEBUG -DDEBUGVM flags and the thing compiled in both cmake and make and ran.
 
(The cmake version does use the -D flags)




It will be a couple of days before I can devote a study session to your email on the assertion inlining stuff. I just wanted to bring this to your attention  in case some 'assertion inlined code' was submitted to svn if such a thing is possible.
 

Thanks for your pointers on the -w stuff. I have always lived in fear of gcc output, but I am starting to look at it logically;  I am beginning to see the outlines of a forest for the trees (:
 



cordially,


tty.





-- 
Aloha,Eliot
 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140722/70d13a3c/attachment.htm


More information about the Vm-dev mailing list