I was not able to find where the NoDbgRegParms flag is set (Perhaps somebody's dev env or in Jenkins) but setting it empty in the mvm on the CFLAGS line works.
CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -DNoDbgRegParms= " \
Having solved the 'compile using the old build system on my boxen' problem I will be returning to the Squeak coding tomorrow.
cheers.
tty
Hi Tim,
hmm that's weird. Can you verify that using -UNoDbgRegParms in place of -DNoDbgRegParms works? -U means undefine. This dies look like some kind of cpp bug.
Eliot (phone)
On Nov 16, 2014, at 12:08 PM, gettimothy gettimothy@zoho.com wrote:
I was not able to find where the NoDbgRegParms flag is set (Perhaps somebody's dev env or in Jenkins) but setting it empty in the mvm on the CFLAGS line works.
CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -DNoDbgRegParms= " \
Having solved the 'compile using the old build system on my boxen' problem I will be returning to the Squeak coding tomorrow.
cheers.
tty
>Hi Tim,
> hmm that's weird. Can you verify that using -UNoDbgRegParms in place of -DNoDbgRegParms works? -U means undefine. This dies look like some kind of cpp bug.
>Eliot (phone)
Hi Eliot,
CFLAGS="$OPT -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -UNoDbgRegParms" \ does NOT work.
I will spend some time googling this tomorrow and see what I can dig up. Good to know it could be a bug. I now have the confidence to continue my CMake debugging.
cordially,
tty.
Hi Eliot,
After searching this morning, I got nuffin.
I have tried Unset CFLAGS in the mvm before the confugure call. I have tried using the CPPFLAGS (c-preprocessor flags) to set the -UNoDbgRegParms and no go there either.
I am going to put his aside and move on to the CMAKE stuff. I needed to get this solved in the autotools suite to eliminate my CMake code as a source of error.
While the auto-tools error is not solved, I am able to move back to CMake with some confidence. I need to ramp back up on what I was doing there.
If I run into anything, I will pass it along.
thx.
tty
On Mon, Nov 17, 2014 at 8:40 AM, gettimothy gettimothy@zoho.com wrote:
Hi Eliot,
After searching this morning, I got nuffin.
I have tried Unset CFLAGS in the mvm before the confugure call. I have tried using the CPPFLAGS (c-preprocessor flags) to set the -UNoDbgRegParms and no go there either.
Instead of working at a high level dive down to try and localise the problem. You can use /lib/cpp directly with a simple test case to try and identify the bug.
I am going to put his aside and move on to the CMAKE stuff. I needed to get this solved in the autotools suite to eliminate my CMake code as a source of error. While the auto-tools error is not solved, I am able to move back to CMake with some confidence. I need to ramp back up on what I was doing there.
If I run into anything, I will pass it along.
thx.
tty
Instead of working at a high level dive down to try and localise the problem. You can use /lib/cpp directly with a simple test case to try and identify the bug.
heh.
/lib/cpp is an actual program and not just a canon of incantations one mumbles while flayling about and scribbling in obscure shell scripts?
Who'd of thunk it?
Thank you.
Doing so would have never occurred to me; it should be fun.
I am going to spend a bit of time refreshing my memory of the buildXYZ.sh scripts and then turn my attention to that.
Thanks for the pointers.
cordially,
tty
>>Instead of working at a high level dive down to try and localise the problem. You can use /lib/cpp directly with a simple test case to try and identify the bug.
I am posting this in hopes the answer is obvious to somebody.
Short answer: after creating a radically stripped down version of the Cog/src/vm source code, gcc -E gcc3x-cointerp.c correctly replaces the NoDbgRegParms, alternativelly, cpp gcc3x-cointerp.c correctly replaces the NoDbgRegParms as well. ditto on cogit.c and cointerp.c as well.
but when invoking mvm on the same it is not replaced. The reason is that at compile time for cogit.c NoDbgRegParms is defined and the #if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif test is never entered in cogit.h (c) (the test is duplicated in both headers and c files)
I added the CFLAG -no-integrated-cpp to force a distinct cpp pass before compiling. I added the CFLAG -Wundef. which "-Wundef Warn whenever an identifier which is not a macro is encountered in an ‘#if’ directive, outside of ‘defined’. Such identifiers are replaced with zero." examining the LOG file, this warning was not triggered in cogit.c (which tells me NoDbgRegParms is defined.
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif test.
I did some experimenting using #ifndef NoDbgRegParms instead of if !defined(NoDbgRegParms) to no avail. I Put include gaurds around cogit.h and cointerp.h (#ifndef COGIT_H #define COGIT_H (all the original header file here) #ENDIF
DUPLICATING THIS AT HOME (I am at Cog revision 3143):
In Cog/src/vm replace the following files (cogit.* cointerp.* gcc3x-cointerp.c) with what I have pasted here:
cogit.h
/* Automatically generated by CCodeGenerator VMMaker.oscog-eem.933 uuid: 5a37067c-b76b-4ada-9399-1de11632acd8 */ /*** Function Prototypes ***/ #if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms) # define NoDbgRegParms __attribute__ ((regparm (0))) #endif
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif
#if defined(__GNUC__) && !defined(NeverInline) # define NeverInline __attribute__ ((noinline)) #endif
#if !defined(NeverInline) # define NeverInline /*empty*/ #endif
cogit.c
#include <stddef.h> #if COGMTVM #include "cointerpmt.h" #error "exclude possiblity of cointerpmt.h causing the bug" #else #include "cointerp.h" #endif #include "cogit.h"
/*** Function Prototypes ***/
static void dispatchConcretize(int dude) NoDbgRegParms;
static void dispatchConcretize(int dude){ ;}
cointerp.h
/* Automatically generated by CCodeGeneratorGlobalStructure VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca */
/*** Function Prototypes ***/
#if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms) # define NoDbgRegParms __attribute__ ((regparm (0))) #endif
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif
#if defined(__GNUC__) && !defined(NeverInline) # define NeverInline __attribute__ ((noinline)) #endif
#if !defined(NeverInline) # define NeverInline /*empty*/ #endif
cointerp.c (not used, but done for sanity sake)
/* Automatically generated by CCodeGeneratorGlobalStructure VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca from CoInterpreter VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca */
#if USE_GLOBAL_STRUCT # define SQ_USE_GLOBAL_STRUCT 1 #else # define SQ_USE_GLOBAL_STRUCT 0 #endif #if USE_GLOBAL_STRUCT_REG # define SQ_USE_GLOBAL_STRUCT_REG 1 #else # define SQ_USE_GLOBAL_STRUCT_REG 0 #endif
#include <stddef.h> /* for e.g. alloca */ #include <setjmp.h> #include <wchar.h> /* for wint_t */ #include "cointerp.h" #include "cogit.h"
/*** Function Prototypes ***/
static void activateCoggedNewMethod(int inInterpreter) NoDbgRegParms;
static void activateCoggedNewMethod(int inInterpreter){;}
gcc3x-cointerp.c
/* This file has been post-processed for GNU C */
/* Automatically generated by CCodeGeneratorGlobalStructure VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca from CoInterpreter VMMaker.oscog-eem.948 uuid: 9323b2ad-f5cf-4aca-8f31-67eb5616ccca */
#if USE_GLOBAL_STRUCT # define SQ_USE_GLOBAL_STRUCT 1 #else # define SQ_USE_GLOBAL_STRUCT 0 #endif #if USE_GLOBAL_STRUCT_REG # define SQ_USE_GLOBAL_STRUCT_REG 1 #else # define SQ_USE_GLOBAL_STRUCT_REG 0 #endif
#include <stddef.h> /* for e.g. alloca */ #include <setjmp.h> #include <wchar.h> /* for wint_t */ #include "cointerp.h" #include "cogit.h"
static void activateCoggedNewMethod(int inInterpreter) NoDbgRegParms; static void activateCoggedNewMethod(int inInterpreter){ ; }
In the Cog/src/vm directory try cpp and gcc -E driectly on the .c files and you will see the preprocessor do its job correctly.
In my mvm looks like this (note the CFLAGS -no-integrated-cpp and -Wundef per https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html)
#!/bin/bash # VM with VM profiler and threaded heartbeat INSTALLDIR=coglinuxht # Some gcc versions create a broken VM using -O2 case `gcc -v 2>&1 | grep version | sed 's/gcc version *//'` in 3.4.*) OPT="-g -O1 -DNDEBUG -DDEBUGVM=0";; *) OPT="-g -O2 -DNDEBUG -DDEBUGVM=0";; esac
if [ $# -ge 1 ]; then INSTALLDIR="$1"; shift fi
echo -n "clean? " read a case $a in n|no|N|NO) echo "ok but this isn't safe!!";; *) test -f Makefile && make reallyclean esac test -f config.h || ../../../platforms/unix/config/configure --without-npsqueak --without-vm-display-fbdev --without-gl --x-libraries=/usr/lib \ CC="gcc -m32" \ CXX="g++ -m32" \ CFLAGS="$OPT -no-integrated-cpp -Wundef -msse2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 " \ LIBS="-lpthread -luuid" \ LDFLAGS=-Wl,-z,now rm -f vm/sqUnixMain.o # nuke version info rm -rf ../../../products/$INSTALLDIR # prefer make install prefix=`readlink -f `pwd`/../../../products/$INSTALLDIR` # but older linux readlinks lack the -f flag make install prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR 2>&1 | tee LOG
Then look at the LOG output .
Ideas much appreciated. thx.
Hi all.
In Cog/src/vm/cogit.c in moving the #include "dispdbg.h" above the #include "cointerp.h" and #include "cogit.h" like so:
#include <stddef.h> #include "sq.h" #include "sqCogStackAlignment.h" #include "cogmethod.h" #include "dispdbg.h" #if COGMTVM #include "cointerpmt.h" #else #include "cointerp.h" #endif #include "cogit.h"
appears to solve the problem.
My initial thinking is a so.
dispdg.h brings in sqAssert.h which defines PRODUCTION as 1 or 0 depending on CFLAGS passed in.
With dispbdg.h included after cogit.h, PRODUCTION was not defined and the tests in cogit.h
#if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms) # define NoDbgRegParms __attribute__ ((regparm (0))) #endif
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif
My conjecture is as follows (I am NOT fluent in the semantics of cpp, just a script kiddy who bit the bullet and rtfm this week (: ).
In the ....../build/vm/Makefile, $(interp)?.o is generated prior to cogit.o. gcc3x-cointerp.c includes sqAssert.h via dispdg.h prior to the cogit.h and cointerp.h included. This PRODUCTION is set 0 or 1 and NoDbgRegParms is defined one way or the other. cpp then pre-processes cogit.h. At this point, I lose track of the semantics, but I deduce that NoDbgRegParms IS defined from the gcc3x-cointerp.c parse so NoDbgRegParms is left as is in the cogit.c file. This was the bug I was tracking down.
I leave it to the more experienced to judge the correctness of the forensics.
cheers.
tty.
I should have proof-read before sending. Please excuse the sloppy english and structure, I think the explanation is clear despite my mangling of it.
---- On Sat, 22 Nov 2014 10:14:25 -0800 gettimothy<gettimothy@zoho.com> wrote ----
Hi all.
In Cog/src/vm/cogit.c in moving the #include "dispdbg.h" above the #include "cointerp.h" and #include "cogit.h" like so:
#include <stddef.h> #include "sq.h" #include "sqCogStackAlignment.h" #include "cogmethod.h" #include "dispdbg.h" #if COGMTVM #include "cointerpmt.h" #else #include "cointerp.h" #endif #include "cogit.h"
appears to solve the problem.
My initial thinking is a so.
dispdg.h brings in sqAssert.h which defines PRODUCTION as 1 or 0 depending on CFLAGS passed in.
With dispbdg.h included after cogit.h, PRODUCTION was not defined and the tests in cogit.h
#if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms) # define NoDbgRegParms __attribute__ ((regparm (0))) #endif
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif
My conjecture is as follows (I am NOT fluent in the semantics of cpp, just a script kiddy who bit the bullet and rtfm this week (: ).
In the ....../build/vm/Makefile, $(interp)?.o is generated prior to cogit.o. gcc3x-cointerp.c includes sqAssert.h via dispdg.h prior to the cogit.h and cointerp.h included. This PRODUCTION is set 0 or 1 and NoDbgRegParms is defined one way or the other. cpp then pre-processes cogit.h. At this point, I lose track of the semantics, but I deduce that NoDbgRegParms IS defined from the gcc3x-cointerp.c parse so NoDbgRegParms is left as is in the cogit.c file. This was the bug I was tracking down.
I leave it to the more experienced to judge the correctness of the forensics.
cheers.
tty.
Hi Tim,
great, you found it! Sorry for not getting to this sooner. I will fix this today.
On Sat, Nov 22, 2014 at 10:14 AM, gettimothy gettimothy@zoho.com wrote:
Hi all.
In Cog/src/vm/cogit.c in moving the #include "dispdbg.h" above the #include "cointerp.h" and #include "cogit.h" like so:
#include <stddef.h> #include "sq.h" #include "sqCogStackAlignment.h" #include "cogmethod.h" #include "dispdbg.h" #if COGMTVM #include "cointerpmt.h" #else #include "cointerp.h" #endif #include "cogit.h"
appears to solve the problem.
My initial thinking is a so.
dispdg.h brings in sqAssert.h which defines PRODUCTION as 1 or 0 depending on CFLAGS passed in.
With dispbdg.h included after cogit.h, PRODUCTION was not defined and the tests in cogit.h
#if !PRODUCTION && defined(__GNUC__) && !defined(NoDbgRegParms) # define NoDbgRegParms __attribute__ ((regparm (0))) #endif
#if !defined(NoDbgRegParms) # define NoDbgRegParms /*empty*/ #endif
My conjecture is as follows (I am NOT fluent in the semantics of cpp, just a script kiddy who bit the bullet and rtfm this week (: ).
In the ....../build/vm/Makefile, $(interp)?.o is generated prior to cogit.o. gcc3x-cointerp.c includes sqAssert.h via dispdg.h prior to the cogit.h and cointerp.h included. This PRODUCTION is set 0 or 1 and NoDbgRegParms is defined one way or the other. cpp then pre-processes cogit.h. At this point, I lose track of the semantics, but I deduce that NoDbgRegParms IS defined from the gcc3x-cointerp.c parse so NoDbgRegParms is left as is in the cogit.c file. This was the bug I was tracking down.
I leave it to the more experienced to judge the correctness of the forensics.
cheers.
tty.
vm-dev@lists.squeakfoundation.org