From ce038cecc1bb018e5d8b469c349d4b6e38f199ac Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Fri, 17 Sep 2004 17:48:19 +0000 Subject: [PATCH] import of CINT 5.15.151. For what else is new see http://root.cern.ch/root/Cint.phtml?relnote. git-svn-id: http://root.cern.ch/svn/root/trunk@10089 27541ba8-7e3a-0410-8455-c3a389f83636 --- cint/inc/Class.h | 3 + cint/inc/G__ci.h | 23 ++- cint/inc/Type.h | 7 + cint/inc/common.h | 57 +++++-- cint/inc/fproto.h | 15 ++ cint/inc/global.h | 7 + cint/include/makefile | 3 +- cint/include/stddef.h | 2 +- cint/include/stdio.h | 14 +- cint/include/stdlib.h | 4 +- cint/include/time.h | 2 +- cint/lib/dll_stl/makestr | 49 +++--- cint/lib/dll_stl/makevec | 49 +++--- cint/lib/gl/TOP.h | 10 +- cint/lib/gl/cintGL.h | 29 ++++ cint/lib/gl/setup.bat | 18 ++ cint/lib/ipc/ipcif.h | 6 +- cint/lib/posix/posix.h | 7 +- cint/lib/pthread/Makefile | 49 +++--- cint/src/Api.cxx | 13 +- cint/src/Method.cxx | 1 + cint/src/Type.cxx | 5 +- cint/src/auxu.c | 9 +- cint/src/decl.c | 23 ++- cint/src/error.c | 13 +- cint/src/expr.c | 1 + cint/src/func.c | 170 ++++++++++++++++--- cint/src/global1.c | 3 + cint/src/global2.c | 5 + cint/src/ifunc.c | 18 +- cint/src/init.c | 5 +- cint/src/newlink.c | 76 +++++++++ cint/src/opr.c | 32 ++-- cint/src/parse.c | 27 ++- cint/src/pcode.c | 341 ++++++++++++++++++++++++++++++++++++-- cint/src/shl.c | 8 + cint/src/tmplt.c | 8 + cint/src/v6_auxu.cxx | 9 +- cint/src/v6_decl.cxx | 23 ++- cint/src/v6_error.cxx | 13 +- cint/src/v6_expr.cxx | 1 + cint/src/v6_func.cxx | 170 ++++++++++++++++--- cint/src/v6_global1.cxx | 3 + cint/src/v6_global2.cxx | 5 + cint/src/v6_ifunc.cxx | 18 +- cint/src/v6_init.cxx | 5 +- cint/src/v6_newlink.cxx | 76 +++++++++ cint/src/v6_opr.cxx | 32 ++-- cint/src/v6_parse.cxx | 27 ++- cint/src/v6_pcode.cxx | 341 ++++++++++++++++++++++++++++++++++++-- cint/src/v6_shl.cxx | 8 + cint/src/v6_tmplt.cxx | 8 + cint/src/v6_value.cxx | 5 + cint/src/v6_var.cxx | 14 ++ cint/src/value.c | 5 + cint/src/var.c | 14 ++ 56 files changed, 1664 insertions(+), 225 deletions(-) create mode 100644 cint/lib/gl/cintGL.h create mode 100755 cint/lib/gl/setup.bat diff --git a/cint/inc/Class.h b/cint/inc/Class.h index a528a5293d3..cdc16ceb69d 100644 --- a/cint/inc/Class.h +++ b/cint/inc/Class.h @@ -164,6 +164,9 @@ G__ClassInfo { public: long ClassProperty(); #endif +#ifndef G__OLDIMPLEMENTATION2118 + unsigned char FuncFlag() { return(IsValid()?G__struct.funcs[tagnum]:0); } +#endif }; diff --git a/cint/inc/G__ci.h b/cint/inc/G__ci.h index 6963c499ee3..e3731c3be0e 100644 --- a/cint/inc/G__ci.h +++ b/cint/inc/G__ci.h @@ -22,11 +22,11 @@ #define G__CI_H #ifdef G__CINT_VER6 -#define G__CINTVERSION 6000010 -#define G__CINTVERSIONSTR "6.0.10, July 25 2004" +#define G__CINTVERSION 6000015 +#define G__CINTVERSIONSTR "6.0.15, Sep 5 2004" #else -#define G__CINTVERSION 50150146 -#define G__CINTVERSIONSTR "5.15.146, July 25 2004" +#define G__CINTVERSION 50150151 +#define G__CINTVERSIONSTR "5.15.151, Sep 5 2004" #endif #define G__ALWAYS @@ -36,6 +36,20 @@ **********************************************************************/ #ifndef G__CINT_VER6 +#define G__OLDIMPLEMENTATION2132 +#define G__OLDIMPLEMENTATION2131 +#define G__OLDIMPLEMENTATION2129 +#define G__OLDIMPLEMENTATION2128 +#define G__OLDIMPLEMENTATION2127 +#define G__OLDIMPLEMENTATION2122 +#define G__OLDIMPLEMENTATION2117 +#define G__OLDIMPLEMENTATION2116 +/* #define G__OLDIMPLEMENTATION2115 */ +/* #define G__OLDIMPLEMENTATION2114 */ +#define G__OLDIMPLEMENTATION2112 +#define G__OLDIMPLEMENTATION2111 +#define G__OLDIMPLEMENTATION2110 +#define G__OLDIMPLEMENTATION2109 #define G__OLDIMPLEMENTATION2105 #define G__OLDIMPLEMENTATION2102 #define G__OLDIMPLEMENTATION2089 @@ -2019,6 +2033,7 @@ extern G__EXPORT void G__store_tempobject G__P((G__value reg)); extern G__EXPORT int G__inheritance_setup G__P((int tagnum,int basetagnum,long baseoffset,int baseaccess,int property)); extern G__EXPORT void G__add_compiledheader G__P((G__CONST char *headerfile)); extern G__EXPORT void G__add_ipath G__P((G__CONST char *ipath)); +extern G__EXPORT int G__delete_ipath G__P((G__CONST char *ipath)); extern G__EXPORT void G__add_macro G__P((G__CONST char *macro)); extern G__EXPORT void G__check_setup_version G__P((int version,G__CONST char *func)); extern G__EXPORT long G__int G__P((G__value buf)); diff --git a/cint/inc/Type.h b/cint/inc/Type.h index beb5031f3d5..bcf297f4c29 100644 --- a/cint/inc/Type.h +++ b/cint/inc/Type.h @@ -57,6 +57,13 @@ G__TypeInfo : public G__ClassInfo { isconst = 0; #endif } + void Init(struct G__var_array *var,int ig15) { + type = var->type[ig15]; + typenum = var->p_typetable[ig15]; + tagnum = var->p_tagtable[ig15]; + reftype = var->reftype[ig15]; + isconst = var->constvar[ig15]; + } #endif int operator==(const G__TypeInfo& a); int operator!=(const G__TypeInfo& a); diff --git a/cint/inc/common.h b/cint/inc/common.h index 2484780d5eb..b34a415cc25 100644 --- a/cint/inc/common.h +++ b/cint/inc/common.h @@ -156,6 +156,8 @@ #define G__OPR_POSTFIXDEC 15 #define G__OPR_PREFIXDEC 16 +#define G__OPR_ADDVOIDPTR 17 + #ifndef G__OLDIMPLEMENTATION572 #define G__OPR_POSTFIXINC_I 0x110 #define G__OPR_PREFIXINC_I 0x111 @@ -436,18 +438,22 @@ #define G__TOPVALUE (long)0x0040 #define G__CTOR_SETGVP (long)0x0041 -#define G__THROW (long)0x0042 -#define G__CATCH (long)0x0043 -#define G__SETARYINDEX (long)0x0044 -#define G__RESETARYINDEX (long)0x0045 -#define G__GETARYINDEX (long)0x0046 - -#define G__ENTERSCOPE (long)0x0047 -#define G__EXITSCOPE (long)0x0048 -#define G__PUTAUTOOBJ (long)0x0049 -#define G__PUTHEAPOBJ (long)0x0050 /* not implemented yet */ -#define G__CASE (long)0x0051 -/* #define G__SETARYCTOR (long)0x0052 */ +#define G__TRY (long)0x0042 +#define G__TYPEMATCH (long)0x0043 +#define G__ALLOCEXCEPTION (long)0x0044 +#define G__DESTROYEXCEPTION (long)0x0045 +#define G__THROW (long)0x0046 +#define G__CATCH (long)0x0047 /* never used */ +#define G__SETARYINDEX (long)0x0048 +#define G__RESETARYINDEX (long)0x0049 +#define G__GETARYINDEX (long)0x004a + +#define G__ENTERSCOPE (long)0x004b +#define G__EXITSCOPE (long)0x004c +#define G__PUTAUTOOBJ (long)0x004d +#define G__PUTHEAPOBJ (long)0x004e /* not implemented yet */ +#define G__CASE (long)0x004f +/* #define G__SETARYCTOR (long)0x0050 */ #define G__NOP (long)0x00ff @@ -458,6 +464,14 @@ /* #define G__INST(x) (x&G__INSTMASK) */ /* not ready yet */ #define G__LINE(x) ((x&G__LINEMASK)/0x100) +/******************************************** +* G__TRY G__bc_exec_try_bytecode return value +********************************************/ +#define G__TRY_NORMAL 1 +#define G__TRY_INTERPRETED_EXCEPTION 2 +#define G__TRY_COMPILED_EXCEPTION 3 +#define G__TRY_UNCAUGHT 9 + struct G__breakcontinue_list { int destination; int breakcontinue; @@ -472,6 +486,16 @@ struct G__breakcontinue_list { #define G__MAXSTACK 0x100 #define G__MAXSTRSTACK 0x10 +#ifndef G__OLDIMPLEMENTATION2132 +/********************************************* +* G__CL line+filenum offset +*********************************************/ +#define G__CL_LINEMASK 0x000fffff +#define G__CL_FILEMASK 0x00000fff +#define G__CL_FILESHIFT 0x00100000 +#endif + + /********************************************* * macros for loop compiler *********************************************/ @@ -1031,6 +1055,15 @@ struct G__funclist { #define G__LONGDOUBLE 3 #endif +/********************************************************************* +* cintv6, flags +*********************************************************************/ +/* G__cintv6 flags */ +/* #define G__CINT_VER6 1 */ /* defined in platform configuration */ +#define G__BC_CINTVER6 0x01 +#define G__BC_COMPILEERROR 0x02 +#define G__BC_RUNTIMEERROR 0x04 + /********************************************************************* * cint parser function and global variable prototypes *********************************************************************/ diff --git a/cint/inc/fproto.h b/cint/inc/fproto.h index a7ab1f177e2..0f1a341ee7f 100644 --- a/cint/inc/fproto.h +++ b/cint/inc/fproto.h @@ -102,6 +102,8 @@ int G__get_newname G__P((char *new_name)); int G__unsignedintegral G__P((int *pspaceflag,int *piout,int mparen)); void G__define_var G__P((int tagnum,int typenum)); int G__initary G__P((char *new_name)); +struct G__var_array* G__initmemvar G__P((int tagnum,int* pindex,G__value *pbuf)); +struct G__var_array* G__incmemvar G__P((struct G__var_array* memvar,int* pindex,G__value *pbuf)); int G__initstruct G__P((char *new_name)); int G__ignoreinit G__P((char *new_name)); int G__listfunc G__P((FILE *fp,int access,char* fname,struct G__ifunc_table *ifunc)); @@ -860,6 +862,10 @@ int G__LD_IFUNC_optimize G__P((struct G__ifunc_table* ifunc,int ifn ,long *inst, #ifndef G__OLDIMPLEMENTATION2067 int G__bc_compile_function G__P((struct G__ifunc_table *ifunc,int iexist)); #endif +#ifndef G__OLDIMPLEMENTATION2117 +int G__bc_throw_compile_error(); +int G__bc_throw_runtime_error(); +#endif #ifndef G__OLDIMPLEMENTATION2074 int G__bc_exec_virtual_bytecode G__P((G__value *result7 @@ -896,6 +902,15 @@ G__value G__bc_new_operator G__P((const char *expression)) ; #endif void G__bc_delete_operator G__P((const char *expression,int isarray)) ; +#ifndef G__OLDIMPLEMENTATION2109 +int G__bc_exec_try_bytecode G__P((int start,int stack,G__value *presult,long localmem)) ; +int G__bc_exec_throw_bytecode G__P((G__value* pval)); +int G__bc_exec_typematch_bytecode G__P((G__value* catchtype,G__value* excptobj)); +int G__Isvalidassignment_val G__P((G__value* ltype,G__value* rtype)); +#endif + +G__value G__alloc_exceptionbuffer G__P((int tagnum)); + void G__argtype2param G__P((char *argtype,struct G__param *libp)); #ifdef __cplusplus diff --git a/cint/inc/global.h b/cint/inc/global.h index a46f0c6f8b2..ca995afa343 100644 --- a/cint/inc/global.h +++ b/cint/inc/global.h @@ -74,6 +74,9 @@ extern int G__asm_wholefunc_default_cp; #ifdef G__ASM_IFUNC extern long *G__asm_inst; /* p-code instruction buffer */ +#ifndef G__OLDIMPLEMENTATION2116 +extern int G__asm_instsize; +#endif extern G__value *G__asm_stack; /* data stack */ extern char *G__asm_name; extern long G__asm_inst_g[G__MAXINST]; /* p-code instruction buffer */ @@ -732,6 +735,10 @@ typedef void (*G__eolcallback_t) G__P((const char* fname,int linenum)); extern G__eolcallback_t G__eolcallback; #endif +#ifndef G__OLDIMPLEMENTATION2111 +extern int G__throwingexception; +#endif + extern int G__scopelevel; extern int G__cintv6; diff --git a/cint/include/makefile b/cint/include/makefile index d22ea3e4d87..0f0a1975e8a 100644 --- a/cint/include/makefile +++ b/cint/include/makefile @@ -1,7 +1,7 @@ # # cint dynimic link standard library makefile # -done: statistics.dll array.dll carray.dll fft.dll xgraph.dll lsm.dll ReadF.dll RegE.dll +done: statistics.dll array.dll carray.dll fft.dll xgraph.dll lsm.dll matrix.dll ReadF.dll RegE.dll rm G__* *.o | echo 'G__* not exist' echo > done @@ -39,3 +39,4 @@ RegE.dll : RegE.h RegE.C ../cint matrix.dll : matrix.h matrix.cxx ../cint makecint -mk Makeit -dl matrix.dll -H matrix.h -C++ matrix.cxx ReadF.C + make -f Makeit diff --git a/cint/include/stddef.h b/cint/include/stddef.h index 7b2351f8945..2b16b9975a8 100644 --- a/cint/include/stddef.h +++ b/cint/include/stddef.h @@ -6,5 +6,5 @@ typedef int ptrdiff_t; typedef long ptrdiff_t; #endif typedef unsigned int size_t; -typedef unsigned short wchar_t; +typedef unsigned int wchar_t; #endif diff --git a/cint/include/stdio.h b/cint/include/stdio.h index 7c0a63bc48b..4963b3ec512 100644 --- a/cint/include/stdio.h +++ b/cint/include/stdio.h @@ -3,15 +3,21 @@ #ifndef NULL #pragma setstdio #endif -typedef long fpos_t; +typedef struct fpos_t { + long l,u; + fpos_t(long i=0){l=i;u=0;} + void operator=(long i){l=i;u=0;} +} fpos_t; +#pragma link off class fpos_t; +#pragma link off typedef fpos_t; typedef unsigned int size_t; #define _IOFBF (0) #define _IOLBF (1) #define _IONBF (2) #define BUFSIZ (1024) -#define FILENAME_MAX (259) -#define L_tmpnam (259) -#define TMP_MAX (26) +#define FILENAME_MAX (1024) +#define L_tmpnam (1024) +#define TMP_MAX (308915776) #ifndef SEEK_CUR #define SEEK_CUR (1) #endif diff --git a/cint/include/stdlib.h b/cint/include/stdlib.h index a1fa4c5df67..98201349df2 100644 --- a/cint/include/stdlib.h +++ b/cint/include/stdlib.h @@ -7,8 +7,8 @@ typedef unsigned int size_t; #define EXIT_FAILURE (1) #define EXIT_SUCCESS (0) #define MB_CUR_MAX (1) -#define MB_LEN_MAX (1) +#define MB_LEN_MAX (6) #define RAND_MAX (2147483647) -typedef unsigned short wchar_t; +typedef unsigned int wchar_t; #pragma include_noerr <stdfunc.dll> #endif diff --git a/cint/include/time.h b/cint/include/time.h index 5824e5c8819..e7348eaddec 100644 --- a/cint/include/time.h +++ b/cint/include/time.h @@ -5,5 +5,5 @@ typedef long time_t; #ifndef G__STDSTRUCT #pragma setstdstruct #endif -#define CLK_TCK (1000) +#define CLK_TCK (100) #endif diff --git a/cint/lib/dll_stl/makestr b/cint/lib/dll_stl/makestr index 9e1c10fe63f..305ba17ab1d 100644 --- a/cint/lib/dll_stl/makestr +++ b/cint/lib/dll_stl/makestr @@ -5,47 +5,45 @@ # Copying $CINTSYSDIR/MAKEINFO ############################# ############################################################ -# platform/cygwin51_gcc3_so -# Platform dependent information for Cygwin_NT-5.1 -# using gcc-3.00 -# Build libcint.dll instead of G__ci.a +# platform/macos_gcc3_v3_v6 +# Platform dependent information for g++ with mininum config +# By Alessandro Pistocchi +# It seems like this setup is the absolute minimum. I believe +# we can explore much more with MacOSX. Probably, you can get +# as much as Linux_xxx. Contribution will be greatly appreciated. +# Cint ver6 features turned on ############################################################ # Tools -AS = as -DLLTOOL = dlltool -LDDLL = ld -#LIBS = -lcygwin -lkernel32 -luser32 -lgdi32 -lcomdlg32 - RM = rm -f CP = cp AR = ar AROPT = clq -KRCC = gcc -traditional -CC = gcc -fexceptions -Wall -CPP = g++ -Wall +KRCC = cc +CC = gcc +CPP = g++ LD = g++ CPREP = gcc -E -C CPPPREP = g++ -E -C # Compiler and linker option -CCDLLOPT = -DBUILDING_DLL=1 -LDDLLOPT = -shared -# gcc-3.00 has a bug in -O2. Use -O instead. -O2 may be OK for later version +CCDLLOPT = -fno-common +LDDLLOPT = -bundle -flat_namespace -undefined suppress OPTIMIZE = -O -LDOPT = -lm -ltermcap -lreadline -SYSMACRO = -DG__REGEXP -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__CYGWIN=51 -DG__NEWSTDHEADER -OTHMACRO = -DG__P2FCAST -DG__REDIRECTIO -DG__DETECT_NEWDEL -DG__POSIX -DG__STD_EXCEPTION $(CCDLLPOST) -DG__GNUREADLINE +LDOPT = -lm -ldl +SYSMACRO = -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__MACOSX__ -DG__SIGNEDCHAR -DG__LONGBUF -DG__NEWSTDHEADER -DG__CINT_VER6 +OTHMACRO = -DG__APPLE -DG__NOPOWEROPR SYSIPATH = # libraries MAINO = $(CINTSYSDIR)/main/G__cppmain.o -CINTLIB = $(CINTSYSDIR)/libcint.dll +CINTLIB = $(CINTSYSDIR)/src/G__ci.a READLINEA = APIO = Api.o Class.o BaseCls.o Type.o DataMbr.o Method.o MethodAr.o CallFunc.o Typedf.o Apiif.o Token.o RANLIB = /usr/bin/ranlib STDLIBS = gcc3strm.o stdstrct.o -PLATFORM = $(CINTSYSDIR)/main/G__setup.o +PLATFORM = +CINT_V6 = bc_autoobj.o bc_cfunc.o bc_inst.o bc_parse.o bc_reader.o bc_type.o bc_exec.o bc_vtbl.o # source code postfix CSRCPOST = .c @@ -53,9 +51,8 @@ CHDRPOST = .h CPPSRCPOST = .C CPPHDRPOST = .h OBJPOST = .o -DLLPOST = .dll - - +DLLPOST = .so + @@ -73,7 +70,7 @@ INPUTMODELOCK = off # Set variables ############################################ IPATH = $(SYSIPATH) MACRO = $(SYSMACRO) -CINTSYSDIR = /cygdrive/d/gotom/src/cint +CINTSYSDIR = /Users/gotom/src/cint CINTIPATH = -I$(CINTSYSDIR) OBJECT = string.dll OPTION = $(CCDLLOPT) @@ -118,8 +115,8 @@ CPPSTUB = CPPSTUBCINT = # Link Object ############################################# -$(OBJECT) : $(CINTLIB) $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) - $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) -L$(CINTSYSDIR) -lcint +$(OBJECT) : $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) + $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) # Compile User C source files ############################## diff --git a/cint/lib/dll_stl/makevec b/cint/lib/dll_stl/makevec index 2f80567273e..4026040e5ae 100644 --- a/cint/lib/dll_stl/makevec +++ b/cint/lib/dll_stl/makevec @@ -5,47 +5,45 @@ # Copying $CINTSYSDIR/MAKEINFO ############################# ############################################################ -# platform/cygwin51_gcc3_so -# Platform dependent information for Cygwin_NT-5.1 -# using gcc-3.00 -# Build libcint.dll instead of G__ci.a +# platform/macos_gcc3_v3_v6 +# Platform dependent information for g++ with mininum config +# By Alessandro Pistocchi +# It seems like this setup is the absolute minimum. I believe +# we can explore much more with MacOSX. Probably, you can get +# as much as Linux_xxx. Contribution will be greatly appreciated. +# Cint ver6 features turned on ############################################################ # Tools -AS = as -DLLTOOL = dlltool -LDDLL = ld -#LIBS = -lcygwin -lkernel32 -luser32 -lgdi32 -lcomdlg32 - RM = rm -f CP = cp AR = ar AROPT = clq -KRCC = gcc -traditional -CC = gcc -fexceptions -Wall -CPP = g++ -Wall +KRCC = cc +CC = gcc +CPP = g++ LD = g++ CPREP = gcc -E -C CPPPREP = g++ -E -C # Compiler and linker option -CCDLLOPT = -DBUILDING_DLL=1 -LDDLLOPT = -shared -# gcc-3.00 has a bug in -O2. Use -O instead. -O2 may be OK for later version +CCDLLOPT = -fno-common +LDDLLOPT = -bundle -flat_namespace -undefined suppress OPTIMIZE = -O -LDOPT = -lm -ltermcap -lreadline -SYSMACRO = -DG__REGEXP -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__CYGWIN=51 -DG__NEWSTDHEADER -OTHMACRO = -DG__P2FCAST -DG__REDIRECTIO -DG__DETECT_NEWDEL -DG__POSIX -DG__STD_EXCEPTION $(CCDLLPOST) -DG__GNUREADLINE +LDOPT = -lm -ldl +SYSMACRO = -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__MACOSX__ -DG__SIGNEDCHAR -DG__LONGBUF -DG__NEWSTDHEADER -DG__CINT_VER6 +OTHMACRO = -DG__APPLE -DG__NOPOWEROPR SYSIPATH = # libraries MAINO = $(CINTSYSDIR)/main/G__cppmain.o -CINTLIB = $(CINTSYSDIR)/libcint.dll +CINTLIB = $(CINTSYSDIR)/src/G__ci.a READLINEA = APIO = Api.o Class.o BaseCls.o Type.o DataMbr.o Method.o MethodAr.o CallFunc.o Typedf.o Apiif.o Token.o RANLIB = /usr/bin/ranlib STDLIBS = gcc3strm.o stdstrct.o -PLATFORM = $(CINTSYSDIR)/main/G__setup.o +PLATFORM = +CINT_V6 = bc_autoobj.o bc_cfunc.o bc_inst.o bc_parse.o bc_reader.o bc_type.o bc_exec.o bc_vtbl.o # source code postfix CSRCPOST = .c @@ -53,9 +51,8 @@ CHDRPOST = .h CPPSRCPOST = .C CPPHDRPOST = .h OBJPOST = .o -DLLPOST = .dll - - +DLLPOST = .so + @@ -74,7 +71,7 @@ INPUTMODELOCK = off IPATH = $(SYSIPATH) MACRO = $(SYSMACRO)\ -DG__NOALGORITHM -CINTSYSDIR = /cygdrive/d/gotom/src/cint +CINTSYSDIR = /Users/gotom/src/cint CINTIPATH = -I$(CINTSYSDIR) OBJECT = vector.dll OPTION = $(CCDLLOPT) @@ -119,8 +116,8 @@ CPPSTUB = CPPSTUBCINT = # Link Object ############################################# -$(OBJECT) : $(CINTLIB) $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) - $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) -L$(CINTSYSDIR) -lcint +$(OBJECT) : $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) + $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) # Compile User C source files ############################## diff --git a/cint/lib/gl/TOP.h b/cint/lib/gl/TOP.h index 41cebd7811f..d8ea5cf9ce2 100644 --- a/cint/lib/gl/TOP.h +++ b/cint/lib/gl/TOP.h @@ -16,7 +16,7 @@ #endif /* C preprocessor is used for GL.h before Cint reads it */ -#include "GL.h" +#include "cintGL.h" #ifdef __MAKECINT__ #pragma preprocessor off @@ -67,6 +67,14 @@ #pragma link off function XMesaFindBuffer ; #pragma link off function XMesaMakeCurrent ; +#ifdef G__WIN32 +#pragma link off function auxInitWindowW; +#pragma link off function auxRGBImageLoadW; +#pragma link off function auxDIBImageLoadW; +#pragma link off function auxDrawStrW; +//#pragma link off global auxRGBMap; +#endif + #endif diff --git a/cint/lib/gl/cintGL.h b/cint/lib/gl/cintGL.h new file mode 100644 index 00000000000..3168e4ead90 --- /dev/null +++ b/cint/lib/gl/cintGL.h @@ -0,0 +1,29 @@ +#ifdef __MAKECINT__ +#ifndef G__WIN32 +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#endif +/* Following pragmas delete symbols in abobe headers only. + * Symbols in following headers will not be affected. */ +#pragma link off all functions; +#pragma link off all typedefs; +#pragma link off all classes; +#endif + +#define WINGDIAPI +#define APIENTRY +#define CALLBACK +#ifdef __MAKECINT__ +#define HGLRC +#endif + +#include <stddef.h> +#include <GL/gl.h> +#include <GL/glu.h> +//#include <GL/glut.h> +#if defined(G__WIN32) || defined(_WIN32) +#include <GL/glaux.h> +#else +#include <GL/glx.h> +#endif +//#include <GL/xmesa.h> diff --git a/cint/lib/gl/setup.bat b/cint/lib/gl/setup.bat new file mode 100755 index 00000000000..4364e562135 --- /dev/null +++ b/cint/lib/gl/setup.bat @@ -0,0 +1,18 @@ + + +rem #INC='-I/usr/X11R6/include' +rem #LIB='-L/usr/X11R6/lib -lGL -lGLU -lglut -lXmu -lX11 -lXi' +rem set LIB='-lGLAUX -lGLU32' + +move ..\..\include/GL ..\..\include/GLx + +makecint -mk Makefile -dl gl.dll %INC% -h TOP.h -l "c:\Program Files\Microsoft Visual Studio\VC98\Lib\glaux.lib" "c:\Program Files\Microsoft Visual Studio\VC98\Lib\glu32.lib" + +make + +move ..\..\include/GLx ..\..\include/GL + +move gl.dll %CINTSYSDIR%\include\GL\gl.dll +make clean +del Makefile + diff --git a/cint/lib/ipc/ipcif.h b/cint/lib/ipc/ipcif.h index 7bbf3a198a8..f31d7f3d06d 100644 --- a/cint/lib/ipc/ipcif.h +++ b/cint/lib/ipc/ipcif.h @@ -33,7 +33,9 @@ #include <sys/ipc.h> #include <sys/shm.h> #include <sys/sem.h> -#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) +#if defined(G__APPLE) || defined(__APPLE__) +/* union semun is defined by including <sys/sem.h> */ +#elif defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) /* union semun is defined by including <sys/sem.h> */ #else /* according to X/OPEN we have to define it ourselves */ @@ -194,10 +196,12 @@ struct msgbuf { struct msqid_ds; +#if !(defined(G__APPLE) || defined(__APPLE__)) int msgget(key_t key,int msgflg); int *msgsnd(int msgid,struct msgbuf *msgp,int msgsz,int msgflg); int msgrcv(int msgid,struct msgbuf *msgp,int msgsz,long msgtyp,int msgflg); int msgctl(int msgid, int cmd,struct msqid_ds *buf); +#endif #pragma link off struct msgbuf; diff --git a/cint/lib/posix/posix.h b/cint/lib/posix/posix.h index 7a5f918d26b..bce8986dd2c 100644 --- a/cint/lib/posix/posix.h +++ b/cint/lib/posix/posix.h @@ -231,7 +231,9 @@ extern gid_t getgid(void); extern gid_t getegid(void); extern int setuid(uid_t uid); +#if !(defined(G__APPLE) || defined(__APPLE)__) extern char *cuserid(char *string); +#endif extern char *getlogin(void); extern char *ctermid(char *s); extern char *ttyname(int desc); @@ -256,12 +258,15 @@ extern int fchown(int fd,uid_t owner,gid_t group); #endif extern int fchdir(int fd); #if !defined(G__SUN) && !defined(G__CYGWIN) +#if !(defined(G__APPLE) || defined(__APPLE__)) extern char *get_current_dir_name(void); extern pid_t getpgid(pid_t pid); #endif extern char *getwd(char *buf); -#if defined(G__SUN) || defined(__sun) +#if (defined(G__APPLE) || defined(__APPLE__)) +extern int setpgrp(pid_t _pid,pid_t _pgrp); +#elif defined(G__SUN) || defined(__sun) extern long setpgrp(void); #elif defined(G__FBSD)||defined(__FreeBSD__)||((defined(G__alpha)||defined(__alpha))&&defined(G__GNUC))||((defined(G__alpha)||defined(__alpha))&&defined(G__GNUC)) extern int setpgrp(pid_t _pid, pid_t _pgrp); diff --git a/cint/lib/pthread/Makefile b/cint/lib/pthread/Makefile index f2d25072bdb..38016d361b6 100644 --- a/cint/lib/pthread/Makefile +++ b/cint/lib/pthread/Makefile @@ -5,47 +5,45 @@ # Copying $CINTSYSDIR/MAKEINFO ############################# ############################################################ -# platform/cygwin51_gcc3_so -# Platform dependent information for Cygwin_NT-5.1 -# using gcc-3.00 -# Build libcint.dll instead of G__ci.a +# platform/macos_gcc3_v3_v6 +# Platform dependent information for g++ with mininum config +# By Alessandro Pistocchi +# It seems like this setup is the absolute minimum. I believe +# we can explore much more with MacOSX. Probably, you can get +# as much as Linux_xxx. Contribution will be greatly appreciated. +# Cint ver6 features turned on ############################################################ # Tools -AS = as -DLLTOOL = dlltool -LDDLL = ld -#LIBS = -lcygwin -lkernel32 -luser32 -lgdi32 -lcomdlg32 - RM = rm -f CP = cp AR = ar AROPT = clq -KRCC = gcc -traditional -CC = gcc -fexceptions -Wall -CPP = g++ -Wall +KRCC = cc +CC = gcc +CPP = g++ LD = g++ CPREP = gcc -E -C CPPPREP = g++ -E -C # Compiler and linker option -CCDLLOPT = -DBUILDING_DLL=1 -LDDLLOPT = -shared -# gcc-3.00 has a bug in -O2. Use -O instead. -O2 may be OK for later version +CCDLLOPT = -fno-common +LDDLLOPT = -bundle -flat_namespace -undefined suppress OPTIMIZE = -O -LDOPT = -lm -ltermcap -lreadline -SYSMACRO = -DG__REGEXP -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__CYGWIN=51 -DG__NEWSTDHEADER -OTHMACRO = -DG__P2FCAST -DG__REDIRECTIO -DG__DETECT_NEWDEL -DG__POSIX -DG__STD_EXCEPTION $(CCDLLPOST) -DG__GNUREADLINE +LDOPT = -lm -ldl +SYSMACRO = -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__MACOSX__ -DG__SIGNEDCHAR -DG__LONGBUF -DG__NEWSTDHEADER -DG__CINT_VER6 +OTHMACRO = -DG__APPLE -DG__NOPOWEROPR SYSIPATH = # libraries MAINO = $(CINTSYSDIR)/main/G__cppmain.o -CINTLIB = $(CINTSYSDIR)/libcint.dll +CINTLIB = $(CINTSYSDIR)/src/G__ci.a READLINEA = APIO = Api.o Class.o BaseCls.o Type.o DataMbr.o Method.o MethodAr.o CallFunc.o Typedf.o Apiif.o Token.o RANLIB = /usr/bin/ranlib STDLIBS = gcc3strm.o stdstrct.o -PLATFORM = $(CINTSYSDIR)/main/G__setup.o +PLATFORM = +CINT_V6 = bc_autoobj.o bc_cfunc.o bc_inst.o bc_parse.o bc_reader.o bc_type.o bc_exec.o bc_vtbl.o # source code postfix CSRCPOST = .c @@ -53,9 +51,8 @@ CHDRPOST = .h CPPSRCPOST = .C CPPHDRPOST = .h OBJPOST = .o -DLLPOST = .dll - - +DLLPOST = .so + @@ -74,7 +71,7 @@ INPUTMODELOCK = off IPATH = $(SYSIPATH) MACRO = $(SYSMACRO)\ -D_POSIX_C_SOURCE=199506L -CINTSYSDIR = /cygdrive/d/gotom/src/cint +CINTSYSDIR = /Users/gotom/src/cint CINTIPATH = -I$(CINTSYSDIR) OBJECT = pthread.dll OPTION = $(CCDLLOPT) @@ -120,8 +117,8 @@ CPPSTUB = CPPSTUBCINT = # Link Object ############################################# -$(OBJECT) : $(CINTLIB) $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) - $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) -L$(CINTSYSDIR) -lcint +$(OBJECT) : $(COFILES) $(CPPOFILES) $(CIFO) $(CPPIFO) + $(LD) $(LDDLLOPT) $(OPTIMIZE) $(IPATH) $(MACRO) $(CCOPT) -o $(OBJECT) $(COFILES) $(CIFO) $(CPPIFO) $(CPPOFILES) $(LIBS) # Compile User C source files ############################## diff --git a/cint/src/Api.cxx b/cint/src/Api.cxx index e5e03637212..d9bc5dbca87 100644 --- a/cint/src/Api.cxx +++ b/cint/src/Api.cxx @@ -21,6 +21,10 @@ #include "Api.h" #include "common.h" +#ifndef G__OLDIMPLEMENTATION2112 +#include "bc_eh.h" +#endif + /********************************************************************* * $xxx object resolution function Generic form @@ -421,6 +425,11 @@ extern "C" int G__ExceptionWrapper(G__InterfaceMethod funcp (*funcp)(result7,funcname,libp,hash); return 1; } +#ifndef G__OLDIMPLEMENTATION2112 + catch(G__bc_exception& x) { + throw; + } +#endif #ifdef G__STD_EXCEPTION catch(exception& x) { char buf[G__LONGLINE]; @@ -583,7 +592,7 @@ extern "C" const char* G__saveconststring(const char* s) #ifndef G__OLDIMPLEMENTATION1689 extern "C" void G__initcxx() { -#if defined(__HP_aCC)||defined(__SUNPRO_CC)||defined(__BCPLUSPLUS__)||defined(__KCC)|| (defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 810)) +#if defined(__HP_aCC)||defined(__SUNPRO_CC)||defined(__BCPLUSPLUS__)||defined(__KCC)||defined(__INTEL_COMPILER) char temp[G__ONELINE]; #endif #ifdef __HP_aCC /* HP aCC C++ compiler */ @@ -598,7 +607,7 @@ extern "C" void G__initcxx() #ifdef __KCC /* KCC C++ compiler */ sprintf(temp,"G__KCC=%ld",(long)__KCC); G__add_macro(temp); #endif -#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 810 /* icc and ecc C++ compilers */ +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER<810) /* icc and ecc C++ compilers */ sprintf(temp,"G__INTEL_COMPILER=%ld",(long)__INTEL_COMPILER); G__add_macro(temp); #endif /* diff --git a/cint/src/Method.cxx b/cint/src/Method.cxx index fdeec9b7502..8bb122adb10 100644 --- a/cint/src/Method.cxx +++ b/cint/src/Method.cxx @@ -888,3 +888,4 @@ void G__MethodInfo::SetVtblBasetagnum(int basetagnum) { ifunc->vtblbasetagnum[index] = (short)basetagnum; } #endif + diff --git a/cint/src/Type.cxx b/cint/src/Type.cxx index 0f0e603fc3a..faa674622ec 100644 --- a/cint/src/Type.cxx +++ b/cint/src/Type.cxx @@ -132,7 +132,10 @@ int G__TypeInfo::Size() buf.typenum=(int)typenum; buf.ref=reftype; #ifndef G__OLDIMPLEMENTATION2106 - if(isupper(type)) buf.obj.reftype.reftype=reftype; + if(isupper(type)) { + buf.obj.reftype.reftype=reftype; + return(sizeof(void*)); + } #endif return(G__sizeof(&buf)); } diff --git a/cint/src/auxu.c b/cint/src/auxu.c index 5cd119888be..18fb391ae21 100644 --- a/cint/src/auxu.c +++ b/cint/src/auxu.c @@ -634,8 +634,13 @@ char *typename; break; } if(type) strcpy(type,vtype); - if(tagname && buf.tagnum>=0) strcpy(tagname,G__struct.name[buf.tagnum]) ; - if(typename && buf.typenum>=0) strcpy(typename,G__newtype.name[buf.typenum]) ; +#ifndef G__OLDIMPLEMENTATION2108 + if(tagname && buf.tagnum>=0) strcpy(tagname,G__struct.name[buf.tagnum]); + if(typename && buf.typenum>=0) strcpy(typename,G__newtype.name[buf.typenum]); +#else + if(tagname) strcpy(tagname,G__struct.name[buf.tagnum]) ; + if(typename) strcpy(typename,G__newtype.name[buf.typenum]) ; +#endif sprintf(vtype,"&%s",name); buf = G__calc_internal(vtype); diff --git a/cint/src/decl.c b/cint/src/decl.c index a8547b82e66..bc6ed67944e 100644 --- a/cint/src/decl.c +++ b/cint/src/decl.c @@ -2580,7 +2580,12 @@ int tagnum,typenum; /* overrides global variables */ } /* struct class initialization ={x,y,z} */ if(initary) { - if(known) { + if(known +#ifndef G__OLDIMPLEMENTATION2130 + && (G__struct.funcs[tagnum]& G__HAS_XCONSTRUCTOR) + /* && (G__struct.funcs[tagnum]& G__HAS_DEFAULTCONSTRUCTOR) */ +#endif + ) { G__fprinterr(G__serr, "Error: Illegal initialization of %s. Constructor exists " ,new_name); @@ -3381,7 +3386,16 @@ char *new_name; * initiazlize this element *******************************************/ buf.obj.i=var->p[ig15]+size*pinc; +#ifndef G__OLDIMPLEMENTATION2125 + { + int store_prerun=G__prerun; + G__prerun=0; + reg=G__getexpr(expr); + G__prerun=store_prerun; + } +#else reg=G__getexpr(expr); +#endif #ifndef G__OLDIMPLEMENTATION1607 if( #ifndef G__OLDIMPLEMENTATION1621 @@ -3500,7 +3514,7 @@ char *new_name; /************************************************************************** * G__initmemvar() **************************************************************************/ -static struct G__var_array* G__initmemvar(tagnum,pindex,pbuf) +struct G__var_array* G__initmemvar(tagnum,pindex,pbuf) int tagnum; int* pindex; G__value *pbuf; @@ -3508,6 +3522,9 @@ G__value *pbuf; struct G__var_array* memvar; *pindex=0; if(-1!=tagnum) { +#ifndef G__OLDIMPLEMENTATION2131 + G__incsetup_memvar(tagnum); +#endif memvar=G__struct.memvar[tagnum]; pbuf->tagnum=memvar->p_tagtable[*pindex]; pbuf->typenum=memvar->p_typetable[*pindex]; @@ -3523,7 +3540,7 @@ G__value *pbuf; /************************************************************************** * G__incmemvar() **************************************************************************/ -static struct G__var_array* G__incmemvar(memvar,pindex,pbuf) +struct G__var_array* G__incmemvar(memvar,pindex,pbuf) struct G__var_array* memvar; int* pindex; G__value *pbuf; diff --git a/cint/src/error.c b/cint/src/error.c index 69a9717d9b9..479cd724e29 100644 --- a/cint/src/error.c +++ b/cint/src/error.c @@ -278,7 +278,11 @@ char *item; if(G__no_exec_compile && 0==G__asm_noverflow) return(0); #endif if(G__in_pause) return(0); - if(G__ASM_FUNC_COMPILE&G__asm_wholefunction) { + if( +#ifndef G__OLDIMPLEMENTATION2105 + !G__cintv6 && +#endif + G__ASM_FUNC_COMPILE&G__asm_wholefunction) { G__CHECK(G__SECURE_PAUSE,1,G__pause()); G__CHECK(G__SECURE_EXIT_AT_ERROR,1,G__return=G__RETURN_EXIT1); } @@ -584,6 +588,13 @@ char *message; } #endif +#ifndef G__OLDIMPLEMENTATION2117 + if(G__cintv6) { + if(G__cintv6&G__BC_COMPILEERROR) G__bc_throw_compile_error(); + if(G__cintv6&G__BC_RUNTIMEERROR) G__bc_throw_runtime_error(); + } +#endif + return(0); } diff --git a/cint/src/expr.c b/cint/src/expr.c index 41baa218022..e71a0e32114 100644 --- a/cint/src/expr.c +++ b/cint/src/expr.c @@ -1435,6 +1435,7 @@ char *expression; strcmp(ebuf,"static_cast")==0 || strcmp(ebuf,"reinterpret_cast")==0 || strcmp(ebuf,"const_cast")==0) { + /* TODO, implement casts, may need to introduce new instruction */ ++ig1; ebuf[0]='('; c=G__getstream_template(expression,&ig1,ebuf+1,">"); diff --git a/cint/src/func.c b/cint/src/func.c index 12c5dee1fac..cd8140bc1b5 100644 --- a/cint/src/func.c +++ b/cint/src/func.c @@ -63,6 +63,24 @@ int G__getoptimizemode G__P(()); extern int G__const_noerror; #endif +#ifndef G__OLDIMPLEMENTATION2120 +/****************************************************************** +* +* G__gen_PUSHSTROS_SETSTROS() +******************************************************************/ +void G__gen_PUSHSTROS_SETSTROS() { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: PUSHSTROS\n",G__asm_cp); + G__fprinterr(G__serr,"%3x: SETSTROS\n",G__asm_cp+1); + } +#endif + G__asm_inst[G__asm_cp] = G__PUSHSTROS; + G__asm_inst[G__asm_cp+1] = G__SETSTROS; + G__inc_cp_asm(2,0); +} +#endif + /****************************************************************** * G__dispvalue() ******************************************************************/ @@ -319,10 +337,18 @@ char *cindex; if('u'==result3->type) { struct G__param fpara; +#ifndef G__OLDIMPLEMENTATION2120 +#ifdef G__ASM + if(G__asm_noverflow) G__gen_PUSHSTROS_SETSTROS(); +#endif +#endif fpara.paran=1; fpara.para[0]=G__getexpr(sindex+1); - G__parenthesisovldobj(result3,result3,"operator[]" - ,&fpara,G__TRYNORMAL); +#ifndef G__OLDIMPLEMENTATION2120 + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,1); +#else + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,G__TRYNORMAL); +#endif return; } @@ -336,12 +362,11 @@ char *cindex; struct G__param fpara; fpara.paran=1; G__letint(&fpara.para[0],'i',index); - G__parenthesisovldobj(result3,result3,"operator[]" - ,&fpara,G__TRYNORMAL); + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,G__TRYNORMAL); return; } #endif -#endif/* 2018 */ +#endif /* 2018 */ size = G__sizeof(result3); #ifdef G__ASM @@ -1274,10 +1299,20 @@ char* funcname; } } +#ifndef G__OLDIMPLEMENTATION2120 +#ifdef G__ASM + if(G__asm_noverflow) G__gen_PUSHSTROS_SETSTROS(); +#endif +#endif + for(itmp=0;itmp<fpara.paran;itmp++) { fpara.para[itmp] = G__getexpr(fpara.parameter[itmp]); } +#ifndef G__OLDIMPLEMENTATION2120 + G__parenthesisovldobj(&result3,presult,"operator()",&fpara,1); +#else G__parenthesisovldobj(&result3,presult,"operator()",&fpara,G__TRYNORMAL); +#endif return(result3); } @@ -2019,6 +2054,32 @@ int memfunc_flag; #ifndef G__OLDIMPLEMENTATION843 #ifdef G__ASM if(G__asm_noverflow) { +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCEXCEPTION %d\n" + ,G__asm_cp,G__tagnum); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCEXCEPTION; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__inc_cp_asm(2,0); + } + else { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n" + ,G__asm_cp,G__tagnum); + G__fprinterr(G__serr,"%3x: SETTEMP\n",G__asm_cp); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCTEMP; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__asm_inst[G__asm_cp+2]=G__SETTEMP; + G__inc_cp_asm(3,0); + } +#else /* ON2111 */ #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n",G__asm_cp,G__tagnum); @@ -2029,6 +2090,7 @@ int memfunc_flag; G__asm_inst[G__asm_cp+1]=G__tagnum; G__asm_inst[G__asm_cp+2]=G__SETTEMP; G__inc_cp_asm(3,0); +#endif /* ON2111 */ } #endif #endif @@ -2050,7 +2112,11 @@ int memfunc_flag; ,G__TRYCONSTRUCTOR); if(*known3) break; } - if(G__CPPLINK==G__struct.iscpplink[G__tagnum]) { + if(G__CPPLINK==G__struct.iscpplink[G__tagnum] +#ifndef G__OLDIMPLEMENTATION2111 + && !G__throwingexception +#endif + ) { G__store_tempobject(result3); if(G__dispsource) { G__fprinterr(G__serr, @@ -2098,14 +2164,26 @@ int memfunc_flag; G__store_struct_offset=store_struct_offset; #ifndef G__OLDIMPLEMENTATION1500 #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2111 + && (!G__throwingexception || + (-1!=result3.tagnum && + G__CPPLINK!=G__struct.iscpplink[result3.tagnum])) +#endif + ) { + G__asm_inst[G__asm_cp]=G__POPTEMP; +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) G__asm_inst[G__asm_cp+1] = result3.tagnum; + else G__asm_inst[G__asm_cp+1] = -1; +#else + G__asm_inst[G__asm_cp+1] = -1; +#endif #ifdef G__ASM_DBG - if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP -1\n",G__asm_cp); + if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP %d\n" + ,G__asm_cp,G__asm_inst[G__asm_cp+1]); #endif - G__asm_inst[G__asm_cp]=G__POPTEMP; - G__asm_inst[G__asm_cp+1] = -1; - G__inc_cp_asm(2,0); - } + G__inc_cp_asm(2,0); + } #endif #endif @@ -2235,8 +2313,7 @@ int memfunc_flag; if(len>1) libp->parameter[0][len-1]=0; libp->para[0] = G__getexpr(libp->parameter[0]); libp->paran=1; - G__parenthesisovldobj(&result3,&result3,"operator[]" - ,libp,G__TRYNORMAL); + G__parenthesisovldobj(&result3,&result3,"operator[]",libp,G__TRYNORMAL); } #endif #ifndef G__OLDIMPLEMENTATION1515 @@ -3804,6 +3881,32 @@ int memfunc_flag; #ifndef G__OLDIMPLEMENTATION843 #ifdef G__ASM if(G__asm_noverflow) { +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCEXCEPTION %d\n" + ,G__asm_cp,G__tagnum); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCEXCEPTION; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__inc_cp_asm(2,0); + } + else { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n" + ,G__asm_cp,G__tagnum); + G__fprinterr(G__serr,"%3x: SETTEMP\n",G__asm_cp); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCTEMP; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__asm_inst[G__asm_cp+2]=G__SETTEMP; + G__inc_cp_asm(3,0); + } +#else /* 2111 */ #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n",G__asm_cp,G__tagnum); @@ -3814,6 +3917,7 @@ int memfunc_flag; G__asm_inst[G__asm_cp+1]=G__tagnum; G__asm_inst[G__asm_cp+2]=G__SETTEMP; G__inc_cp_asm(3,0); +#endif /* 2111 */ } #endif #endif @@ -3835,7 +3939,11 @@ int memfunc_flag; ,G__TRYCONSTRUCTOR); if(*known3) break; } - if(G__CPPLINK==G__struct.iscpplink[G__tagnum]) { + if(G__CPPLINK==G__struct.iscpplink[G__tagnum] +#ifndef G__OLDIMPLEMENTATION2111 + && !G__throwingexception +#endif + ) { G__store_tempobject(result3); if(G__dispsource) { G__fprinterr(G__serr, @@ -3883,14 +3991,26 @@ int memfunc_flag; G__store_struct_offset=store_struct_offset; #ifndef G__OLDIMPLEMENTATION1500 #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2111 + && (!G__throwingexception || + (-1!=result3.tagnum && + G__CPPLINK!=G__struct.iscpplink[result3.tagnum])) +#endif + ) { + G__asm_inst[G__asm_cp]=G__POPTEMP; +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) G__asm_inst[G__asm_cp+1] = result3.tagnum; + else G__asm_inst[G__asm_cp+1] = -1; +#else + G__asm_inst[G__asm_cp+1] = -1; +#endif #ifdef G__ASM_DBG - if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP -1\n",G__asm_cp); + if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP %d\n" + ,G__asm_cp,G__asm_inst[G__asm_cp+1]); #endif - G__asm_inst[G__asm_cp]=G__POPTEMP; - G__asm_inst[G__asm_cp+1] = -1; - G__inc_cp_asm(2,0); - } + G__inc_cp_asm(2,0); + } #endif #endif @@ -5396,6 +5516,14 @@ int hash; return(1); } +#ifndef G__OLDIMPLEMENTATION2119 + if(strcmp(funcname,"G__delete_ipath")==0) { + if(G__no_exec_compile) return(1); + G__letint(result7,'i',(long)G__delete_ipath((char*)G__int(libp->para[0]))); + return(1); + } +#endif + #ifndef G__OLDIMPLEMENTATION1963 if(strcmp(funcname,"G__SetCINTSYSDIR")==0) { if(G__no_exec_compile) return(1); diff --git a/cint/src/global1.c b/cint/src/global1.c index 191e0014f49..07356d864eb 100644 --- a/cint/src/global1.c +++ b/cint/src/global1.c @@ -67,6 +67,9 @@ int G__asm_wholefunc_default_cp; #ifdef G__ASM_IFUNC long *G__asm_inst; /* p-code instruction buffer */ +#ifndef G__OLDIMPLEMENTATION2116 +int G__asm_instsize; +#endif G__value *G__asm_stack; /* data stack and constant buffer */ char *G__asm_name; diff --git a/cint/src/global2.c b/cint/src/global2.c index 9d4dcccc82a..2c4cbb41c35 100644 --- a/cint/src/global2.c +++ b/cint/src/global2.c @@ -520,9 +520,14 @@ int G__mask_error=0; G__eolcallback_t G__eolcallback; #endif +#ifndef G__OLDIMPLEMENTATION2111 +int G__throwingexception=0; +#endif + int G__scopelevel=0; int G__cintv6 = 0; + /* * Local Variables: * c-tab-always-indent:nil diff --git a/cint/src/ifunc.c b/cint/src/ifunc.c index a2f4d75cf77..c447e3cdbd9 100644 --- a/cint/src/ifunc.c +++ b/cint/src/ifunc.c @@ -218,6 +218,7 @@ void* G__allocheapobjectstack G__P((struct G__ifunc_table* ifunc,int ifn,int sco void G__copyheapobjectstack G__P((void* p,G__value* result,struct G__ifunc_table *ifunc,int ifn)); #endif +#ifdef G__OLDIMPLEMENTATION2112 /************************************************************************** * G__exec_bytecode() * @@ -495,6 +496,7 @@ int hash; /* not used */ return(0); } +#endif /* 2112 */ #ifndef G__OLDIMPLEMENTATION523 @@ -6229,6 +6231,9 @@ int memfunc_flag; char asm_name[G__ASM_FUNCNAMEBUF]; long *store_asm_inst; +#ifndef G__OLDIMPLEMENTATION2116 + int store_asm_instsize; +#endif G__value *store_asm_stack; char *store_asm_name; int store_asm_name_p; @@ -6863,7 +6868,10 @@ asm_ifunc_start: /* loop compilation execution label */ #ifndef G__OLDIMPLEMENTATION2067 if(G__cintv6 && G__BYTECODE_NOTYET==p_ifunc->pentry[ifn]->bytecodestatus) { - G__bc_compile_function(p_ifunc,ifn); + if(G__BYTECODE_FAILURE==G__bc_compile_function(p_ifunc,ifn)) { + G__exec_memberfunc=store_exec_memberfunc; + return(1); + } } #endif @@ -6938,6 +6946,11 @@ asm_ifunc_start: /* loop compilation execution label */ store_asm_dt = G__asm_dt ; store_asm_index = G__asm_index ; +#ifndef G__OLDIMPLEMENTATION2116 + store_asm_instsize = G__asm_instsize; + G__asm_instsize = 0; /* G__asm_inst is not resizable */ +#endif + G__asm_inst = asm_inst_g; G__asm_stack = asm_stack_g; G__asm_name = asm_name; @@ -8223,6 +8236,9 @@ asm_ifunc_start: /* loop compilation execution label */ #ifdef G__ASM_IFUNC /* Pop loop compilation environment */ G__asm_inst = store_asm_inst; +#ifndef G__OLDIMPLEMENTATION2116 + G__asm_instsize = store_asm_instsize; +#endif G__asm_stack = store_asm_stack; G__asm_name = store_asm_name; G__asm_name_p = store_asm_name_p; diff --git a/cint/src/init.c b/cint/src/init.c index 9148e2b3058..7c40e97c4cf 100644 --- a/cint/src/init.c +++ b/cint/src/init.c @@ -1725,6 +1725,9 @@ int G__init_globals() G__asm_dt=G__MAXSTACK-1; /* constant data address */ #ifdef G__ASM_IFUNC G__asm_inst = G__asm_inst_g; +#ifndef G__OLDIMPLEMENTATION2116 + G__asm_instsize = 0; /* 0 means G__asm_inst is not resizable */ +#endif G__asm_stack = G__asm_stack_g; G__asm_name = G__asm_name_g; G__asm_name_p = 0; @@ -2246,7 +2249,7 @@ void G__platformMacro() #ifdef __KCC /* KCC C++ compiler */ sprintf(temp,"G__KCC=%ld",(long)__KCC); G__add_macro(temp); #endif -#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 810 /* icc and ecc C++ compilers */ +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER<810) /* icc and ecc C++ compilers */ sprintf(temp,"G__INTEL_COMPILER=%ld",(long)__INTEL_COMPILER); G__add_macro(temp); #endif #ifndef _AIX diff --git a/cint/src/newlink.c b/cint/src/newlink.c index 67a753361a4..e975c9dfea7 100644 --- a/cint/src/newlink.c +++ b/cint/src/newlink.c @@ -2692,6 +2692,82 @@ char *path; } +#ifndef G__OLDIMPLEMENTATION2119 +/************************************************************************** +* G__delete_ipath() +* +**************************************************************************/ +int G__delete_ipath(path) +char *path; +{ + struct G__includepath *ipath; + struct G__includepath *previpath; + char temp[G__ONELINE]; + char temp2[G__ONELINE]; + int i=0,flag=0; + char *p; + + /* strip double quotes if exist */ + if('"'==path[0]) { + strcpy(temp,path+1); + if('"'==temp[strlen(temp)-1]) temp[strlen(temp)-1]='\0'; + } + else { + strcpy(temp,path); + } + + /* to the end of list */ + ipath = &G__ipathentry; + previpath = (struct G__includepath*)NULL; + while(ipath->next) { + if(ipath->pathname&&strcmp(ipath->pathname,temp)==0) { + /* delete this entry */ + free((void*)ipath->pathname); + ipath->pathname=(char*)NULL; + if(previpath) { + previpath->next = ipath->next; + free((void*)ipath); + } + else if(ipath->next) { +#if 1 + G__ipathentry.pathname = calloc(1,1); +#else + G__ipathentry.pathname = ipath->next->pathname; + G__ipathentry.next = ipath->next->next; + free((void*)ipath->next); +#endif + } + else { + free((void*)G__ipathentry.pathname); + G__ipathentry.pathname=(char*)NULL; + } + break; + } + ipath = ipath->next; + } + + /* G__allincludepath will be given to real preprocessor */ + if(!G__allincludepath) return(0); + i=0; + while(temp[i]) if(isspace(temp[i++])) flag=1; + if(flag) sprintf(temp2,"-I\"%s\" ",temp); + else sprintf(temp2,"-I%s ",temp); + + p = strstr(G__allincludepath,temp2); + if(p) { + char *p2 = p+strlen(temp2); + while(*p2) *p++ = *p2++; + *p = *p2; + return(1); + } + + return(0); +} + + +#endif + + /************************************************************************** ************************************************************************** * Generate C++ function access entry function diff --git a/cint/src/opr.c b/cint/src/opr.c index 3c70b4821b7..d0ce9231160 100644 --- a/cint/src/opr.c +++ b/cint/src/opr.c @@ -182,56 +182,56 @@ G__value *defined; long val; { if(isupper(defined->type)) { - *(long*)defined->ref = (long)val; + if(defined->ref) *(long*)defined->ref = (long)val; defined->obj.i = (long)val; return; } switch(defined->type) { case 'i': /* int */ - *(int*)defined->ref = (int)val; + if(defined->ref) *(int*)defined->ref = (int)val; defined->obj.i = (int)val; break; case 'c': /* char */ - *(char*)defined->ref = (char)val; + if(defined->ref) *(char*)defined->ref = (char)val; defined->obj.i = (char)val; break; case 'l': /* long */ - *(long*)defined->ref = (long)val; + if(defined->ref) *(long*)defined->ref = (long)val; defined->obj.i = (long)val; break; case 's': /* short */ - *(short*)defined->ref = (short)val; + if(defined->ref) *(short*)defined->ref = (short)val; defined->obj.i = (short)val; break; case 'k': /* unsigned long */ - *(unsigned long*)defined->ref = (unsigned long)val; + if(defined->ref) *(unsigned long*)defined->ref = (unsigned long)val; defined->obj.i = (unsigned long)val; break; case 'h': /* unsigned int */ - *(unsigned int*)defined->ref = (unsigned int)val; + if(defined->ref) *(unsigned int*)defined->ref = (unsigned int)val; defined->obj.i = (unsigned int)val; break; case 'r': /* unsigned short */ - *(unsigned short*)defined->ref = (unsigned short)val; + if(defined->ref) *(unsigned short*)defined->ref = (unsigned short)val; defined->obj.i = (unsigned short)val; break; case 'b': /* unsigned char */ - *(unsigned char*)defined->ref = (unsigned char)val; + if(defined->ref) *(unsigned char*)defined->ref = (unsigned char)val; defined->obj.i = (unsigned char)val; break; #ifndef G__OLDIMPLEMENTATION1604 case 'g': /* bool */ - *(unsigned char*)defined->ref = (unsigned char)(val?1:0); + if(defined->ref) *(unsigned char*)defined->ref = (unsigned char)(val?1:0); defined->obj.i = (int)val?1:0; break; #endif case 'd': /* double */ - *(double*)defined->ref = (double)val; + if(defined->ref) *(double*)defined->ref = (double)val; defined->obj.d = (double)val; break; case 'f': /* float */ - *(float*)defined->ref = (float)val; + if(defined->ref) *(float*)defined->ref = (float)val; defined->obj.d = (float)val; break; default: @@ -2477,7 +2477,7 @@ G__value *result3; G__value *result; char *realname; struct G__param *libp; -int flag; +int flag; /* flag whether to generate PUSHSTROS, SETSTROS */ { int known; long store_struct_offset; @@ -2502,7 +2502,11 @@ int flag; G__tagnum = result->tagnum; #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2120 + && !flag +#endif + ) { #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: PUSHSTROS\n",G__asm_cp); diff --git a/cint/src/parse.c b/cint/src/parse.c index 5c86a374fe2..e9e92f8028b 100644 --- a/cint/src/parse.c +++ b/cint/src/parse.c @@ -421,6 +421,27 @@ char* statement; return(0); } +/*********************************************************************** +* G__alloc_exceptionbuffer +* +***********************************************************************/ +G__value G__alloc_exceptionbuffer(tagnum) +int tagnum; +{ + G__value buf; + /* create class object */ + buf.obj.i = (long)malloc((size_t)G__struct.size[tagnum]); +#ifndef G__OLDIMPLEMENTATION1978 + buf.obj.reftype.reftype = G__PARANORMAL; +#endif + buf.type = 'u'; + buf.tagnum = tagnum; + buf.typenum = -1; + buf.ref = G__p_tempbuf->obj.obj.i; + + return(buf); +} + /*********************************************************************** * G__free_exceptionbuffer * @@ -441,7 +462,8 @@ int G__free_exceptionbuffer() else G__globalvarpointer = G__PVOID; sprintf(destruct,"~%s()",G__fulltagname(G__tagnum,1)); if(G__dispsource) { - G__fprinterr(G__serr,"!!!Destructing exception buffer %s",destruct); + G__fprinterr(G__serr,"!!!Destructing exception buffer %s %lx" + ,destruct,G__exceptionbuffer.obj.i); G__printlinenum(); } G__getfunction(destruct,&dmy ,G__TRYDESTRUCTOR); @@ -450,6 +472,9 @@ int G__free_exceptionbuffer() free((void*)G__store_struct_offset); #else free((void*)G__store_struct_offset); +#endif +#ifndef G__OLDIMPLEMENTATION2111 + /* do nothing here, exception object shouldn't be stored in legacy temp buf */ #endif G__tagnum = store_tagnum; G__store_struct_offset = store_struct_offset; diff --git a/cint/src/pcode.c b/cint/src/pcode.c index edb7c312549..ec2fc665e6c 100644 --- a/cint/src/pcode.c +++ b/cint/src/pcode.c @@ -763,6 +763,23 @@ long localmem; * 0 CL * clear stack pointer ***************************************/ +#ifndef G__OLDIMPLEMENTATION2132 +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: CL %s:%d\n",pc,sp + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#endif + if(G__breaksignal) { + struct G__input_file store_ifile = G__ifile; + G__ifile.line_number=G__asm_inst[pc+1]&G__CL_LINEMASK; + G__ifile.filenum=G__asm_inst[pc+1]/G__CL_FILESHIFT; + if(G__ifile.filenum>=0) + strcpy(G__ifile.name,G__srcfile[G__ifile.filenum].filename); + G__pr(G__serr,G__ifile); + G__pause(); + G__ifile=store_ifile; + } +#else /* 2132 */ #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: CL %d\n",pc,sp,G__asm_inst[pc+1]); #endif @@ -772,6 +789,7 @@ long localmem; G__pause(); G__ifile.line_number=sp; } +#endif /* 2132 */ #ifndef G__OLDIMPLEMENTATION2062 G__delete_autoobjectstack(G__scopelevel); #endif /* 2062 */ @@ -2234,7 +2252,7 @@ long localmem; case G__RTN_FUNC: /*************************************** * 0 RTN_FUNC - * 1 isreturnvalue + * 1 isreturnvalue 0:no return val, 1:with return val, 2: * stack * sp-1 -> return this * sp @@ -2242,6 +2260,10 @@ long localmem; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: RTN_FUNC %d\n" ,pc,sp ,G__asm_inst[pc+1]); +#endif +#ifndef G__OLDIMPLEMENTATION2110 + /* return from 'try { }' block */ + if(2==G__asm_inst[pc+1]) return(1); #endif G__asm_exec = 0; G__return=G__RETURN_NORMAL; @@ -2643,6 +2665,112 @@ long localmem; #endif #endif /* ON1073 */ + +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: TRY %lx %lx\n",pc,sp,G__asm_inst[pc+1],G__asm_inst[pc+2]); +#endif + { + switch(G__bc_exec_try_bytecode(pc+3,sp,presult,localmem)) { + case G__TRY_NORMAL: + pc=G__asm_inst[pc+2]; + break; + case G__TRY_INTERPRETED_EXCEPTION: + case G__TRY_COMPILED_EXCEPTION: + G__delete_autoobjectstack(G__scopelevel); + G__asm_stack[sp++]=G__exceptionbuffer; + pc=G__asm_inst[pc+1]; + break; + case G__TRY_UNCAUGHT: + default: + /* pc+=3; */ + break; + } + } +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: TYPEMATCH %ld\n",pc,sp,G__asm_inst[pc+1]); +#endif + G__letint(&G__asm_stack[sp],'i', + (long)G__bc_exec_typematch_bytecode(&G__asm_stack[G__asm_inst[pc+1]], + &G__asm_stack[sp-1])); + pc+=2; + ++sp; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: ALLOCEXCEPTION %ld\n" + ,pc,sp,G__asm_inst[pc+1]); +#endif + G__asm_stack[sp] = G__alloc_exceptionbuffer(G__asm_inst[pc+1]); + store_struct_offset = G__store_struct_offset; + store_tagnum = G__tagnum; + store_return=G__return; + G__store_struct_offset = G__asm_stack[sp].obj.i; + G__tagnum = G__asm_stack[sp].tagnum; + G__return=G__RETURN_NON; /* ??? */ + pc+=2; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: DESTROYEXCEPTION\n",pc,sp); +#endif + G__free_exceptionbuffer(); + ++pc; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** @@ -2652,11 +2780,23 @@ long localmem; * sp-1 <- * sp ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: THROW\n",pc,sp); +#endif +#ifndef G__OLDIMPLEMENTATION2109 + // TODO, it is questionable to set G__exceptionbuffer here. + // Maybe better setting this in catch block in G__bc_try_bytecode() + G__exceptionbuffer = G__asm_stack[sp-1]; + + G__bc_exec_throw_bytecode(&G__asm_stack[sp-1]); +#else G__exceptionbuffer = G__asm_stack[sp-1]; + /* TODO, Use true throw here, instead of following return operation */ if('U'==G__exceptionbuffer.type) G__exceptionbuffer.type='u'; G__return = G__RETURN_TRY; --sp; pc+=1; +#endif #ifndef G__OLDIMPLEMENTATION1281 return(1); #else @@ -2669,7 +2809,7 @@ long localmem; case G__CATCH: /*************************************** - * inst + * inst This instruction is not needed. Never used * 0 CATCH * 1 filenum * 2 linenum @@ -5532,6 +5672,18 @@ G__value *bufm2; #endif +#ifndef G__OLDIMPLEMENTATION2129 +/************************************************************************* +* G__OP2_addvoidptr() +*************************************************************************/ +void G__OP2_addvoidptr(bufm1,bufm2) +G__value *bufm1; +G__value *bufm2; +{ + bufm2->obj.i += bufm1->obj.i; +} +#endif + /**************************************************************** * G__OP2_OPTIMIZED ****************************************************************/ @@ -6689,6 +6841,21 @@ int cp_inc,dt_dec; G__asm_dt-=dt_dec; #endif +#ifndef G__OLDIMPLEMENTATION2116 + if(G__asm_instsize && G__asm_cp>G__asm_instsize-8) { + G__asm_instsize += 0x100; + void *p = realloc((void*)G__asm_stack,sizeof(long)*G__asm_instsize); + if(!p) G__genericerror("Error: memory exhausted for bytecode instruction buffer\n"); + G__asm_inst = (long*)p; + } + else if(!G__asm_instsize && G__asm_cp>G__MAXINST-8) { + if(G__asm_dbg) { + G__fprinterr(G__serr,"Warning: loop compile instruction overflow"); + G__printlinenum(); + } + G__abortbytecode(); + } +#else /* 2116 */ if(G__asm_cp>G__MAXINST-8) { #ifndef G__OLDIMPLEMENTATION841 if(G__asm_dbg) { @@ -6698,6 +6865,7 @@ int cp_inc,dt_dec; #endif G__abortbytecode(); } +#endif /* 2116 */ if(G__asm_dt<30) { #ifndef G__OLDIMPLEMENTATION841 @@ -6754,7 +6922,12 @@ int G__asm_clear() if(G__asm_cp<2 || G__CL!=G__asm_inst[G__asm_cp-2]) { G__asm_inst[G__asm_cp]=G__CL; +#ifndef G__OLDIMPLEMENTATION2132 + G__asm_inst[G__asm_cp+1]= (G__ifile.line_number&G__CL_LINEMASK) + + (G__ifile.filenum&G__CL_FILEMASK)*G__CL_FILESHIFT; +#else G__asm_inst[G__asm_cp+1]=G__ifile.line_number; +#endif G__inc_cp_asm(2,0); } return(0); @@ -7067,11 +7240,11 @@ int *start; * 2 paran NOP * 3 point_level <- check 3 NOP * 4 *var (2) NOP - * 5 LD <- check 1 NOP + * 5 LD <- check 1 NOP bydy of *b * 6 data_stack <- check 2 (int) CMPJMP * 7 CMP2 <- check 1 *compare() - * 8 <,<=,>,>=,==,!= case *a - * 9 CNDJMP <- check 1 *b + * 8 <,<=,>,>=,==,!= case *a var->p[] + * 9 CNDJMP <- check 1 *b ptr to inst[5] * 10 next_pc=G__asm_cp next_pc=G__asm_cp * . . * -2 JMP JMP @@ -7114,8 +7287,12 @@ int *start; ) G__asm_inst[*start+8] += G__store_struct_offset; - /* long to int conversion */ - pb = (int*)(&(G__asm_stack[G__asm_inst[*start+6]].obj.i)); + /* long to int conversion */ /* TODO, Storing ptr to temporary stack buffer, is this Bad? */ +#ifndef G__OLDIMPLEMENTATION2113 + pb = (int*)(&G__asm_inst[*start+5]); +#else + pb = (int*)(&(G__asm_stack[G__asm_inst[*start+6]].obj.i)); /* TODO, ??? */ +#endif *pb = G__int(G__asm_stack[G__asm_inst[*start+6]]); G__asm_inst[*start+9]=(long)(pb); G__asm_inst[*start+6]=G__CMPJMP; @@ -7145,8 +7322,8 @@ int *start; * 8 point_level <- check 3 NOP * 9 *var (2) CMPJMP * 10 CMP2 <- check 1 *compare() - * 11 <,<=,>,>=,==,!= case *a - * 12 CNDJMP <- check 1 *b + * 11 <,<=,>,>=,==,!= case *a var->[] + * 12 CNDJMP <- check 1 *b var->[] * 13 next_pc=G__asm_cp next_pc=G__asm_pc * . * -2 JMP JMP @@ -7224,7 +7401,7 @@ int *start; * before ----------> after * * -9 G__LD_VAR,LD_MSTR INCJMP - * -8 index *a + * -8 index *a var->p[] * -7 paran 1,,-1 * -6 point_level next_pc * -5 *var NOP @@ -7303,7 +7480,7 @@ int *start; * before ----------> after * * -11 G__LD_VAR,LD_MSTR INCJMP - * -10 index *a + * -10 index *a var->p[] * -9 paran 1,,-1 * -8 point_level next_pc * -7 *var NOP @@ -7382,7 +7559,7 @@ int *start; * before ----------> after * * -16 G__LD_VAR,MSTR<- check 1 INCJMP - * -15 index <- check 2 *a + * -15 index <- check 2 *a var->p[] * -14 paran <- check 3 inc * -13 point_level <- check 3 next_pc * -12 *var <- (2) NOP @@ -8927,6 +9104,11 @@ int pc; case G__OPR_DIVASSIGN_FD: G__asm_inst[pc+1] = (long)G__OP2_divassign_fd; break; +#ifndef G__OLDIMPLEMENTATION2129 + case G__OPR_ADDVOIDPTR: + G__asm_inst[pc+1] = (long)G__OP2_addvoidptr; + break; +#endif default: done=0; break; @@ -9167,7 +9349,13 @@ int *start; * clear stack pointer ***************************************/ #ifdef G__ASM_DBG +#ifndef G__OLDIMPLEMENTATION2132 + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CL %s:%d\n",pc + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#else if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CL %d\n",pc,G__asm_inst[pc+1]); +#endif #endif /* no optimize */ pc+=2; @@ -10456,6 +10644,68 @@ int *start; ++pc; break; +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: TRY %lx %lx\n",pc + ,G__asm_inst[pc+1] ,G__asm_inst[pc+2]); +#endif + /* no optimization */ + pc+=3; + break; + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: TYPEMATCH\n",pc); +#endif + /* no optimization */ + pc+=2; + break; + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3lx: ALLOCEXCEPTION %d\n",pc,G__asm_inst[pc+1]); +#endif + /* no optimization */ + pc+=2; + break; + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: DESTROYEXCEPTION\n",pc); +#endif + /* no optimization */ + ++pc; + break; +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** @@ -10465,11 +10715,11 @@ int *start; * sp-1 <- * sp ***************************************/ - pc+=1; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: THROW\n",pc); #endif /* no optimization */ + pc+=1; break; case G__CATCH: @@ -10481,11 +10731,11 @@ int *start; * 3 pos * 4 " ***************************************/ - pc+=5; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CATCH\n",pc); #endif /* no optimization */ + pc+=5; break; #endif @@ -10810,7 +11060,13 @@ int isthrow; * clear stack pointer ***************************************/ if(0==isthrow) { +#ifndef G__OLDIMPLEMENTATION2132 + fprintf(fout,"%3x: CL %s:%d\n",pc + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#else fprintf(fout,"%3x: CL %ld\n",pc,G__asm_inst[pc+1]); +#endif } pc+=2; break; @@ -11700,6 +11956,63 @@ int isthrow; break; #endif +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: TRY %lx %lx\n",pc + ,G__asm_inst[pc+1] ,G__asm_inst[pc+2]); + } + pc+=3; + break; + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: TYPEMATCH\n",pc); + } + pc+=2; + break; + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: ALLOCEXCEPTION %ld\n",pc,G__asm_inst[pc+1]); + } + pc+=2; + break; + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: DESTROYEXCEPTION\n",pc); + } + ++pc; + break; +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** diff --git a/cint/src/shl.c b/cint/src/shl.c index 82e26cb67b8..e8acd510bfc 100644 --- a/cint/src/shl.c +++ b/cint/src/shl.c @@ -2044,7 +2044,15 @@ void* G__GetShlHandle() **************************************************************************/ int G__GetShlFilenum() { +#ifdef G__SHAREDLIB +#ifndef G__OLDIMPLEMENTATION2012 return(G__Shlfilenum); +#else + return(0); +#endif +#else + return(0); +#endif } #endif diff --git a/cint/src/tmplt.c b/cint/src/tmplt.c index 5bb507b5340..27ffdf3ee62 100644 --- a/cint/src/tmplt.c +++ b/cint/src/tmplt.c @@ -1503,7 +1503,9 @@ void G__declare_template() #ifndef G__OLDIMPLEMENTATION691 int isforwarddecl = 0; #endif +#ifndef G__OLDIMPLEMENTATION2106 int isfrienddecl = 0; +#endif #ifndef G__OLDIMPLEMENTATION1412 #ifndef G__OLDIMPLEMENTATION1601 @@ -1542,10 +1544,12 @@ void G__declare_template() do { c=G__fgetname_template(temp,"(<"); +#ifndef G__OLDIMPLEMENTATION2106 if (strcmp(temp,"friend")==0) { isfrienddecl = 1; c=G__fgetname_template(temp,"(<"); } +#endif } while(strcmp(temp,"inline")==0||strcmp(temp,"const")==0 #ifndef G__OLDIMPLEMENTATION1463 || strcmp(temp,"typename")==0 @@ -2326,7 +2330,11 @@ char *tagnamein; #endif #ifdef G__ASM +#ifndef G__OLDIMPLEMENTATION2124 + if(!G__cintv6) G__abortbytecode(); +#else G__abortbytecode(); +#endif #endif call_para.string=(char*)NULL; diff --git a/cint/src/v6_auxu.cxx b/cint/src/v6_auxu.cxx index 5cd119888be..18fb391ae21 100644 --- a/cint/src/v6_auxu.cxx +++ b/cint/src/v6_auxu.cxx @@ -634,8 +634,13 @@ char *typename; break; } if(type) strcpy(type,vtype); - if(tagname && buf.tagnum>=0) strcpy(tagname,G__struct.name[buf.tagnum]) ; - if(typename && buf.typenum>=0) strcpy(typename,G__newtype.name[buf.typenum]) ; +#ifndef G__OLDIMPLEMENTATION2108 + if(tagname && buf.tagnum>=0) strcpy(tagname,G__struct.name[buf.tagnum]); + if(typename && buf.typenum>=0) strcpy(typename,G__newtype.name[buf.typenum]); +#else + if(tagname) strcpy(tagname,G__struct.name[buf.tagnum]) ; + if(typename) strcpy(typename,G__newtype.name[buf.typenum]) ; +#endif sprintf(vtype,"&%s",name); buf = G__calc_internal(vtype); diff --git a/cint/src/v6_decl.cxx b/cint/src/v6_decl.cxx index a8547b82e66..bc6ed67944e 100644 --- a/cint/src/v6_decl.cxx +++ b/cint/src/v6_decl.cxx @@ -2580,7 +2580,12 @@ int tagnum,typenum; /* overrides global variables */ } /* struct class initialization ={x,y,z} */ if(initary) { - if(known) { + if(known +#ifndef G__OLDIMPLEMENTATION2130 + && (G__struct.funcs[tagnum]& G__HAS_XCONSTRUCTOR) + /* && (G__struct.funcs[tagnum]& G__HAS_DEFAULTCONSTRUCTOR) */ +#endif + ) { G__fprinterr(G__serr, "Error: Illegal initialization of %s. Constructor exists " ,new_name); @@ -3381,7 +3386,16 @@ char *new_name; * initiazlize this element *******************************************/ buf.obj.i=var->p[ig15]+size*pinc; +#ifndef G__OLDIMPLEMENTATION2125 + { + int store_prerun=G__prerun; + G__prerun=0; + reg=G__getexpr(expr); + G__prerun=store_prerun; + } +#else reg=G__getexpr(expr); +#endif #ifndef G__OLDIMPLEMENTATION1607 if( #ifndef G__OLDIMPLEMENTATION1621 @@ -3500,7 +3514,7 @@ char *new_name; /************************************************************************** * G__initmemvar() **************************************************************************/ -static struct G__var_array* G__initmemvar(tagnum,pindex,pbuf) +struct G__var_array* G__initmemvar(tagnum,pindex,pbuf) int tagnum; int* pindex; G__value *pbuf; @@ -3508,6 +3522,9 @@ G__value *pbuf; struct G__var_array* memvar; *pindex=0; if(-1!=tagnum) { +#ifndef G__OLDIMPLEMENTATION2131 + G__incsetup_memvar(tagnum); +#endif memvar=G__struct.memvar[tagnum]; pbuf->tagnum=memvar->p_tagtable[*pindex]; pbuf->typenum=memvar->p_typetable[*pindex]; @@ -3523,7 +3540,7 @@ G__value *pbuf; /************************************************************************** * G__incmemvar() **************************************************************************/ -static struct G__var_array* G__incmemvar(memvar,pindex,pbuf) +struct G__var_array* G__incmemvar(memvar,pindex,pbuf) struct G__var_array* memvar; int* pindex; G__value *pbuf; diff --git a/cint/src/v6_error.cxx b/cint/src/v6_error.cxx index 69a9717d9b9..479cd724e29 100644 --- a/cint/src/v6_error.cxx +++ b/cint/src/v6_error.cxx @@ -278,7 +278,11 @@ char *item; if(G__no_exec_compile && 0==G__asm_noverflow) return(0); #endif if(G__in_pause) return(0); - if(G__ASM_FUNC_COMPILE&G__asm_wholefunction) { + if( +#ifndef G__OLDIMPLEMENTATION2105 + !G__cintv6 && +#endif + G__ASM_FUNC_COMPILE&G__asm_wholefunction) { G__CHECK(G__SECURE_PAUSE,1,G__pause()); G__CHECK(G__SECURE_EXIT_AT_ERROR,1,G__return=G__RETURN_EXIT1); } @@ -584,6 +588,13 @@ char *message; } #endif +#ifndef G__OLDIMPLEMENTATION2117 + if(G__cintv6) { + if(G__cintv6&G__BC_COMPILEERROR) G__bc_throw_compile_error(); + if(G__cintv6&G__BC_RUNTIMEERROR) G__bc_throw_runtime_error(); + } +#endif + return(0); } diff --git a/cint/src/v6_expr.cxx b/cint/src/v6_expr.cxx index 41baa218022..e71a0e32114 100644 --- a/cint/src/v6_expr.cxx +++ b/cint/src/v6_expr.cxx @@ -1435,6 +1435,7 @@ char *expression; strcmp(ebuf,"static_cast")==0 || strcmp(ebuf,"reinterpret_cast")==0 || strcmp(ebuf,"const_cast")==0) { + /* TODO, implement casts, may need to introduce new instruction */ ++ig1; ebuf[0]='('; c=G__getstream_template(expression,&ig1,ebuf+1,">"); diff --git a/cint/src/v6_func.cxx b/cint/src/v6_func.cxx index 12c5dee1fac..cd8140bc1b5 100644 --- a/cint/src/v6_func.cxx +++ b/cint/src/v6_func.cxx @@ -63,6 +63,24 @@ int G__getoptimizemode G__P(()); extern int G__const_noerror; #endif +#ifndef G__OLDIMPLEMENTATION2120 +/****************************************************************** +* +* G__gen_PUSHSTROS_SETSTROS() +******************************************************************/ +void G__gen_PUSHSTROS_SETSTROS() { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: PUSHSTROS\n",G__asm_cp); + G__fprinterr(G__serr,"%3x: SETSTROS\n",G__asm_cp+1); + } +#endif + G__asm_inst[G__asm_cp] = G__PUSHSTROS; + G__asm_inst[G__asm_cp+1] = G__SETSTROS; + G__inc_cp_asm(2,0); +} +#endif + /****************************************************************** * G__dispvalue() ******************************************************************/ @@ -319,10 +337,18 @@ char *cindex; if('u'==result3->type) { struct G__param fpara; +#ifndef G__OLDIMPLEMENTATION2120 +#ifdef G__ASM + if(G__asm_noverflow) G__gen_PUSHSTROS_SETSTROS(); +#endif +#endif fpara.paran=1; fpara.para[0]=G__getexpr(sindex+1); - G__parenthesisovldobj(result3,result3,"operator[]" - ,&fpara,G__TRYNORMAL); +#ifndef G__OLDIMPLEMENTATION2120 + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,1); +#else + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,G__TRYNORMAL); +#endif return; } @@ -336,12 +362,11 @@ char *cindex; struct G__param fpara; fpara.paran=1; G__letint(&fpara.para[0],'i',index); - G__parenthesisovldobj(result3,result3,"operator[]" - ,&fpara,G__TRYNORMAL); + G__parenthesisovldobj(result3,result3,"operator[]",&fpara,G__TRYNORMAL); return; } #endif -#endif/* 2018 */ +#endif /* 2018 */ size = G__sizeof(result3); #ifdef G__ASM @@ -1274,10 +1299,20 @@ char* funcname; } } +#ifndef G__OLDIMPLEMENTATION2120 +#ifdef G__ASM + if(G__asm_noverflow) G__gen_PUSHSTROS_SETSTROS(); +#endif +#endif + for(itmp=0;itmp<fpara.paran;itmp++) { fpara.para[itmp] = G__getexpr(fpara.parameter[itmp]); } +#ifndef G__OLDIMPLEMENTATION2120 + G__parenthesisovldobj(&result3,presult,"operator()",&fpara,1); +#else G__parenthesisovldobj(&result3,presult,"operator()",&fpara,G__TRYNORMAL); +#endif return(result3); } @@ -2019,6 +2054,32 @@ int memfunc_flag; #ifndef G__OLDIMPLEMENTATION843 #ifdef G__ASM if(G__asm_noverflow) { +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCEXCEPTION %d\n" + ,G__asm_cp,G__tagnum); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCEXCEPTION; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__inc_cp_asm(2,0); + } + else { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n" + ,G__asm_cp,G__tagnum); + G__fprinterr(G__serr,"%3x: SETTEMP\n",G__asm_cp); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCTEMP; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__asm_inst[G__asm_cp+2]=G__SETTEMP; + G__inc_cp_asm(3,0); + } +#else /* ON2111 */ #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n",G__asm_cp,G__tagnum); @@ -2029,6 +2090,7 @@ int memfunc_flag; G__asm_inst[G__asm_cp+1]=G__tagnum; G__asm_inst[G__asm_cp+2]=G__SETTEMP; G__inc_cp_asm(3,0); +#endif /* ON2111 */ } #endif #endif @@ -2050,7 +2112,11 @@ int memfunc_flag; ,G__TRYCONSTRUCTOR); if(*known3) break; } - if(G__CPPLINK==G__struct.iscpplink[G__tagnum]) { + if(G__CPPLINK==G__struct.iscpplink[G__tagnum] +#ifndef G__OLDIMPLEMENTATION2111 + && !G__throwingexception +#endif + ) { G__store_tempobject(result3); if(G__dispsource) { G__fprinterr(G__serr, @@ -2098,14 +2164,26 @@ int memfunc_flag; G__store_struct_offset=store_struct_offset; #ifndef G__OLDIMPLEMENTATION1500 #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2111 + && (!G__throwingexception || + (-1!=result3.tagnum && + G__CPPLINK!=G__struct.iscpplink[result3.tagnum])) +#endif + ) { + G__asm_inst[G__asm_cp]=G__POPTEMP; +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) G__asm_inst[G__asm_cp+1] = result3.tagnum; + else G__asm_inst[G__asm_cp+1] = -1; +#else + G__asm_inst[G__asm_cp+1] = -1; +#endif #ifdef G__ASM_DBG - if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP -1\n",G__asm_cp); + if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP %d\n" + ,G__asm_cp,G__asm_inst[G__asm_cp+1]); #endif - G__asm_inst[G__asm_cp]=G__POPTEMP; - G__asm_inst[G__asm_cp+1] = -1; - G__inc_cp_asm(2,0); - } + G__inc_cp_asm(2,0); + } #endif #endif @@ -2235,8 +2313,7 @@ int memfunc_flag; if(len>1) libp->parameter[0][len-1]=0; libp->para[0] = G__getexpr(libp->parameter[0]); libp->paran=1; - G__parenthesisovldobj(&result3,&result3,"operator[]" - ,libp,G__TRYNORMAL); + G__parenthesisovldobj(&result3,&result3,"operator[]",libp,G__TRYNORMAL); } #endif #ifndef G__OLDIMPLEMENTATION1515 @@ -3804,6 +3881,32 @@ int memfunc_flag; #ifndef G__OLDIMPLEMENTATION843 #ifdef G__ASM if(G__asm_noverflow) { +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCEXCEPTION %d\n" + ,G__asm_cp,G__tagnum); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCEXCEPTION; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__inc_cp_asm(2,0); + } + else { +#ifdef G__ASM_DBG + if(G__asm_dbg) { + G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n" + ,G__asm_cp,G__tagnum); + G__fprinterr(G__serr,"%3x: SETTEMP\n",G__asm_cp); + } +#endif + G__asm_inst[G__asm_cp]=G__ALLOCTEMP; + G__asm_inst[G__asm_cp+1]=G__tagnum; + G__asm_inst[G__asm_cp+2]=G__SETTEMP; + G__inc_cp_asm(3,0); + } +#else /* 2111 */ #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: ALLOCTEMP %d\n",G__asm_cp,G__tagnum); @@ -3814,6 +3917,7 @@ int memfunc_flag; G__asm_inst[G__asm_cp+1]=G__tagnum; G__asm_inst[G__asm_cp+2]=G__SETTEMP; G__inc_cp_asm(3,0); +#endif /* 2111 */ } #endif #endif @@ -3835,7 +3939,11 @@ int memfunc_flag; ,G__TRYCONSTRUCTOR); if(*known3) break; } - if(G__CPPLINK==G__struct.iscpplink[G__tagnum]) { + if(G__CPPLINK==G__struct.iscpplink[G__tagnum] +#ifndef G__OLDIMPLEMENTATION2111 + && !G__throwingexception +#endif + ) { G__store_tempobject(result3); if(G__dispsource) { G__fprinterr(G__serr, @@ -3883,14 +3991,26 @@ int memfunc_flag; G__store_struct_offset=store_struct_offset; #ifndef G__OLDIMPLEMENTATION1500 #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2111 + && (!G__throwingexception || + (-1!=result3.tagnum && + G__CPPLINK!=G__struct.iscpplink[result3.tagnum])) +#endif + ) { + G__asm_inst[G__asm_cp]=G__POPTEMP; +#ifndef G__OLDIMPLEMENTATION2111 + if(G__throwingexception) G__asm_inst[G__asm_cp+1] = result3.tagnum; + else G__asm_inst[G__asm_cp+1] = -1; +#else + G__asm_inst[G__asm_cp+1] = -1; +#endif #ifdef G__ASM_DBG - if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP -1\n",G__asm_cp); + if(G__asm_dbg) G__fprinterr(G__serr,"%3x: POPTEMP %d\n" + ,G__asm_cp,G__asm_inst[G__asm_cp+1]); #endif - G__asm_inst[G__asm_cp]=G__POPTEMP; - G__asm_inst[G__asm_cp+1] = -1; - G__inc_cp_asm(2,0); - } + G__inc_cp_asm(2,0); + } #endif #endif @@ -5396,6 +5516,14 @@ int hash; return(1); } +#ifndef G__OLDIMPLEMENTATION2119 + if(strcmp(funcname,"G__delete_ipath")==0) { + if(G__no_exec_compile) return(1); + G__letint(result7,'i',(long)G__delete_ipath((char*)G__int(libp->para[0]))); + return(1); + } +#endif + #ifndef G__OLDIMPLEMENTATION1963 if(strcmp(funcname,"G__SetCINTSYSDIR")==0) { if(G__no_exec_compile) return(1); diff --git a/cint/src/v6_global1.cxx b/cint/src/v6_global1.cxx index 191e0014f49..07356d864eb 100644 --- a/cint/src/v6_global1.cxx +++ b/cint/src/v6_global1.cxx @@ -67,6 +67,9 @@ int G__asm_wholefunc_default_cp; #ifdef G__ASM_IFUNC long *G__asm_inst; /* p-code instruction buffer */ +#ifndef G__OLDIMPLEMENTATION2116 +int G__asm_instsize; +#endif G__value *G__asm_stack; /* data stack and constant buffer */ char *G__asm_name; diff --git a/cint/src/v6_global2.cxx b/cint/src/v6_global2.cxx index 9d4dcccc82a..2c4cbb41c35 100644 --- a/cint/src/v6_global2.cxx +++ b/cint/src/v6_global2.cxx @@ -520,9 +520,14 @@ int G__mask_error=0; G__eolcallback_t G__eolcallback; #endif +#ifndef G__OLDIMPLEMENTATION2111 +int G__throwingexception=0; +#endif + int G__scopelevel=0; int G__cintv6 = 0; + /* * Local Variables: * c-tab-always-indent:nil diff --git a/cint/src/v6_ifunc.cxx b/cint/src/v6_ifunc.cxx index a2f4d75cf77..c447e3cdbd9 100644 --- a/cint/src/v6_ifunc.cxx +++ b/cint/src/v6_ifunc.cxx @@ -218,6 +218,7 @@ void* G__allocheapobjectstack G__P((struct G__ifunc_table* ifunc,int ifn,int sco void G__copyheapobjectstack G__P((void* p,G__value* result,struct G__ifunc_table *ifunc,int ifn)); #endif +#ifdef G__OLDIMPLEMENTATION2112 /************************************************************************** * G__exec_bytecode() * @@ -495,6 +496,7 @@ int hash; /* not used */ return(0); } +#endif /* 2112 */ #ifndef G__OLDIMPLEMENTATION523 @@ -6229,6 +6231,9 @@ int memfunc_flag; char asm_name[G__ASM_FUNCNAMEBUF]; long *store_asm_inst; +#ifndef G__OLDIMPLEMENTATION2116 + int store_asm_instsize; +#endif G__value *store_asm_stack; char *store_asm_name; int store_asm_name_p; @@ -6863,7 +6868,10 @@ asm_ifunc_start: /* loop compilation execution label */ #ifndef G__OLDIMPLEMENTATION2067 if(G__cintv6 && G__BYTECODE_NOTYET==p_ifunc->pentry[ifn]->bytecodestatus) { - G__bc_compile_function(p_ifunc,ifn); + if(G__BYTECODE_FAILURE==G__bc_compile_function(p_ifunc,ifn)) { + G__exec_memberfunc=store_exec_memberfunc; + return(1); + } } #endif @@ -6938,6 +6946,11 @@ asm_ifunc_start: /* loop compilation execution label */ store_asm_dt = G__asm_dt ; store_asm_index = G__asm_index ; +#ifndef G__OLDIMPLEMENTATION2116 + store_asm_instsize = G__asm_instsize; + G__asm_instsize = 0; /* G__asm_inst is not resizable */ +#endif + G__asm_inst = asm_inst_g; G__asm_stack = asm_stack_g; G__asm_name = asm_name; @@ -8223,6 +8236,9 @@ asm_ifunc_start: /* loop compilation execution label */ #ifdef G__ASM_IFUNC /* Pop loop compilation environment */ G__asm_inst = store_asm_inst; +#ifndef G__OLDIMPLEMENTATION2116 + G__asm_instsize = store_asm_instsize; +#endif G__asm_stack = store_asm_stack; G__asm_name = store_asm_name; G__asm_name_p = store_asm_name_p; diff --git a/cint/src/v6_init.cxx b/cint/src/v6_init.cxx index 9148e2b3058..7c40e97c4cf 100644 --- a/cint/src/v6_init.cxx +++ b/cint/src/v6_init.cxx @@ -1725,6 +1725,9 @@ int G__init_globals() G__asm_dt=G__MAXSTACK-1; /* constant data address */ #ifdef G__ASM_IFUNC G__asm_inst = G__asm_inst_g; +#ifndef G__OLDIMPLEMENTATION2116 + G__asm_instsize = 0; /* 0 means G__asm_inst is not resizable */ +#endif G__asm_stack = G__asm_stack_g; G__asm_name = G__asm_name_g; G__asm_name_p = 0; @@ -2246,7 +2249,7 @@ void G__platformMacro() #ifdef __KCC /* KCC C++ compiler */ sprintf(temp,"G__KCC=%ld",(long)__KCC); G__add_macro(temp); #endif -#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 810 /* icc and ecc C++ compilers */ +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER<810) /* icc and ecc C++ compilers */ sprintf(temp,"G__INTEL_COMPILER=%ld",(long)__INTEL_COMPILER); G__add_macro(temp); #endif #ifndef _AIX diff --git a/cint/src/v6_newlink.cxx b/cint/src/v6_newlink.cxx index 67a753361a4..e975c9dfea7 100644 --- a/cint/src/v6_newlink.cxx +++ b/cint/src/v6_newlink.cxx @@ -2692,6 +2692,82 @@ char *path; } +#ifndef G__OLDIMPLEMENTATION2119 +/************************************************************************** +* G__delete_ipath() +* +**************************************************************************/ +int G__delete_ipath(path) +char *path; +{ + struct G__includepath *ipath; + struct G__includepath *previpath; + char temp[G__ONELINE]; + char temp2[G__ONELINE]; + int i=0,flag=0; + char *p; + + /* strip double quotes if exist */ + if('"'==path[0]) { + strcpy(temp,path+1); + if('"'==temp[strlen(temp)-1]) temp[strlen(temp)-1]='\0'; + } + else { + strcpy(temp,path); + } + + /* to the end of list */ + ipath = &G__ipathentry; + previpath = (struct G__includepath*)NULL; + while(ipath->next) { + if(ipath->pathname&&strcmp(ipath->pathname,temp)==0) { + /* delete this entry */ + free((void*)ipath->pathname); + ipath->pathname=(char*)NULL; + if(previpath) { + previpath->next = ipath->next; + free((void*)ipath); + } + else if(ipath->next) { +#if 1 + G__ipathentry.pathname = calloc(1,1); +#else + G__ipathentry.pathname = ipath->next->pathname; + G__ipathentry.next = ipath->next->next; + free((void*)ipath->next); +#endif + } + else { + free((void*)G__ipathentry.pathname); + G__ipathentry.pathname=(char*)NULL; + } + break; + } + ipath = ipath->next; + } + + /* G__allincludepath will be given to real preprocessor */ + if(!G__allincludepath) return(0); + i=0; + while(temp[i]) if(isspace(temp[i++])) flag=1; + if(flag) sprintf(temp2,"-I\"%s\" ",temp); + else sprintf(temp2,"-I%s ",temp); + + p = strstr(G__allincludepath,temp2); + if(p) { + char *p2 = p+strlen(temp2); + while(*p2) *p++ = *p2++; + *p = *p2; + return(1); + } + + return(0); +} + + +#endif + + /************************************************************************** ************************************************************************** * Generate C++ function access entry function diff --git a/cint/src/v6_opr.cxx b/cint/src/v6_opr.cxx index 3c70b4821b7..d0ce9231160 100644 --- a/cint/src/v6_opr.cxx +++ b/cint/src/v6_opr.cxx @@ -182,56 +182,56 @@ G__value *defined; long val; { if(isupper(defined->type)) { - *(long*)defined->ref = (long)val; + if(defined->ref) *(long*)defined->ref = (long)val; defined->obj.i = (long)val; return; } switch(defined->type) { case 'i': /* int */ - *(int*)defined->ref = (int)val; + if(defined->ref) *(int*)defined->ref = (int)val; defined->obj.i = (int)val; break; case 'c': /* char */ - *(char*)defined->ref = (char)val; + if(defined->ref) *(char*)defined->ref = (char)val; defined->obj.i = (char)val; break; case 'l': /* long */ - *(long*)defined->ref = (long)val; + if(defined->ref) *(long*)defined->ref = (long)val; defined->obj.i = (long)val; break; case 's': /* short */ - *(short*)defined->ref = (short)val; + if(defined->ref) *(short*)defined->ref = (short)val; defined->obj.i = (short)val; break; case 'k': /* unsigned long */ - *(unsigned long*)defined->ref = (unsigned long)val; + if(defined->ref) *(unsigned long*)defined->ref = (unsigned long)val; defined->obj.i = (unsigned long)val; break; case 'h': /* unsigned int */ - *(unsigned int*)defined->ref = (unsigned int)val; + if(defined->ref) *(unsigned int*)defined->ref = (unsigned int)val; defined->obj.i = (unsigned int)val; break; case 'r': /* unsigned short */ - *(unsigned short*)defined->ref = (unsigned short)val; + if(defined->ref) *(unsigned short*)defined->ref = (unsigned short)val; defined->obj.i = (unsigned short)val; break; case 'b': /* unsigned char */ - *(unsigned char*)defined->ref = (unsigned char)val; + if(defined->ref) *(unsigned char*)defined->ref = (unsigned char)val; defined->obj.i = (unsigned char)val; break; #ifndef G__OLDIMPLEMENTATION1604 case 'g': /* bool */ - *(unsigned char*)defined->ref = (unsigned char)(val?1:0); + if(defined->ref) *(unsigned char*)defined->ref = (unsigned char)(val?1:0); defined->obj.i = (int)val?1:0; break; #endif case 'd': /* double */ - *(double*)defined->ref = (double)val; + if(defined->ref) *(double*)defined->ref = (double)val; defined->obj.d = (double)val; break; case 'f': /* float */ - *(float*)defined->ref = (float)val; + if(defined->ref) *(float*)defined->ref = (float)val; defined->obj.d = (float)val; break; default: @@ -2477,7 +2477,7 @@ G__value *result3; G__value *result; char *realname; struct G__param *libp; -int flag; +int flag; /* flag whether to generate PUSHSTROS, SETSTROS */ { int known; long store_struct_offset; @@ -2502,7 +2502,11 @@ int flag; G__tagnum = result->tagnum; #ifdef G__ASM - if(G__asm_noverflow) { + if(G__asm_noverflow +#ifndef G__OLDIMPLEMENTATION2120 + && !flag +#endif + ) { #ifdef G__ASM_DBG if(G__asm_dbg) { G__fprinterr(G__serr,"%3x: PUSHSTROS\n",G__asm_cp); diff --git a/cint/src/v6_parse.cxx b/cint/src/v6_parse.cxx index 5c86a374fe2..e9e92f8028b 100644 --- a/cint/src/v6_parse.cxx +++ b/cint/src/v6_parse.cxx @@ -421,6 +421,27 @@ char* statement; return(0); } +/*********************************************************************** +* G__alloc_exceptionbuffer +* +***********************************************************************/ +G__value G__alloc_exceptionbuffer(tagnum) +int tagnum; +{ + G__value buf; + /* create class object */ + buf.obj.i = (long)malloc((size_t)G__struct.size[tagnum]); +#ifndef G__OLDIMPLEMENTATION1978 + buf.obj.reftype.reftype = G__PARANORMAL; +#endif + buf.type = 'u'; + buf.tagnum = tagnum; + buf.typenum = -1; + buf.ref = G__p_tempbuf->obj.obj.i; + + return(buf); +} + /*********************************************************************** * G__free_exceptionbuffer * @@ -441,7 +462,8 @@ int G__free_exceptionbuffer() else G__globalvarpointer = G__PVOID; sprintf(destruct,"~%s()",G__fulltagname(G__tagnum,1)); if(G__dispsource) { - G__fprinterr(G__serr,"!!!Destructing exception buffer %s",destruct); + G__fprinterr(G__serr,"!!!Destructing exception buffer %s %lx" + ,destruct,G__exceptionbuffer.obj.i); G__printlinenum(); } G__getfunction(destruct,&dmy ,G__TRYDESTRUCTOR); @@ -450,6 +472,9 @@ int G__free_exceptionbuffer() free((void*)G__store_struct_offset); #else free((void*)G__store_struct_offset); +#endif +#ifndef G__OLDIMPLEMENTATION2111 + /* do nothing here, exception object shouldn't be stored in legacy temp buf */ #endif G__tagnum = store_tagnum; G__store_struct_offset = store_struct_offset; diff --git a/cint/src/v6_pcode.cxx b/cint/src/v6_pcode.cxx index edb7c312549..ec2fc665e6c 100644 --- a/cint/src/v6_pcode.cxx +++ b/cint/src/v6_pcode.cxx @@ -763,6 +763,23 @@ long localmem; * 0 CL * clear stack pointer ***************************************/ +#ifndef G__OLDIMPLEMENTATION2132 +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: CL %s:%d\n",pc,sp + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#endif + if(G__breaksignal) { + struct G__input_file store_ifile = G__ifile; + G__ifile.line_number=G__asm_inst[pc+1]&G__CL_LINEMASK; + G__ifile.filenum=G__asm_inst[pc+1]/G__CL_FILESHIFT; + if(G__ifile.filenum>=0) + strcpy(G__ifile.name,G__srcfile[G__ifile.filenum].filename); + G__pr(G__serr,G__ifile); + G__pause(); + G__ifile=store_ifile; + } +#else /* 2132 */ #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: CL %d\n",pc,sp,G__asm_inst[pc+1]); #endif @@ -772,6 +789,7 @@ long localmem; G__pause(); G__ifile.line_number=sp; } +#endif /* 2132 */ #ifndef G__OLDIMPLEMENTATION2062 G__delete_autoobjectstack(G__scopelevel); #endif /* 2062 */ @@ -2234,7 +2252,7 @@ long localmem; case G__RTN_FUNC: /*************************************** * 0 RTN_FUNC - * 1 isreturnvalue + * 1 isreturnvalue 0:no return val, 1:with return val, 2: * stack * sp-1 -> return this * sp @@ -2242,6 +2260,10 @@ long localmem; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: RTN_FUNC %d\n" ,pc,sp ,G__asm_inst[pc+1]); +#endif +#ifndef G__OLDIMPLEMENTATION2110 + /* return from 'try { }' block */ + if(2==G__asm_inst[pc+1]) return(1); #endif G__asm_exec = 0; G__return=G__RETURN_NORMAL; @@ -2643,6 +2665,112 @@ long localmem; #endif #endif /* ON1073 */ + +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: TRY %lx %lx\n",pc,sp,G__asm_inst[pc+1],G__asm_inst[pc+2]); +#endif + { + switch(G__bc_exec_try_bytecode(pc+3,sp,presult,localmem)) { + case G__TRY_NORMAL: + pc=G__asm_inst[pc+2]; + break; + case G__TRY_INTERPRETED_EXCEPTION: + case G__TRY_COMPILED_EXCEPTION: + G__delete_autoobjectstack(G__scopelevel); + G__asm_stack[sp++]=G__exceptionbuffer; + pc=G__asm_inst[pc+1]; + break; + case G__TRY_UNCAUGHT: + default: + /* pc+=3; */ + break; + } + } +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: TYPEMATCH %ld\n",pc,sp,G__asm_inst[pc+1]); +#endif + G__letint(&G__asm_stack[sp],'i', + (long)G__bc_exec_typematch_bytecode(&G__asm_stack[G__asm_inst[pc+1]], + &G__asm_stack[sp-1])); + pc+=2; + ++sp; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: ALLOCEXCEPTION %ld\n" + ,pc,sp,G__asm_inst[pc+1]); +#endif + G__asm_stack[sp] = G__alloc_exceptionbuffer(G__asm_inst[pc+1]); + store_struct_offset = G__store_struct_offset; + store_tagnum = G__tagnum; + store_return=G__return; + G__store_struct_offset = G__asm_stack[sp].obj.i; + G__tagnum = G__asm_stack[sp].tagnum; + G__return=G__RETURN_NON; /* ??? */ + pc+=2; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3x,%d: DESTROYEXCEPTION\n",pc,sp); +#endif + G__free_exceptionbuffer(); + ++pc; +#ifdef G__ASM_DBG + break; +#else + goto pcode_parse_start; +#endif +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** @@ -2652,11 +2780,23 @@ long localmem; * sp-1 <- * sp ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3x,%d: THROW\n",pc,sp); +#endif +#ifndef G__OLDIMPLEMENTATION2109 + // TODO, it is questionable to set G__exceptionbuffer here. + // Maybe better setting this in catch block in G__bc_try_bytecode() + G__exceptionbuffer = G__asm_stack[sp-1]; + + G__bc_exec_throw_bytecode(&G__asm_stack[sp-1]); +#else G__exceptionbuffer = G__asm_stack[sp-1]; + /* TODO, Use true throw here, instead of following return operation */ if('U'==G__exceptionbuffer.type) G__exceptionbuffer.type='u'; G__return = G__RETURN_TRY; --sp; pc+=1; +#endif #ifndef G__OLDIMPLEMENTATION1281 return(1); #else @@ -2669,7 +2809,7 @@ long localmem; case G__CATCH: /*************************************** - * inst + * inst This instruction is not needed. Never used * 0 CATCH * 1 filenum * 2 linenum @@ -5532,6 +5672,18 @@ G__value *bufm2; #endif +#ifndef G__OLDIMPLEMENTATION2129 +/************************************************************************* +* G__OP2_addvoidptr() +*************************************************************************/ +void G__OP2_addvoidptr(bufm1,bufm2) +G__value *bufm1; +G__value *bufm2; +{ + bufm2->obj.i += bufm1->obj.i; +} +#endif + /**************************************************************** * G__OP2_OPTIMIZED ****************************************************************/ @@ -6689,6 +6841,21 @@ int cp_inc,dt_dec; G__asm_dt-=dt_dec; #endif +#ifndef G__OLDIMPLEMENTATION2116 + if(G__asm_instsize && G__asm_cp>G__asm_instsize-8) { + G__asm_instsize += 0x100; + void *p = realloc((void*)G__asm_stack,sizeof(long)*G__asm_instsize); + if(!p) G__genericerror("Error: memory exhausted for bytecode instruction buffer\n"); + G__asm_inst = (long*)p; + } + else if(!G__asm_instsize && G__asm_cp>G__MAXINST-8) { + if(G__asm_dbg) { + G__fprinterr(G__serr,"Warning: loop compile instruction overflow"); + G__printlinenum(); + } + G__abortbytecode(); + } +#else /* 2116 */ if(G__asm_cp>G__MAXINST-8) { #ifndef G__OLDIMPLEMENTATION841 if(G__asm_dbg) { @@ -6698,6 +6865,7 @@ int cp_inc,dt_dec; #endif G__abortbytecode(); } +#endif /* 2116 */ if(G__asm_dt<30) { #ifndef G__OLDIMPLEMENTATION841 @@ -6754,7 +6922,12 @@ int G__asm_clear() if(G__asm_cp<2 || G__CL!=G__asm_inst[G__asm_cp-2]) { G__asm_inst[G__asm_cp]=G__CL; +#ifndef G__OLDIMPLEMENTATION2132 + G__asm_inst[G__asm_cp+1]= (G__ifile.line_number&G__CL_LINEMASK) + + (G__ifile.filenum&G__CL_FILEMASK)*G__CL_FILESHIFT; +#else G__asm_inst[G__asm_cp+1]=G__ifile.line_number; +#endif G__inc_cp_asm(2,0); } return(0); @@ -7067,11 +7240,11 @@ int *start; * 2 paran NOP * 3 point_level <- check 3 NOP * 4 *var (2) NOP - * 5 LD <- check 1 NOP + * 5 LD <- check 1 NOP bydy of *b * 6 data_stack <- check 2 (int) CMPJMP * 7 CMP2 <- check 1 *compare() - * 8 <,<=,>,>=,==,!= case *a - * 9 CNDJMP <- check 1 *b + * 8 <,<=,>,>=,==,!= case *a var->p[] + * 9 CNDJMP <- check 1 *b ptr to inst[5] * 10 next_pc=G__asm_cp next_pc=G__asm_cp * . . * -2 JMP JMP @@ -7114,8 +7287,12 @@ int *start; ) G__asm_inst[*start+8] += G__store_struct_offset; - /* long to int conversion */ - pb = (int*)(&(G__asm_stack[G__asm_inst[*start+6]].obj.i)); + /* long to int conversion */ /* TODO, Storing ptr to temporary stack buffer, is this Bad? */ +#ifndef G__OLDIMPLEMENTATION2113 + pb = (int*)(&G__asm_inst[*start+5]); +#else + pb = (int*)(&(G__asm_stack[G__asm_inst[*start+6]].obj.i)); /* TODO, ??? */ +#endif *pb = G__int(G__asm_stack[G__asm_inst[*start+6]]); G__asm_inst[*start+9]=(long)(pb); G__asm_inst[*start+6]=G__CMPJMP; @@ -7145,8 +7322,8 @@ int *start; * 8 point_level <- check 3 NOP * 9 *var (2) CMPJMP * 10 CMP2 <- check 1 *compare() - * 11 <,<=,>,>=,==,!= case *a - * 12 CNDJMP <- check 1 *b + * 11 <,<=,>,>=,==,!= case *a var->[] + * 12 CNDJMP <- check 1 *b var->[] * 13 next_pc=G__asm_cp next_pc=G__asm_pc * . * -2 JMP JMP @@ -7224,7 +7401,7 @@ int *start; * before ----------> after * * -9 G__LD_VAR,LD_MSTR INCJMP - * -8 index *a + * -8 index *a var->p[] * -7 paran 1,,-1 * -6 point_level next_pc * -5 *var NOP @@ -7303,7 +7480,7 @@ int *start; * before ----------> after * * -11 G__LD_VAR,LD_MSTR INCJMP - * -10 index *a + * -10 index *a var->p[] * -9 paran 1,,-1 * -8 point_level next_pc * -7 *var NOP @@ -7382,7 +7559,7 @@ int *start; * before ----------> after * * -16 G__LD_VAR,MSTR<- check 1 INCJMP - * -15 index <- check 2 *a + * -15 index <- check 2 *a var->p[] * -14 paran <- check 3 inc * -13 point_level <- check 3 next_pc * -12 *var <- (2) NOP @@ -8927,6 +9104,11 @@ int pc; case G__OPR_DIVASSIGN_FD: G__asm_inst[pc+1] = (long)G__OP2_divassign_fd; break; +#ifndef G__OLDIMPLEMENTATION2129 + case G__OPR_ADDVOIDPTR: + G__asm_inst[pc+1] = (long)G__OP2_addvoidptr; + break; +#endif default: done=0; break; @@ -9167,7 +9349,13 @@ int *start; * clear stack pointer ***************************************/ #ifdef G__ASM_DBG +#ifndef G__OLDIMPLEMENTATION2132 + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CL %s:%d\n",pc + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#else if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CL %d\n",pc,G__asm_inst[pc+1]); +#endif #endif /* no optimize */ pc+=2; @@ -10456,6 +10644,68 @@ int *start; ++pc; break; +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: TRY %lx %lx\n",pc + ,G__asm_inst[pc+1] ,G__asm_inst[pc+2]); +#endif + /* no optimization */ + pc+=3; + break; + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: TYPEMATCH\n",pc); +#endif + /* no optimization */ + pc+=2; + break; + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) + G__fprinterr(G__serr,"%3lx: ALLOCEXCEPTION %d\n",pc,G__asm_inst[pc+1]); +#endif + /* no optimization */ + pc+=2; + break; + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ +#ifdef G__ASM_DBG + if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: DESTROYEXCEPTION\n",pc); +#endif + /* no optimization */ + ++pc; + break; +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** @@ -10465,11 +10715,11 @@ int *start; * sp-1 <- * sp ***************************************/ - pc+=1; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: THROW\n",pc); #endif /* no optimization */ + pc+=1; break; case G__CATCH: @@ -10481,11 +10731,11 @@ int *start; * 3 pos * 4 " ***************************************/ - pc+=5; #ifdef G__ASM_DBG if(G__asm_dbg) G__fprinterr(G__serr,"%3lx: CATCH\n",pc); #endif /* no optimization */ + pc+=5; break; #endif @@ -10810,7 +11060,13 @@ int isthrow; * clear stack pointer ***************************************/ if(0==isthrow) { +#ifndef G__OLDIMPLEMENTATION2132 + fprintf(fout,"%3x: CL %s:%d\n",pc + ,G__srcfile[G__asm_inst[pc+1]/G__CL_FILESHIFT].filename + ,G__asm_inst[pc+1]&G__CL_LINEMASK); +#else fprintf(fout,"%3x: CL %ld\n",pc,G__asm_inst[pc+1]); +#endif } pc+=2; break; @@ -11700,6 +11956,63 @@ int isthrow; break; #endif +#ifndef G__OLDIMPLEMENTATION2109 + case G__TRY: + /*************************************** + * inst + * 0 TRY + * 1 first_catchblock + * 2 endof_catchblock + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: TRY %lx %lx\n",pc + ,G__asm_inst[pc+1] ,G__asm_inst[pc+2]); + } + pc+=3; + break; + + case G__TYPEMATCH: + /*************************************** + * inst + * 0 TYPEMATCH + * 1 address in data stack + * stack + * sp-1 a <- comparee + * sp <- ismatch + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: TYPEMATCH\n",pc); + } + pc+=2; + break; + + case G__ALLOCEXCEPTION: + /*************************************** + * inst + * 0 ALLOCEXCEPTION + * 1 tagnum + * stack + * sp a + * sp+1 <- + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: ALLOCEXCEPTION %ld\n",pc,G__asm_inst[pc+1]); + } + pc+=2; + break; + + case G__DESTROYEXCEPTION: + /*************************************** + * inst + * 0 DESTROYEXCEPTION + ***************************************/ + if(0==isthrow) { + fprintf(fout,"%3x: DESTROYEXCEPTION\n",pc); + } + ++pc; + break; +#endif /* 2109 */ + #ifndef G__OLDIMPLEMENTATION1270 case G__THROW: /*************************************** diff --git a/cint/src/v6_shl.cxx b/cint/src/v6_shl.cxx index 82e26cb67b8..e8acd510bfc 100644 --- a/cint/src/v6_shl.cxx +++ b/cint/src/v6_shl.cxx @@ -2044,7 +2044,15 @@ void* G__GetShlHandle() **************************************************************************/ int G__GetShlFilenum() { +#ifdef G__SHAREDLIB +#ifndef G__OLDIMPLEMENTATION2012 return(G__Shlfilenum); +#else + return(0); +#endif +#else + return(0); +#endif } #endif diff --git a/cint/src/v6_tmplt.cxx b/cint/src/v6_tmplt.cxx index 5bb507b5340..27ffdf3ee62 100644 --- a/cint/src/v6_tmplt.cxx +++ b/cint/src/v6_tmplt.cxx @@ -1503,7 +1503,9 @@ void G__declare_template() #ifndef G__OLDIMPLEMENTATION691 int isforwarddecl = 0; #endif +#ifndef G__OLDIMPLEMENTATION2106 int isfrienddecl = 0; +#endif #ifndef G__OLDIMPLEMENTATION1412 #ifndef G__OLDIMPLEMENTATION1601 @@ -1542,10 +1544,12 @@ void G__declare_template() do { c=G__fgetname_template(temp,"(<"); +#ifndef G__OLDIMPLEMENTATION2106 if (strcmp(temp,"friend")==0) { isfrienddecl = 1; c=G__fgetname_template(temp,"(<"); } +#endif } while(strcmp(temp,"inline")==0||strcmp(temp,"const")==0 #ifndef G__OLDIMPLEMENTATION1463 || strcmp(temp,"typename")==0 @@ -2326,7 +2330,11 @@ char *tagnamein; #endif #ifdef G__ASM +#ifndef G__OLDIMPLEMENTATION2124 + if(!G__cintv6) G__abortbytecode(); +#else G__abortbytecode(); +#endif #endif call_para.string=(char*)NULL; diff --git a/cint/src/v6_value.cxx b/cint/src/v6_value.cxx index e4581a257d4..fa4781708b9 100644 --- a/cint/src/v6_value.cxx +++ b/cint/src/v6_value.cxx @@ -711,6 +711,11 @@ G__value *p,result; } break; #endif /* 1663 */ +#ifndef G__OLDIMPLEMENTATION2128 + case 'c': + memcpy((void*)p->ref,(void*)result.obj.i,strlen((char*)result.obj.i)+1); + break; +#endif default: #ifdef G__ASM #ifdef G__ASM_DBG diff --git a/cint/src/v6_var.cxx b/cint/src/v6_var.cxx index a38b87ebd8d..13cdbfa1d9d 100644 --- a/cint/src/v6_var.cxx +++ b/cint/src/v6_var.cxx @@ -906,6 +906,20 @@ G__value *presult; #ifndef G__OLDIMPLEMENTATION1911 if(0 && item) return 0; #endif +#ifndef G__OLDIMPLEMENTATION2122 + if(G__cintv6) { + G__value ltype = G__null; + ltype.type = var->type[ig15]; + ltype.tagnum = var->p_tagtable[ig15]; + ltype.typenum = var->p_typetable[ig15]; + ltype.obj.reftype.reftype = var->reftype[ig15]; + if(!G__Isvalidassignment_val(<ype,presult)) { + G__fprinterr(G__serr,"Error: assignment type mismatch %s " + ,var->varnamebuf[ig15]); + G__genericerror((char*)NULL); + } + } +#endif #ifndef G__OLDIMPLEMENTATION2089 if(G__cintv6 && ('U'==var->type[ig15] || ('u'==var->type[ig15]&& diff --git a/cint/src/value.c b/cint/src/value.c index e4581a257d4..fa4781708b9 100644 --- a/cint/src/value.c +++ b/cint/src/value.c @@ -711,6 +711,11 @@ G__value *p,result; } break; #endif /* 1663 */ +#ifndef G__OLDIMPLEMENTATION2128 + case 'c': + memcpy((void*)p->ref,(void*)result.obj.i,strlen((char*)result.obj.i)+1); + break; +#endif default: #ifdef G__ASM #ifdef G__ASM_DBG diff --git a/cint/src/var.c b/cint/src/var.c index a38b87ebd8d..13cdbfa1d9d 100644 --- a/cint/src/var.c +++ b/cint/src/var.c @@ -906,6 +906,20 @@ G__value *presult; #ifndef G__OLDIMPLEMENTATION1911 if(0 && item) return 0; #endif +#ifndef G__OLDIMPLEMENTATION2122 + if(G__cintv6) { + G__value ltype = G__null; + ltype.type = var->type[ig15]; + ltype.tagnum = var->p_tagtable[ig15]; + ltype.typenum = var->p_typetable[ig15]; + ltype.obj.reftype.reftype = var->reftype[ig15]; + if(!G__Isvalidassignment_val(<ype,presult)) { + G__fprinterr(G__serr,"Error: assignment type mismatch %s " + ,var->varnamebuf[ig15]); + G__genericerror((char*)NULL); + } + } +#endif #ifndef G__OLDIMPLEMENTATION2089 if(G__cintv6 && ('U'==var->type[ig15] || ('u'==var->type[ig15]&& -- GitLab