Changes in / [c3a2007:c921712]
- Files:
-
- 3 added
- 1 deleted
- 59 edited
-
Jenkinsfile (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
benchmark/Makefile.am (modified) (1 diff)
-
benchmark/Makefile.in (modified) (2 diffs)
-
configure (modified) (2 diffs)
-
configure.ac (modified) (1 diff)
-
doc/proposals/approx-equal.md (deleted)
-
driver/Makefile.in (modified) (1 diff)
-
driver/cc1.cc (modified) (2 diffs)
-
driver/cfa.cc (modified) (12 diffs)
-
libcfa/Makefile.in (modified) (1 diff)
-
libcfa/configure (modified) (4 diffs)
-
libcfa/configure.ac (modified) (3 diffs)
-
libcfa/prelude/Makefile.in (modified) (1 diff)
-
libcfa/prelude/extras.regx (modified) (1 diff)
-
libcfa/src/Makefile.am (modified) (2 diffs)
-
libcfa/src/Makefile.in (modified) (3 diffs)
-
libcfa/src/concurrency/kernel_private.hfa (modified) (1 diff)
-
libcfa/src/heap.cfa (modified) (6 diffs)
-
libcfa/src/stdlib.cfa (modified) (5 diffs)
-
libcfa/src/stdlib.hfa (modified) (6 diffs)
-
longrun_tests/Makefile.am (modified) (1 diff)
-
longrun_tests/Makefile.in (modified) (2 diffs)
-
src/CodeGen/CodeGenerator.cc (modified) (2 diffs)
-
src/CodeGen/GenType.cc (modified) (1 diff)
-
src/ControlStruct/MLEMutator.cc (modified) (2 diffs)
-
src/ControlStruct/MLEMutator.h (modified) (3 diffs)
-
src/GenPoly/Box.cc (modified) (1 diff)
-
src/GenPoly/Lvalue.cc (modified) (3 diffs)
-
src/Makefile.in (modified) (5 diffs)
-
src/ResolvExpr/ConversionCost.cc (modified) (1 diff)
-
src/ResolvExpr/ResolveAssertions.cc (modified) (1 diff)
-
src/SymTab/Autogen.h (modified) (1 diff)
-
src/SymTab/ManglerCommon.cc (modified) (1 diff)
-
src/SymTab/Validate.cc (modified) (7 diffs)
-
src/SynTree/AddressExpr.cc (modified) (1 diff)
-
src/SynTree/ApplicationExpr.cc (modified) (2 diffs)
-
src/SynTree/ArrayType.cc (modified) (1 diff)
-
src/SynTree/CommaExpr.cc (modified) (2 diffs)
-
src/SynTree/Expression.cc (modified) (16 diffs)
-
src/SynTree/Expression.h (modified) (1 diff)
-
src/SynTree/TopLvalue.cc (added)
-
src/SynTree/TopLvalue.h (added)
-
src/SynTree/TupleExpr.cc (modified) (3 diffs)
-
src/SynTree/Type.cc (modified) (1 diff)
-
src/SynTree/Type.h (modified) (4 diffs)
-
src/SynTree/module.mk (modified) (1 diff)
-
src/Tuples/TupleExpansion.cc (modified) (1 diff)
-
src/main.cc (modified) (10 diffs)
-
tests/.expect/alloc-ERROR.txt (modified) (4 diffs)
-
tests/.expect/alloc.txt (modified) (4 diffs)
-
tests/.expect/attributes.x64.txt (modified) (1 diff)
-
tests/.expect/attributes.x86.txt (modified) (1 diff)
-
tests/Makefile.am (modified) (3 diffs)
-
tests/Makefile.in (modified) (4 diffs)
-
tests/alloc.cfa (modified) (10 diffs)
-
tests/concurrent/examples/quickSort.cfa (modified) (4 diffs)
-
tests/labelledExit.cfa (modified) (2 diffs)
-
tests/pybin/settings.py (modified) (1 diff)
-
tests/pybin/tools.py (modified) (1 diff)
-
tools/Makefile.in (modified) (1 diff)
-
tools/PrettyGitLogs.sh (added)
-
tools/prettyprinter/Makefile.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rc3a2007 rc921712 224 224 //Routine responsible of sending the email notification once the build is completed 225 225 //=========================================================================================================== 226 @NonCPS227 def SplitLines(String text) {228 def list = []229 230 text.eachLine {231 list += it232 }233 234 return list235 }236 237 226 def GitLogMessage() { 238 227 if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n" 239 228 240 def oldRef = Settings.GitOldRef 241 def newRef = Settings.GitNewRef 242 243 def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim() 244 def revList = SplitLines( revText ) 245 246 def gitUpdate = "" 247 revList.each { rev -> 248 def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim() 249 gitUpdate = gitUpdate + " via ${rev} (${type})" 250 } 251 252 def rev = oldRef 253 def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim() 254 gitUpdate = gitUpdate + " from ${rev} (${type})" 255 256 def gitLog = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim() 257 258 def gitDiff = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim() 259 gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">') 260 gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">') 261 gitDiff = gitDiff.replace('[m', '</span>') 229 sh "${SrcDir}/tools/PrettyGitLogs.sh ${SrcDir} ${BuildDir} ${Settings.GitOldRef} ${Settings.GitNewRef}" 230 231 def gitUpdate = readFile("${BuildDir}/GIT_UPDATE") 232 def gitLog = readFile("${BuildDir}/GIT_LOG") 233 def gitDiff = readFile("${BuildDir}/GIT_DIFF") 262 234 263 235 return """ -
Makefile.in
rc3a2007 rc921712 264 264 CCDEPMODE = @CCDEPMODE@ 265 265 CFACC = @CFACC@ 266 CFACC_INSTALL = @CFACC_INSTALL@267 266 CFACPP = @CFACPP@ 268 267 CFA_BACKEND_CC = @CFA_BACKEND_CC@ -
benchmark/Makefile.am
rc3a2007 rc921712 22 22 23 23 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror 24 AM_CFAFLAGS = -quiet -nodebug 24 AM_CFAFLAGS = -quiet -nodebug -in-tree 25 25 AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14 26 26 -
benchmark/Makefile.in
rc3a2007 rc921712 214 214 CCDEPMODE = @CCDEPMODE@ 215 215 CFACC = @CFACC@ 216 CFACC_INSTALL = @CFACC_INSTALL@217 216 CFACPP = @CFACPP@ 218 217 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 376 375 # applies to both programs 377 376 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror 378 AM_CFAFLAGS = -quiet -nodebug 377 AM_CFAFLAGS = -quiet -nodebug -in-tree 379 378 AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14 380 379 BENCH_V_CC = $(__bench_v_CC_$(__quiet)) -
configure
rc3a2007 rc921712 715 715 BUILD_IN_TREE_FLAGS 716 716 CFACPP 717 CFACC_INSTALL718 717 CFACC 719 718 DRIVER_DIR … … 3304 3303 DRIVER_DIR=${TOP_BUILDDIR}driver/ 3305 3304 CFACC=${DRIVER_DIR}cfa 3306 CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}3307 3305 CFACPP=${DRIVER_DIR}cfa-cpp 3308 3309 3306 3310 3307 -
configure.ac
rc3a2007 rc921712 93 93 DRIVER_DIR=${TOP_BUILDDIR}driver/ 94 94 CFACC=${DRIVER_DIR}cfa 95 CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}96 95 CFACPP=${DRIVER_DIR}cfa-cpp 97 96 AC_SUBST(DRIVER_DIR) 98 97 AC_SUBST(CFACC) 99 AC_SUBST(CFACC_INSTALL)100 98 AC_SUBST(CFACPP) 101 99 -
driver/Makefile.in
rc3a2007 rc921712 201 201 CCDEPMODE = @CCDEPMODE@ 202 202 CFACC = @CFACC@ 203 CFACC_INSTALL = @CFACC_INSTALL@204 203 CFACPP = @CFACPP@ 205 204 CFA_BACKEND_CC = @CFA_BACKEND_CC@ -
driver/cc1.cc
rc3a2007 rc921712 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 20 08:14:33 201913 // Update Count : 38 512 // Last Modified On : Mon Sep 9 17:50:53 2019 13 // Update Count : 384 14 14 // 15 15 … … 503 503 execvp( args[0], (char * const *)args ); // should not return 504 504 perror( "CC1 Translator error: stage 2 cc1, execvp" ); 505 cerr << " invoked " << args[0] << endl;505 cerr << " invoked " << cargs[0] << endl; 506 506 exit( EXIT_FAILURE ); // tell gcc not to go any further 507 507 } // if -
driver/cfa.cc
rc3a2007 rc921712 15 15 16 16 #include <iostream> 17 #include <cstdio> // perror 18 #include <cstdlib> // putenv, exit 19 #include <climits> // PATH_MAX 20 #include <unistd.h> // execvp 21 #include <string> // STL version 22 #include <string.h> // strcmp 23 #include <algorithm> // find 17 #include <cstdio> // perror 18 #include <cstdlib> // putenv, exit 19 #include <unistd.h> // execvp 20 #include <string> // STL version 21 #include <string.h> // strcmp 22 #include <algorithm> // find 24 23 25 24 #include <sys/types.h> … … 36 35 // #define __DEBUG_H__ 37 36 38 // "N__=" suffix 39 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" ); 37 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" ); // "N__=" suffix 40 38 41 39 void Putenv( char * argv[], string arg ) { … … 59 57 } 60 58 61 // check if string has suffix 62 bool suffix( const string & arg ) { 59 bool suffix( const string & arg ) { // check if string has suffix 63 60 enum { NumSuffixes = 3 }; 64 61 static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" }; … … 79 76 static inline string dir(const string & path) { 80 77 return path.substr(0, path.find_last_of('/')); 81 }82 83 // Different path modes84 enum PathMode {85 Installed, // cfa is installed, use prefix86 BuildTree, // cfa is in the tree, use source and build tree87 Distributed // cfa is distributed, use build tree for includes and executable directory for .cfs88 };89 90 // Get path mode from /proc91 PathMode FromProc() {92 std::string abspath;93 abspath.resize(PATH_MAX);94 95 // get executable path from /proc/self/exe96 ssize_t size = readlink("/proc/self/exe", const_cast<char*>(abspath.c_str()), abspath.size());97 if(size <= 0) {98 std::cerr << "Error could not evaluate absolute path from /proc/self/exe" << std::endl;99 std::cerr << "Failed with " << std::strerror(errno) << std::endl;100 std::exit(1);101 }102 103 // Trim extra characters104 abspath.resize(size);105 106 // Are we installed107 if(abspath.rfind(CFA_BINDIR , 0) == 0) { return Installed; }108 109 // Is this the build tree110 if(abspath.rfind(TOP_BUILDDIR, 0) == 0) { return BuildTree; }111 112 // Does this look like distcc113 if(abspath.find("/.cfadistcc/") != std::string::npos) { return Distributed; }114 115 // None of the above? Give up since we don't know where the prelude or include directories are116 std::cerr << "Cannot find required files from excutable path " << abspath << std::endl;117 std::exit(1);118 78 } 119 79 … … 153 113 bool m32 = false; // -m32 flag 154 114 bool m64 = false; // -m64 flag 115 bool intree = false; // build in tree 155 116 bool compiling_libs = false; 117 bool disttree = false; 156 118 int o_file = 0; // -o filename position 157 158 PathMode path = FromProc();159 119 160 120 const char *args[argc + 100]; // cfa command line values, plus some space for additional flags … … 211 171 } else if ( arg == "-no-include-stdhdr" ) { 212 172 noincstd_flag = true; // strip the no-include-stdhdr flag 173 } else if ( arg == "-in-tree" ) { 174 intree = true; 175 } else if ( arg == "-dist-tree" ) { 176 disttree = true; 213 177 } else if ( arg == "-cfalib") { 214 178 compiling_libs = true; … … 319 283 320 284 // add the CFA include-library paths, which allow direct access to header files without directory qualification 321 string libbase; 322 switch(path) { 323 case Installed: 285 if ( ! intree ) { 324 286 args[nargs++] = "-I" CFA_INCDIR; 325 // do not use during build 326 if ( ! noincstd_flag ) { 287 if ( ! noincstd_flag ) { // do not use during build 327 288 args[nargs++] = "-I" CFA_INCDIR "stdhdr"; 328 289 } // if 329 290 args[nargs++] = "-I" CFA_INCDIR "concurrency"; 330 291 args[nargs++] = "-I" CFA_INCDIR "containers"; 331 libbase = CFA_LIBDIR; 332 break; 333 case BuildTree: 334 case Distributed: 292 } else { 335 293 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src"; 336 // do not use during build 337 if ( ! noincstd_flag ) { 294 if ( ! noincstd_flag ) { // do not use during build 338 295 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr"; 339 296 } // if 340 297 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency"; 341 298 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/containers"; 342 343 libbase = TOP_BUILDDIR "libcfa/";344 345 break;346 299 } // if 347 300 … … 349 302 args[nargs++] = "-imacros"; 350 303 args[nargs++] = "stdbool.h"; 304 305 string libbase; 306 if ( ! intree ) { 307 libbase = CFA_LIBDIR; 308 } else { 309 libbase = TOP_BUILDDIR "libcfa/"; 310 } // if 351 311 352 312 if( compiling_libs ) { … … 366 326 string libdir = libbase + arch + "-" + config; 367 327 368 if ( path != Distributed) {328 if (!disttree) { 369 329 if ( ! nolib && ! dirExists( libdir ) ) { 370 330 cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl; … … 384 344 } // if 385 345 386 switch(path) { 387 case Installed : Putenv( argv, "--prelude-dir=" + libdir ); break; 388 case BuildTree : Putenv( argv, "--prelude-dir=" + libdir + "/prelude" ); break; 389 case Distributed : Putenv( argv, "--prelude-dir=" + dir(argv[0]) ); break; 346 if(disttree) { 347 Putenv( argv, "--prelude-dir=" + dir(argv[0]) ); 348 } else if(intree) { 349 Putenv( argv, "--prelude-dir=" + libdir + "/prelude" ); 350 } else { 351 Putenv( argv, "--prelude-dir=" + libdir ); 390 352 } 391 353 … … 403 365 404 366 // include the cfa library in case it is needed 405 args[nargs++] = ( *new string( string("-L" ) + libdir + ( path != Installed? "/src/.libs" : "")) ).c_str();406 args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + ( path != Installed? "/src/.libs" : "")) ).c_str();367 args[nargs++] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str(); 368 args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str(); 407 369 args[nargs++] = "-Wl,--push-state,--as-needed"; 408 370 args[nargs++] = "-lcfathread"; … … 448 410 449 411 if ( bprefix.length() == 0 ) { 450 switch(path) { 451 case Installed : bprefix = installlibdir; break; 452 case BuildTree : bprefix = srcdriverdir ; break; 453 case Distributed : bprefix = dir(argv[0]) ; break; 412 if(disttree) { 413 bprefix = dir(argv[0]); 414 } else if(intree) { 415 bprefix = srcdriverdir; 416 } else { 417 bprefix = installlibdir; 454 418 } 455 419 if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/'; -
libcfa/Makefile.in
rc3a2007 rc921712 296 296 PACKAGE_VERSION = @PACKAGE_VERSION@ 297 297 PATH_SEPARATOR = @PATH_SEPARATOR@ 298 PRELUDEFLAG = @PRELUDEFLAG@ 298 299 RANLIB = @RANLIB@ 299 300 SED = @SED@ -
libcfa/configure
rc3a2007 rc921712 707 707 CONFIG_CFLAGS 708 708 ARCH_FLAGS 709 PRELUDEFLAG 709 710 CFADIR_HASH 710 711 LOCAL_CC1 … … 2959 2960 if test x$enable_distcc = xno; then 2960 2961 CFACC=${DRIVER_DIR}cfa 2962 PRELUDEFLAG='-in-tree' 2961 2963 echo "no" 2962 2964 else … … 2966 2968 CFADIR_HASH=$($tools/distcc_hash $config) 2967 2969 CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa" 2970 PRELUDEFLAG='-dist-tree' 2968 2971 echo "yes (hash=${CFADIR_HASH})" 2969 2972 fi … … 2979 2982 ENABLE_DISTCC_FALSE= 2980 2983 fi 2984 2981 2985 2982 2986 -
libcfa/configure.ac
rc3a2007 rc921712 34 34 if test x$enable_distcc = xno; then 35 35 CFACC=${DRIVER_DIR}cfa 36 PRELUDEFLAG='-in-tree' 36 37 echo "no" 37 38 else … … 41 42 CFADIR_HASH=$($tools/distcc_hash $config) 42 43 CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa" 44 PRELUDEFLAG='-dist-tree' 43 45 echo "yes (hash=${CFADIR_HASH})" 44 46 fi … … 55 57 AC_SUBST(CFADIR_HASH) 56 58 AC_SUBST(CFA_VERSION) 59 AC_SUBST(PRELUDEFLAG) 57 60 58 61 #============================================================================== -
libcfa/prelude/Makefile.in
rc3a2007 rc921712 239 239 PACKAGE_VERSION = @PACKAGE_VERSION@ 240 240 PATH_SEPARATOR = @PATH_SEPARATOR@ 241 PRELUDEFLAG = @PRELUDEFLAG@ 241 242 RANLIB = @RANLIB@ 242 243 SED = @SED@ -
libcfa/prelude/extras.regx
rc3a2007 rc921712 19 19 typedef.* uint32_t; 20 20 typedef.* uint64_t; 21 typedef.* __uint_least16_t;22 typedef.* __uint_least32_t;23 21 typedef.* char16_t; 24 22 typedef.* char32_t; -
libcfa/src/Makefile.am
rc3a2007 rc921712 32 32 # use -no-include-stdhdr to prevent rebuild cycles 33 33 # The built sources must not depend on the installed headers 34 AM_CFAFLAGS = -quiet -cfalib -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@34 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@ 35 35 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 36 36 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@ … … 96 96 97 97 prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@ 98 ${AM_V_GEN}$(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}98 ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@} 99 99 100 100 prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@ 101 101 ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ 102 $(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}102 $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@} 103 103 104 104 #---------------------------------------------------------------------------------------------------------------- -
libcfa/src/Makefile.in
rc3a2007 rc921712 349 349 PACKAGE_VERSION = @PACKAGE_VERSION@ 350 350 PATH_SEPARATOR = @PATH_SEPARATOR@ 351 PRELUDEFLAG = @PRELUDEFLAG@ 351 352 RANLIB = @RANLIB@ 352 353 SED = @SED@ … … 444 445 # use -no-include-stdhdr to prevent rebuild cycles 445 446 # The built sources must not depend on the installed headers 446 AM_CFAFLAGS = -quiet -cfalib -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@447 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@ 447 448 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 448 449 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@ … … 953 954 954 955 prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@ 955 ${AM_V_GEN}$(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}956 ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@} 956 957 957 958 prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@ 958 959 ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ 959 $(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}960 $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@} 960 961 961 962 #---------------------------------------------------------------------------------------------------------------- -
libcfa/src/concurrency/kernel_private.hfa
rc3a2007 rc921712 34 34 static inline void WakeThread( thread_desc * thrd ) { 35 35 if( !thrd ) return; 36 37 verify(thrd->state == Inactive);38 36 39 37 disable_interrupts(); -
libcfa/src/heap.cfa
rc3a2007 rc921712 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Oct 18 07:42:09201913 // Update Count : 55 612 // Last Modified On : Wed Jul 24 13:12:45 2019 13 // Update Count : 550 14 14 // 15 15 … … 541 541 // along with the block and is a multiple of the alignment size. 542 542 543 if ( unlikely( size > ~0ul - sizeof(HeapManager.Storage) ) ) return 0;544 543 size_t tsize = size + sizeof(HeapManager.Storage); 545 544 if ( likely( tsize < mmapStart ) ) { // small size => sbrk … … 593 592 block->header.kind.real.home = freeElem; // pointer back to free list of apropriate size 594 593 } else { // large size => mmap 595 if ( unlikely( size > ~0ul - pageSize ) ) return 0;596 594 tsize = libCeiling( tsize, pageSize ); // must be multiple of page size 597 595 #ifdef __STATISTICS__ … … 890 888 } // realloc 891 889 890 892 891 // The obsolete function memalign() allocates size bytes and returns a pointer to the allocated memory. The memory 893 892 // address will be a multiple of alignment, which must be a power of two. … … 993 992 size_t malloc_alignment( void * addr ) { 994 993 if ( unlikely( addr == 0 ) ) return libAlign(); // minimum alignment 995 HeapManager.Storage.Header * header = headerAddr( addr);994 HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) ); 996 995 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? 997 996 return header->kind.fake.alignment & -2; // remove flag from value … … 1005 1004 bool malloc_zero_fill( void * addr ) { 1006 1005 if ( unlikely( addr == 0 ) ) return false; // null allocation is not zero fill 1007 HeapManager.Storage.Header * header = headerAddr( addr ); 1006 1007 HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) ); 1008 1008 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? 1009 1009 header = (HeapManager.Storage.Header *)((char *)header - header->kind.fake.offset); -
libcfa/src/stdlib.cfa
rc3a2007 rc921712 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 22 08:57:52201913 // Update Count : 4 7812 // Last Modified On : Mon Jun 24 17:34:44 2019 13 // Update Count : 462 14 14 // 15 15 … … 21 21 #include <string.h> // memcpy, memset 22 22 #include <malloc.h> // malloc_usable_size 23 //#include <math.h> // fabsf, fabs, fabsl23 #include <math.h> // fabsf, fabs, fabsl 24 24 #include <complex.h> // _Complex_I 25 25 #include <assert.h> … … 27 27 //--------------------------------------- 28 28 29 forall( dtype T | sized(T) ) { 30 T * alloc_set( T ptr[], size_t dim, char fill ) { // realloc array with fill 31 size_t olen = malloc_usable_size( ptr ); // current allocation 32 char * nptr = (char *)realloc( (void *)ptr, dim * sizeof(T) ); // C realloc 33 size_t nlen = malloc_usable_size( nptr ); // new allocation 34 if ( nlen > olen ) { // larger ? 35 memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage 36 } // if 37 return (T *)nptr; 38 } // alloc_set 39 40 T * alloc_align( T ptr[], size_t align ) { // aligned realloc array 41 char * nptr; 42 size_t alignment = malloc_alignment( ptr ); 43 if ( align != alignment && (uintptr_t)ptr % align != 0 ) { 44 size_t olen = malloc_usable_size( ptr ); // current allocation 45 nptr = (char *)memalign( align, olen ); 46 size_t nlen = malloc_usable_size( nptr ); // new allocation 47 size_t lnth = olen < nlen ? olen : nlen; // min 48 memcpy( nptr, ptr, lnth ); // initialize storage 49 free( ptr ); 50 } else { 51 nptr = (char *)ptr; 52 } // if 53 return (T *)nptr; 54 } // alloc_align 55 56 T * alloc_align( T ptr[], size_t align, size_t dim ) { // aligned realloc array 57 char * nptr; 58 size_t alignment = malloc_alignment( ptr ); 59 if ( align != alignment ) { 60 size_t olen = malloc_usable_size( ptr ); // current allocation 61 nptr = (char *)memalign( align, dim * sizeof(T) ); 62 size_t nlen = malloc_usable_size( nptr ); // new allocation 63 size_t lnth = olen < nlen ? olen : nlen; // min 64 memcpy( nptr, ptr, lnth ); // initialize storage 65 free( ptr ); 66 } else { 67 nptr = (char *)realloc( (void *)ptr, dim * sizeof(T) ); // C realloc 68 } // if 69 return (T *)nptr; 70 } // alloc_align 71 72 T * alloc_align_set( T ptr[], size_t align, char fill ) { // aligned realloc with fill 73 size_t olen = malloc_usable_size( ptr ); // current allocation 74 char * nptr = alloc_align( ptr, align ); 75 size_t nlen = malloc_usable_size( nptr ); // new allocation 76 if ( nlen > olen ) { // larger ? 77 memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage 78 } // if 79 return (T *)nptr; 80 } // alloc_align_set 81 } // distribution 29 // resize, non-array types 30 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ) { 31 size_t olen = malloc_usable_size( ptr ); // current allocation 32 char * nptr = (void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc 33 size_t nlen = malloc_usable_size( nptr ); // new allocation 34 if ( nlen > olen ) { // larger ? 35 memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage 36 } // 37 return (T *)nptr; 38 } // alloc 82 39 83 40 // allocation/deallocation and constructor/destructor, non-array types 84 41 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) 85 42 T * new( Params p ) { 86 return &(*malloc()){ p }; // run constructor43 return &(*malloc()){ p }; // run constructor 87 44 } // new 88 45 … … 90 47 void delete( T * ptr ) { 91 48 if ( ptr ) { // ignore null 92 ^(*ptr){}; // run destructor49 ^(*ptr){}; // run destructor 93 50 free( ptr ); 94 51 } // if … … 98 55 void delete( T * ptr, Params rest ) { 99 56 if ( ptr ) { // ignore null 100 ^(*ptr){}; // run destructor57 ^(*ptr){}; // run destructor 101 58 free( ptr ); 102 59 } // if -
libcfa/src/stdlib.hfa
rc3a2007 rc921712 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 20 22:57:33201913 // Update Count : 3 9012 // Last Modified On : Tue Jul 23 14:14:59 2019 13 // Update Count : 373 14 14 // 15 15 … … 25 25 void * memset( void * dest, int fill, size_t size ); // string.h 26 26 void * memcpy( void * dest, const void * src, size_t size ); // string.h 27 void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA heap27 void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA 28 28 } // extern "C" 29 29 … … 52 52 T * realloc( T * ptr, size_t size ) { 53 53 if ( unlikely( ptr == 0 ) ) return malloc(); 54 return (T *)(void *)realloc( (void *)ptr, size ); // C realloc54 return (T *)(void *)realloc( (void *)ptr, size ); 55 55 } // realloc 56 56 57 57 T * memalign( size_t align ) { 58 return (T *)memalign( align, sizeof(T) ); // C memalign58 return (T *)memalign( align, sizeof(T) ); 59 59 } // memalign 60 60 61 61 T * aligned_alloc( size_t align ) { 62 return (T *)aligned_alloc( align, sizeof(T) ); // C aligned_alloc62 return (T *)aligned_alloc( align, sizeof(T) ); 63 63 } // aligned_alloc 64 64 … … 67 67 } // posix_memalign 68 68 69 69 70 // Cforall dynamic allocation 70 71 … … 73 74 } // alloc 74 75 76 T * alloc( char fill ) { 77 T * ptr; 78 if ( _Alignof(T) <= libAlign() ) ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 79 else ptr = (T *)memalign( _Alignof(T), sizeof(T) ); 80 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialize with fill value 81 } // alloc 82 75 83 T * alloc( size_t dim ) { 76 if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); 84 if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 77 85 else return (T *)memalign( _Alignof(T), dim * sizeof(T) ); 78 86 } // alloc 79 87 80 T * alloc( T ptr[], size_t dim ) { // realloc 88 T * alloc( size_t dim, char fill ) { 89 return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value 90 } // alloc 91 92 T * alloc( T ptr[], size_t dim ) { 81 93 return realloc( ptr, dim * sizeof(T) ); 82 94 } // alloc 83 84 T * alloc_set( char fill ) { 85 return (T *)memset( (T *)alloc(), (int)fill, sizeof(T) ); // initialize with fill value 86 } // alloc 87 88 T * alloc_set( T fill ) { 89 return (T *)memcpy( (T *)alloc(), &fill, sizeof(T) ); // initialize with fill value 90 } // alloc 91 92 T * alloc_set( size_t dim, char fill ) { 93 return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value 94 } // alloc 95 96 T * alloc_set( size_t dim, T fill ) { 97 T * r = (T *)alloc( dim ); 98 for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value 99 return r; 100 } // alloc 101 102 T * alloc_set( size_t dim, const T fill[] ) { 103 return (T *)memcpy( (T *)alloc( dim ), fill, dim * sizeof(T) ); // initialize with fill value 104 } // alloc 105 } // distribution 106 107 forall( dtype T | sized(T) ) { 108 T * alloc_set( T ptr[], size_t dim, char fill ); // realloc array with fill 109 } // distribution 110 111 static inline forall( dtype T | sized(T) ) { 112 T * alloc_align( size_t align ) { 95 } // distribution 96 97 98 static inline forall( dtype T | sized(T) ) { 99 T * align_alloc( size_t align ) { 113 100 return (T *)memalign( align, sizeof(T) ); 114 } // alloc_align 115 116 T * alloc_align( size_t align, size_t dim ) { 101 } // align_alloc 102 103 T * align_alloc( size_t align, char fill ) { 104 T * ptr = (T *)memalign( align, sizeof(T) ); 105 return (T *)memset( ptr, (int)fill, sizeof(T) ); 106 } // align_alloc 107 108 T * align_alloc( size_t align, size_t dim ) { 117 109 return (T *)memalign( align, dim * sizeof(T) ); 118 } // alloc_align 119 120 T * alloc_align_set( size_t align, char fill ) { 121 return (T *)memset( (T *)alloc_align( align ), (int)fill, sizeof(T) ); // initialize with fill value 122 } // alloc_align 123 124 T * alloc_align_set( size_t align, T fill ) { 125 return (T *)memcpy( (T *)alloc_align( align ), &fill, sizeof(T) ); // initialize with fill value 126 } // alloc_align 127 128 T * alloc_align_set( size_t align, size_t dim, char fill ) { 129 return (T *)memset( (T *)alloc_align( align, dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value 130 } // alloc_align 131 132 T * alloc_align_set( size_t align, size_t dim, T fill ) { 133 T * r = (T *)alloc_align( align, dim ); 134 for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value 135 return r; 136 } // alloc_align 137 138 T * alloc_align_set( size_t align, size_t dim, const T fill[] ) { 139 return (T *)memcpy( (T *)alloc_align( align, dim ), fill, dim * sizeof(T) ); 140 } // alloc_align 141 } // distribution 142 143 forall( dtype T | sized(T) ) { 144 T * alloc_align( T ptr[], size_t align ); // realign 145 T * alloc_align( T ptr[], size_t align, size_t dim ); // aligned realloc array 146 T * alloc_align_set( T ptr[], size_t align, size_t dim, char fill ); // aligned realloc array with fill 147 } // distribution 110 } // align_alloc 111 112 T * align_alloc( size_t align, size_t dim, char fill ) { 113 if ( fill == '\0' ) { 114 return (T *)cmemalign( align, dim, sizeof(T) ); 115 } else { 116 return (T *)memset( (T *)memalign( align, dim * sizeof(T) ), (int)fill, dim * sizeof(T) ); 117 } // if 118 } // align_alloc 119 } // distribution 120 121 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ); 122 148 123 149 124 static inline forall( dtype T | sized(T) ) { 150 125 // data, non-array types 126 151 127 T * memset( T * dest, char fill ) { 152 128 return (T *)memset( dest, fill, sizeof(T) ); … … 160 136 static inline forall( dtype T | sized(T) ) { 161 137 // data, array types 138 162 139 T * amemset( T dest[], char fill, size_t dim ) { 163 140 return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset -
longrun_tests/Makefile.am
rc3a2007 rc921712 42 42 -I$(abs_top_srcdir)/tests \ 43 43 -I$(srcdir) \ 44 -DTEST_$(shell cat .type | tr a-z A-Z) 44 -DTEST_$(shell cat .type | tr a-z A-Z) \ 45 -in-tree 45 46 46 47 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield -
longrun_tests/Makefile.in
rc3a2007 rc921712 348 348 CCDEPMODE = @CCDEPMODE@ 349 349 CFACC = @CFACC@ 350 CFACC_INSTALL = @CFACC_INSTALL@351 350 CFACPP = @CFACPP@ 352 351 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 526 525 -I$(abs_top_srcdir)/tests \ 527 526 -I$(srcdir) \ 528 -DTEST_$(shell cat .type | tr a-z A-Z) 527 -DTEST_$(shell cat .type | tr a-z A-Z) \ 528 -in-tree 529 529 530 530 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield -
src/CodeGen/CodeGenerator.cc
rc3a2007 rc921712 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Oct 19 19:30:38201913 // Update Count : 50611 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr May 2 10:47:00 2019 13 // Update Count : 497 14 14 // 15 15 #include "CodeGenerator.h" … … 198 198 // deleted decls should never be used, so don't print them 199 199 if ( objectDecl->isDeleted && options.genC ) return; 200 201 // gcc allows an empty declarator (no name) for bit-fields and C states: 6.7.2.1 Structure and union specifiers, 202 // point 4, page 113: If the (bit field) value is zero, the declaration shall have no declarator. For anything 203 // else, the anonymous name refers to the anonymous object for plan9 inheritance. 204 if ( objectDecl->get_name().empty() && options.genC && ! objectDecl->get_bitfieldWidth() ) { 200 if (objectDecl->get_name().empty() && options.genC ) { 205 201 // only generate an anonymous name when generating C code, otherwise it clutters the output too much 206 202 static UniqueName name = { "__anonymous_object" }; 207 203 objectDecl->set_name( name.newName() ); 208 // Stops unused parameter warnings.209 if ( options.anonymousUnused ) {210 objectDecl->attributes.push_back( new Attribute( "unused" ) );211 }204 // Stops unused parameter warnings. 205 if ( options.anonymousUnused ) { 206 objectDecl->attributes.push_back( new Attribute( "unused" ) ); 207 } 212 208 } 213 209 -
src/CodeGen/GenType.cc
rc3a2007 rc921712 335 335 typeString = "_Atomic " + typeString; 336 336 } // if 337 if ( type->get_lvalue() && ! options.genC ) { 338 // when not generating C code, print lvalue for debugging. 339 typeString = "lvalue " + typeString; 340 } 337 341 } 338 342 } // namespace CodeGen -
src/ControlStruct/MLEMutator.cc
rc3a2007 rc921712 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Oct 22 17:22:44 201913 // Update Count : 2 2012 // Last Modified On : Thu Mar 8 17:08:25 2018 13 // Update Count : 219 14 14 // 15 15 … … 313 313 } 314 314 315 void MLEMutator::premutate( TryStmt * tryStmt ) {316 // generate a label for breaking out of a labeled if317 bool labeledBlock = !(tryStmt->get_labels().empty());318 if ( labeledBlock ) {319 Label brkLabel = generator->newLabel("blockBreak", tryStmt);320 enclosingControlStructures.push_back( Entry( tryStmt, brkLabel ) );321 GuardAction( [this]() { enclosingControlStructures.pop_back(); } );322 } // if323 }324 325 Statement * MLEMutator::postmutate( TryStmt * tryStmt ) {326 bool labeledBlock = !(tryStmt->get_labels().empty());327 if ( labeledBlock ) {328 if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {329 set_breakLabel( enclosingControlStructures.back().useBreakExit() );330 } // if331 } // if332 return tryStmt;333 }334 335 315 void MLEMutator::premutate( CaseStmt *caseStmt ) { 336 316 visit_children = false; -
src/ControlStruct/MLEMutator.h
rc3a2007 rc921712 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Oct 22 17:22:47 201913 // Update Count : 4 512 // Last Modified On : Thu Mar 8 16:42:32 2018 13 // Update Count : 41 14 14 // 15 15 … … 47 47 void premutate( SwitchStmt *switchStmt ); 48 48 Statement * postmutate( SwitchStmt *switchStmt ); 49 void premutate( TryStmt *tryStmt );50 Statement * postmutate( TryStmt *tryStmt );51 49 52 50 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 75 73 explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) : 76 74 stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {} 77 78 explicit Entry( TryStmt *stmt, Label breakExit ) :79 stmt( stmt ), breakExit( breakExit ) {}80 75 81 76 bool operator==( const Statement *other ) { return stmt == other; } -
src/GenPoly/Box.cc
rc3a2007 rc921712 837 837 deref->args.push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) ); 838 838 deref->result = arg->get_type()->clone(); 839 deref->result->set_lvalue( true ); 839 840 return deref; 840 841 } // if -
src/GenPoly/Lvalue.cc
rc3a2007 rc921712 54 54 delete ret->result; 55 55 ret->result = base->clone(); 56 ret->result->set_lvalue( true ); 56 57 return ret; 57 58 } else { … … 166 167 ReferenceType * result = strict_dynamic_cast< ReferenceType * >( appExpr->result ); 167 168 appExpr->result = result->base->clone(); 169 appExpr->result->set_lvalue( true ); 168 170 if ( ! inIntrinsic ) { 169 171 // when not in an intrinsic function, add a cast to … … 434 436 delete ret->result; 435 437 ret->result = castExpr->result; 436 assert( ret->get_lvalue()); // ensure result is lvalue438 ret->result->set_lvalue( true ); // ensure result is lvalue 437 439 castExpr->env = nullptr; 438 440 castExpr->arg = nullptr; -
src/Makefile.in
rc3a2007 rc921712 231 231 SynTree/Initializer.$(OBJEXT) \ 232 232 SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \ 233 SynTree/DeclReplacer.$(OBJEXT) 233 SynTree/DeclReplacer.$(OBJEXT) SynTree/TopLvalue.$(OBJEXT) 234 234 am__objects_8 = CompilationState.$(OBJEXT) $(am__objects_1) \ 235 235 $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \ … … 411 411 CCDEPMODE = @CCDEPMODE@ 412 412 CFACC = @CFACC@ 413 CFACC_INSTALL = @CFACC_INSTALL@414 413 CFACPP = @CFACPP@ 415 414 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 696 695 SynTree/TypeSubstitution.cc \ 697 696 SynTree/Attribute.cc \ 698 SynTree/DeclReplacer.cc 697 SynTree/DeclReplacer.cc \ 698 SynTree/TopLvalue.cc 699 699 700 700 … … 1025 1025 SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \ 1026 1026 SynTree/$(DEPDIR)/$(am__dirstamp) 1027 SynTree/TopLvalue.$(OBJEXT): SynTree/$(am__dirstamp) \ 1028 SynTree/$(DEPDIR)/$(am__dirstamp) 1027 1029 Tuples/$(am__dirstamp): 1028 1030 @$(MKDIR_P) Tuples … … 1335 1337 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@ 1336 1338 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@ 1339 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TopLvalue.Po@am__quote@ 1337 1340 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@ 1338 1341 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@ -
src/ResolvExpr/ConversionCost.cc
rc3a2007 rc921712 157 157 if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) { 158 158 PRINT( std::cerr << "converting compatible base type" << std::endl; ) 159 assert( src->get_lvalue() == srcIsLvalue ); 159 160 if ( srcIsLvalue ) { 160 161 PRINT( -
src/ResolvExpr/ResolveAssertions.cc
rc3a2007 rc921712 156 156 for ( const auto& assn : x.assns ) { 157 157 // compute conversion cost from satisfying decl to assertion 158 assert( !assn.match.adjType->get_lvalue() ); 158 159 k += computeConversionCost( 159 160 assn.match.adjType, assn.decl->get_type(), false, indexer, x.env ); -
src/SymTab/Autogen.h
rc3a2007 rc921712 97 97 // type->get_qualifiers() = Type::Qualifiers(); 98 98 Type * castType = addCast->clone(); 99 castType->get_qualifiers() -= Type::Qualifiers( Type:: Const | Type::Volatile | Type::Restrict | Type::Atomic );99 castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 100 100 // castType->set_lvalue( true ); // xxx - might not need this 101 101 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); -
src/SymTab/ManglerCommon.cc
rc3a2007 rc921712 88 88 { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA 89 89 { Type::Mutex, "X" }, 90 { Type::Lvalue, "L" }, 90 91 }; 91 92 -
src/SymTab/Validate.cc
rc3a2007 rc921712 81 81 #include "SynTree/Label.h" // for operator==, Label 82 82 #include "SynTree/Mutator.h" // for Mutator 83 #include "SynTree/TopLvalue.h" // for assertTopLvalue, clearInnerLvalue 83 84 #include "SynTree/Type.h" // for Type, TypeInstType, EnumInstType 84 85 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution … … 308 309 PassVisitor<FixQualifiedTypes> fixQual; 309 310 311 assertTopLvalue( translationUnit ); 310 312 { 311 313 Stats::Heap::newPass("validate-A"); … … 316 318 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling 317 319 } 320 assertTopLvalue( translationUnit ); 318 321 { 319 322 Stats::Heap::newPass("validate-B"); 320 323 Stats::Time::BlockGuard guard("validate-B"); 324 assertTopLvalue( translationUnit ); 321 325 Stats::Time::TimeBlock("Link Reference To Types", [&]() { 322 326 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 323 327 }); 328 clearInnerLvalue( translationUnit ); 329 assertTopLvalue( translationUnit ); 324 330 Stats::Time::TimeBlock("Fix Qualified Types", [&]() { 325 331 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed 326 332 }); 333 assertTopLvalue( translationUnit ); 327 334 Stats::Time::TimeBlock("Hoist Structs", [&]() { 328 335 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 329 336 }); 337 assertTopLvalue( translationUnit ); 330 338 Stats::Time::TimeBlock("Eliminate Typedefs", [&]() { 331 339 EliminateTypedef::eliminateTypedef( translationUnit ); // 332 340 }); 333 341 } 342 assertTopLvalue( translationUnit ); 334 343 { 335 344 Stats::Heap::newPass("validate-C"); … … 340 349 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen 341 350 } 351 assertTopLvalue( translationUnit ); 342 352 { 343 353 Stats::Heap::newPass("validate-D"); 344 354 Stats::Time::BlockGuard guard("validate-D"); 355 assertTopLvalue( translationUnit ); 345 356 Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() { 346 357 Concurrency::applyKeywords( translationUnit ); 347 358 }); 359 clearInnerLvalue( translationUnit ); 360 assertTopLvalue( translationUnit ); 348 361 Stats::Time::TimeBlock("Forall Pointer Decay", [&]() { 349 362 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution 350 363 }); 364 assertTopLvalue( translationUnit ); 351 365 Stats::Time::TimeBlock("Hoist Control Declarations", [&]() { 352 366 ControlStruct::hoistControlDecls( translationUnit ); // hoist initialization out of for statements; must happen before autogenerateRoutines 353 367 }); 368 assertTopLvalue( translationUnit ); 354 369 Stats::Time::TimeBlock("Generate Autogen routines", [&]() { 355 370 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay_old 356 371 }); 357 } 372 clearInnerLvalue( translationUnit ); 373 } 374 assertTopLvalue( translationUnit ); 358 375 { 359 376 Stats::Heap::newPass("validate-E"); 360 377 Stats::Time::BlockGuard guard("validate-E"); 378 assertTopLvalue( translationUnit ); 361 379 Stats::Time::TimeBlock("Implement Mutex Func", [&]() { 362 380 Concurrency::implementMutexFuncs( translationUnit ); 363 381 }); 382 clearInnerLvalue( translationUnit ); 383 assertTopLvalue( translationUnit ); 364 384 Stats::Time::TimeBlock("Implement Thread Start", [&]() { 365 385 Concurrency::implementThreadStarter( translationUnit ); 366 386 }); 387 assertTopLvalue( translationUnit ); 367 388 Stats::Time::TimeBlock("Compound Literal", [&]() { 368 389 mutateAll( translationUnit, compoundliteral ); 369 390 }); 391 assertTopLvalue( translationUnit ); 370 392 Stats::Time::TimeBlock("Resolve With Expressions", [&]() { 371 393 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables 372 394 }); 373 } 395 clearInnerLvalue( translationUnit ); 396 } 397 assertTopLvalue( translationUnit ); 374 398 { 375 399 Stats::Heap::newPass("validate-F"); 376 400 Stats::Time::BlockGuard guard("validate-F"); 401 assertTopLvalue( translationUnit ); 377 402 Stats::Time::TimeBlock("Fix Object Type", [&]() { 378 403 FixObjectType::fix( translationUnit ); 379 404 }); 405 assertTopLvalue( translationUnit ); 380 406 Stats::Time::TimeBlock("Array Length", [&]() { 381 407 ArrayLength::computeLength( translationUnit ); 382 408 }); 409 clearInnerLvalue( translationUnit ); 410 assertTopLvalue( translationUnit ); 383 411 Stats::Time::TimeBlock("Find Special Declarations", [&]() { 384 412 Validate::findSpecialDecls( translationUnit ); 385 413 }); 414 assertTopLvalue( translationUnit ); 386 415 Stats::Time::TimeBlock("Fix Label Address", [&]() { 387 416 mutateAll( translationUnit, labelAddrFixer ); 388 417 }); 418 assertTopLvalue( translationUnit ); 389 419 Stats::Time::TimeBlock("Handle Attributes", [&]() { 390 420 Validate::handleAttributes( translationUnit ); 391 421 }); 392 422 } 423 assertTopLvalue( translationUnit ); 393 424 } 394 425 … … 1303 1334 void FixObjectType::previsit( ObjectDecl * objDecl ) { 1304 1335 Type * new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer ); 1336 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type 1305 1337 objDecl->set_type( new_type ); 1306 1338 } … … 1308 1340 void FixObjectType::previsit( FunctionDecl * funcDecl ) { 1309 1341 Type * new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer ); 1342 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type 1310 1343 funcDecl->set_type( new_type ); 1311 1344 } … … 1314 1347 if ( typeDecl->get_base() ) { 1315 1348 Type * new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer ); 1349 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type 1316 1350 typeDecl->set_base( new_type ); 1317 1351 } // if -
src/SynTree/AddressExpr.cc
rc3a2007 rc921712 53 53 } // if 54 54 } 55 // result of & is never an lvalue 56 get_result()->set_lvalue( false ); 55 57 } 56 58 } -
src/SynTree/ApplicationExpr.cc
rc3a2007 rc921712 25 25 #include "Declaration.h" // for Declaration 26 26 #include "Expression.h" // for ParamEntry, ApplicationExpr, Expression 27 #include "InitTweak/InitTweak.h" // for getFunction28 27 #include "ResolvExpr/typeops.h" // for extractResultType 29 28 #include "Type.h" // for Type, PointerType, FunctionType … … 78 77 79 78 bool ApplicationExpr::get_lvalue() const { 80 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 81 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 82 if ( const DeclarationWithType * func = InitTweak::getFunction( this ) ) { 83 return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name); 84 } 85 return false; 79 return result->get_lvalue(); 86 80 } 87 81 -
src/SynTree/ArrayType.cc
rc3a2007 rc921712 26 26 ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes ) 27 27 : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) { 28 base->set_lvalue( false ); 28 29 } 29 30 -
src/SynTree/CommaExpr.cc
rc3a2007 rc921712 23 23 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 ) 24 24 : Expression(), arg1( arg1 ), arg2( arg2 ) { 25 // xxx - result of a comma expression is never an lvalue, so should set lvalue 26 // to false on all result types. Actually doing this causes some strange things 27 // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into. 25 28 set_result( maybeClone( arg2->get_result() ) ); 29 // get_type->set_isLvalue( false ); 26 30 } 27 31 … … 36 40 37 41 bool CommaExpr::get_lvalue() const { 38 // This is wrong by C, but the current implementation uses it. 39 // (ex: Specialize, Lvalue and Box) 40 return arg2->get_lvalue(); 42 // xxx - as above, shouldn't be an lvalue but that information is used anyways. 43 return result->get_lvalue(); 41 44 } 42 45 -
src/SynTree/Expression.cc
rc3a2007 rc921712 19 19 #include <iostream> // for ostream, operator<<, basic_ostream 20 20 #include <list> // for list, _List_iterator, list<>::co... 21 #include <set> // for set22 21 23 22 #include "Common/utility.h" // for maybeClone, cloneAll, deleteAll … … 65 64 66 65 bool Expression::get_lvalue() const { 66 assert( !result->get_lvalue() ); 67 67 return false; 68 68 } … … 115 115 assert( var->get_type() ); 116 116 Type * type = var->get_type()->clone(); 117 type->set_lvalue( true ); 117 118 118 119 // xxx - doesn't quite work yet - get different alternatives with the same cost … … 124 125 // long long int value; 125 126 // if ( decl->valueOf( var, value ) ) { 126 // type->set_lvalue( false ); // Would have to move to get_lvalue.127 // type->set_lvalue( false ); 127 128 // } 128 129 // } … … 139 140 140 141 bool VariableExpr::get_lvalue() const { 141 // It isn't always an lvalue, but it is never an rvalue. 142 return true; 142 return result->get_lvalue(); 143 143 } 144 144 … … 277 277 278 278 bool CastExpr::get_lvalue() const { 279 // This is actually wrong by C, but it works with our current set-up. 280 return arg->get_lvalue(); 279 return result->get_lvalue(); 281 280 } 282 281 … … 361 360 } 362 361 363 bool UntypedMemberExpr::get_lvalue() const {364 return aggregate->get_lvalue();365 }366 367 362 void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const { 368 363 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 383 378 sub.apply( res ); 384 379 result = res; 380 result->set_lvalue( true ); 385 381 result->get_qualifiers() |= aggregate->result->get_qualifiers(); 386 382 } … … 396 392 397 393 bool MemberExpr::get_lvalue() const { 398 // This is actually wrong by C, but it works with our current set-up.394 assert( result->get_lvalue() ); 399 395 return true; 400 396 } … … 431 427 // if references are still allowed in the AST, dereference returns a reference 432 428 ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) ); 429 } else { 430 // references have been removed, in which case dereference returns an lvalue of the base type. 431 ret->result->set_lvalue( true ); 433 432 } 434 433 } … … 448 447 449 448 bool UntypedExpr::get_lvalue() const { 450 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 451 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 452 std::string fname = InitTweak::getFunctionName( const_cast< UntypedExpr * >( this ) ); 453 return lvalueFunctions.count(fname); 449 return result->get_lvalue(); 454 450 } 455 451 … … 514 510 515 511 bool ConditionalExpr::get_lvalue() const { 516 return false;512 return result->get_lvalue(); 517 513 } 518 514 … … 574 570 575 571 bool ConstructorExpr::get_lvalue() const { 576 return false;572 return result->get_lvalue(); 577 573 } 578 574 … … 586 582 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) { 587 583 assert( type && initializer ); 584 type->set_lvalue( true ); 588 585 set_result( type ); 589 586 } … … 596 593 597 594 bool CompoundLiteralExpr::get_lvalue() const { 595 assert( result->get_lvalue() ); 598 596 return true; 599 597 } … … 650 648 } 651 649 bool StmtExpr::get_lvalue() const { 652 return false;650 return result->get_lvalue(); 653 651 } 654 652 void StmtExpr::print( std::ostream & os, Indenter indent ) const { -
src/SynTree/Expression.h
rc3a2007 rc921712 275 275 virtual ~UntypedMemberExpr(); 276 276 277 bool get_lvalue() const final;278 279 277 Expression * get_member() const { return member; } 280 278 void set_member( Expression * newValue ) { member = newValue; } -
src/SynTree/TupleExpr.cc
rc3a2007 rc921712 58 58 59 59 bool TupleExpr::get_lvalue() const { 60 return false;60 return result->get_lvalue(); 61 61 } 62 62 … … 71 71 assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() ); 72 72 set_result( (*std::next( type->get_types().begin(), index ))->clone() ); 73 // like MemberExpr, TupleIndexExpr is always an lvalue 74 get_result()->set_lvalue( true ); 73 75 } 74 76 … … 81 83 82 84 bool TupleIndexExpr::get_lvalue() const { 83 return tuple->get_lvalue(); 85 assert( result->get_lvalue() ); 86 return true; 84 87 } 85 88 -
src/SynTree/Type.cc
rc3a2007 rc921712 85 85 const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" }; 86 86 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" }; 87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", " mutex", "_Atomic" };87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" }; 88 88 89 89 Type * Type::stripDeclarator() { -
src/SynTree/Type.h
rc3a2007 rc921712 102 102 }; // StorageClasses 103 103 104 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Mutex = 1 << 3, Atomic = 1 << 4, NumTypeQualifier = 5};104 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 }; 105 105 static const char * QualifiersNames[]; 106 106 union Qualifiers { 107 enum { Mask = ~ Restrict};107 enum { Mask = ~(Restrict | Lvalue) }; 108 108 unsigned int val; 109 109 struct { … … 111 111 bool is_restrict : 1; 112 112 bool is_volatile : 1; 113 bool is_lvalue : 1; 113 114 bool is_mutex : 1; 114 115 bool is_atomic : 1; … … 152 153 bool get_volatile() const { return tq.is_volatile; } 153 154 bool get_restrict() const { return tq.is_restrict; } 155 bool get_lvalue() const { return tq.is_lvalue; } 154 156 bool get_mutex() const { return tq.is_mutex; } 155 157 bool get_atomic() const { return tq.is_atomic; } … … 157 159 void set_volatile( bool newValue ) { tq.is_volatile = newValue; } 158 160 void set_restrict( bool newValue ) { tq.is_restrict = newValue; } 161 void set_lvalue( bool newValue ) { tq.is_lvalue = newValue; } 159 162 void set_mutex( bool newValue ) { tq.is_mutex = newValue; } 160 163 void set_atomic( bool newValue ) { tq.is_atomic = newValue; } -
src/SynTree/module.mk
rc3a2007 rc921712 49 49 SynTree/TypeSubstitution.cc \ 50 50 SynTree/Attribute.cc \ 51 SynTree/DeclReplacer.cc 51 SynTree/DeclReplacer.cc \ 52 SynTree/TopLvalue.cc 52 53 53 54 SRC += $(SRC_SYNTREE) -
src/Tuples/TupleExpansion.cc
rc3a2007 rc921712 304 304 // produce the TupleType which aggregates the types of the exprs 305 305 std::list< Type * > types; 306 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type:: Atomic | Type::Mutex );306 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ); 307 307 for ( Expression * expr : exprs ) { 308 308 assert( expr->get_result() ); -
src/main.cc
rc3a2007 rc921712 59 59 #include "ResolvExpr/Resolver.h" // for resolve 60 60 #include "SymTab/Validate.h" // for validate 61 #include "SynTree/TopLvalue.h" // for assertTopLvalue, clearInn... 61 62 #include "SynTree/Declaration.h" // for Declaration 62 63 #include "SynTree/Visitor.h" // for acceptAll … … 258 259 Stats::Time::StopBlock(); 259 260 261 //std::cerr << "Post-Parse Check" << std::endl; 262 clearInnerLvalue( translationUnit ); 263 assertTopLvalue( translationUnit ); 264 260 265 // add the assignment statement after the initialization of a type parameter 261 266 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) ); … … 276 281 } // if 277 282 283 assertTopLvalue( translationUnit ); 278 284 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) ); 285 assertTopLvalue( translationUnit ); 279 286 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) ); 287 assertTopLvalue( translationUnit ); 280 288 PASS( "Gen Init", InitTweak::genInit( translationUnit ) ); 289 assertTopLvalue( translationUnit ); 281 290 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) ); 291 assertTopLvalue( translationUnit ); 282 292 if ( libcfap ) { 283 293 // generate the bodies of cfa library functions … … 303 313 } // if 304 314 315 assertTopLvalue( translationUnit ); 316 305 317 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); 306 318 if ( exprp ) { … … 309 321 } // if 310 322 323 clearInnerLvalue( translationUnit ); 324 assertTopLvalue( translationUnit ); 325 311 326 // fix ObjectDecl - replaces ConstructorInit nodes 312 327 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) ); 328 clearInnerLvalue( translationUnit ); 329 assertTopLvalue( translationUnit ); 313 330 if ( ctorinitp ) { 314 331 dump ( translationUnit ); … … 317 334 318 335 PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused 336 assertTopLvalue( translationUnit ); 319 337 320 338 PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) ); 339 assertTopLvalue( translationUnit ); 321 340 322 341 PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) ); 342 clearInnerLvalue( translationUnit ); 343 assertTopLvalue( translationUnit ); 323 344 324 345 PASS( "Convert Specializations", GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded 346 clearInnerLvalue( translationUnit ); 347 assertTopLvalue( translationUnit ); 325 348 326 349 PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this? 350 assertTopLvalue( translationUnit ); 327 351 328 352 if ( tuplep ) { … … 332 356 333 357 PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM 358 assertTopLvalue( translationUnit ); 334 359 335 360 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) ); … … 338 363 return EXIT_SUCCESS; 339 364 } // if 340 365 clearInnerLvalue( translationUnit ); 366 assertTopLvalue( translationUnit ); 341 367 PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) ); 368 clearInnerLvalue( translationUnit ); 369 assertTopLvalue( translationUnit ); 342 370 343 371 if ( bboxp ) { … … 346 374 } // if 347 375 PASS( "Box", GenPoly::box( translationUnit ) ); 376 clearInnerLvalue( translationUnit ); 377 assertTopLvalue( translationUnit ); 348 378 349 379 if ( bcodegenp ) { … … 357 387 358 388 CodeTools::fillLocations( translationUnit ); 389 assertTopLvalue( translationUnit ); 359 390 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 360 391 -
tests/.expect/alloc-ERROR.txt
rc3a2007 rc921712 1 alloc.cfa: 311:1 error: No reasonable alternatives for expression Applying untyped:1 alloc.cfa:265:1 error: No reasonable alternatives for expression Applying untyped: 2 2 Name: ?=? 3 3 ...to: … … 19 19 20 20 21 alloc.cfa: 312:1 error: No reasonable alternatives for expression Applying untyped:21 alloc.cfa:266:1 error: No reasonable alternatives for expression Applying untyped: 22 22 Name: ?=? 23 23 ...to: … … 39 39 40 40 41 alloc.cfa: 313:1 error: No reasonable alternatives for expression Applying untyped:41 alloc.cfa:267:1 error: No reasonable alternatives for expression Applying untyped: 42 42 Name: ?=? 43 43 ...to: … … 50 50 51 51 52 alloc.cfa: 314:1 error: No reasonable alternatives for expression Applying untyped:52 alloc.cfa:268:1 error: No reasonable alternatives for expression Applying untyped: 53 53 Name: ?=? 54 54 ...to: -
tests/.expect/alloc.txt
rc3a2007 rc921712 2 2 CFA malloc 0xdeadbeef 3 3 CFA alloc 0xdeadbeef 4 CFA array alloc, fill 0xde 5 CFA alloc, fill dededede 6 CFA alloc, fill 3 4 CFA alloc, fill ffffffff 7 5 8 6 C array calloc, fill 0 … … 12 10 CFA array alloc, no fill 13 11 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 14 CFA array alloc, fill 0xde 15 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 16 CFA array alloc, fill 0xef 17 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 18 CFA array alloc, fill from array 19 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 12 CFA array alloc, fill 0xff 13 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 20 14 21 C realloc22 0x efefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef15 C realloc 16 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 23 17 CFA realloc 24 0x efefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x101010118 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 25 19 26 CFA resize a rray alloc20 CFA resize alloc 27 21 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 28 22 CFA resize array alloc … … 31 25 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 32 26 CFA resize array alloc, fill 33 0x deadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede27 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 34 28 CFA resize array alloc, fill 35 0x deadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef29 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 36 30 CFA resize array alloc, fill 37 0x deadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede31 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 38 32 39 33 C memalign 42 42.5 … … 41 35 CFA posix_memalign 42 42.5 42 36 CFA posix_memalign 42 42.5 43 CFA alloc_align 42 42.5 44 CFA alloc_align 42 42.5 45 CFA alloc_align fill 0xdededede -0x1.ededededededep+494 46 CFA alloc_align fill 42 42.5 47 CFA alloc_align 42 42.5 37 CFA aligned_alloc 42 42.5 38 CFA align_alloc 42 42.5 39 CFA align_alloc fill 0xffffffff -nan 48 40 49 CFA array al loc_align41 CFA array align_alloc 50 42 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 51 CFA array alloc_align, fill 52 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 53 CFA array alloc_align, fill 54 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 55 CFA array alloc_align, fill array 56 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 57 CFA realloc array alloc_align 58 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 43 CFA array align_alloc, fill 44 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 59 45 60 CFA memset 0x dededede -0x1.ededededededep+49461 CFA memcpy 0x dededede -0x1.ededededededep+49446 CFA memset 0xffffffff -nan 47 CFA memcpy 0xffffffff -nan 62 48 63 49 CFA array memset 64 0x dededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,50 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 65 51 CFA array memcpy 66 0x dededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,52 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 67 53 68 54 CFA new initialize -
tests/.expect/attributes.x64.txt
rc3a2007 rc921712 784 784 signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26)); 785 785 struct Vad { 786 __attribute__ ((unused)) signed int :4;787 __attribute__ ((unused)) signed int :4;788 __attribute__ ((unused,unused)) signed int :6;786 __attribute__ ((unused)) signed int __anonymous_object27:4; 787 __attribute__ ((unused)) signed int __anonymous_object28:4; 788 __attribute__ ((unused,unused)) signed int __anonymous_object29:6; 789 789 }; 790 790 static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1); -
tests/.expect/attributes.x86.txt
rc3a2007 rc921712 784 784 signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26)); 785 785 struct Vad { 786 __attribute__ ((unused)) signed int :4;787 __attribute__ ((unused)) signed int :4;788 __attribute__ ((unused,unused)) signed int :6;786 __attribute__ ((unused)) signed int __anonymous_object27:4; 787 __attribute__ ((unused)) signed int __anonymous_object28:4; 788 __attribute__ ((unused,unused)) signed int __anonymous_object29:6; 789 789 }; 790 790 static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1); -
tests/Makefile.am
rc3a2007 rc921712 24 24 archiveerrors= 25 25 26 INSTALL_FLAGS=-in-tree 26 27 DEBUG_FLAGS=-debug -O0 27 28 … … 42 43 -DIN_DIR="${abs_srcdir}/.in/" 43 44 44 # get the desired cfa to test45 TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)46 47 45 # adjust CC to current flags 48 CC = $(if $( ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})46 CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}) 49 47 CFACC = $(CC) 50 48 … … 53 51 54 52 # adjusted CC but without the actual distcc call 55 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})53 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}) 56 54 57 55 PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && -
tests/Makefile.in
rc3a2007 rc921712 214 214 215 215 # adjust CC to current flags 216 CC = $(if $( ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})216 CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}) 217 217 CCAS = @CCAS@ 218 218 CCASDEPMODE = @CCASDEPMODE@ … … 220 220 CCDEPMODE = @CCDEPMODE@ 221 221 CFACC = $(CC) 222 CFACC_INSTALL = @CFACC_INSTALL@223 222 CFACPP = @CFACPP@ 224 223 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 382 381 installed = no 383 382 archiveerrors = 383 INSTALL_FLAGS = -in-tree 384 384 DEBUG_FLAGS = -debug -O0 385 385 quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes … … 398 398 399 399 400 # get the desired cfa to test401 TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)402 403 400 # get local binary for depedencies 404 401 CFACCBIN = @CFACC@ 405 402 406 403 # adjusted CC but without the actual distcc call 407 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) ,$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})404 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}) 408 405 PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && 409 406 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa -
tests/alloc.cfa
rc3a2007 rc921712 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 20 21:45:21 201913 // Update Count : 3 9112 // Last Modified On : Tue Nov 6 17:50:52 2018 13 // Update Count : 339 14 14 // 15 15 … … 19 19 #include <stdlib.h> // posix_memalign 20 20 #include <fstream.hfa> 21 #include <stdlib.hfa> // access C malloc, realloc21 #include <stdlib.hfa> // access C malloc, realloc 22 22 23 23 int * foo( int * p, int c ) { return p; } … … 27 27 int main( void ) { 28 28 size_t dim = 10; 29 char fill = '\x de';30 int * p , * p1;29 char fill = '\xff'; 30 int * p; 31 31 32 32 // allocation, non-array types 33 33 34 // int & r = malloc(); 35 // r = 0xdeadbeef; 36 // printf( "C malloc %#x\n", r ); 37 // free( &r ); 38 34 39 p = (int *)malloc( sizeof(*p) ); // C malloc, type unsafe 35 40 *p = 0xdeadbeef; … … 47 52 free( p ); 48 53 49 p = alloc_set( fill ); // CFA alloc, fill 50 printf( "CFA array alloc, fill %#hhx\n", fill ); 54 p = alloc( fill ); // CFA alloc, fill 51 55 printf( "CFA alloc, fill %08x\n", *p ); 52 free( p );53 54 p = alloc_set( 3 ); // CFA alloc, fill55 printf( "CFA alloc, fill %d\n", *p );56 56 free( p ); 57 57 … … 79 79 free( p ); 80 80 81 p = alloc _set( 2 * dim, fill );// CFA array alloc, fill81 p = alloc( 2 * dim, fill ); // CFA array alloc, fill 82 82 printf( "CFA array alloc, fill %#hhx\n", fill ); 83 83 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 84 84 printf( "\n" ); 85 free( p );86 87 p = alloc_set( 2 * dim, 0xdeadbeef ); // CFA array alloc, fill88 printf( "CFA array alloc, fill %#hhx\n", 0xdeadbeef );89 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }90 printf( "\n" );91 85 // do not free 92 86 93 p1 = alloc_set( 2 * dim, p ); // CFA array alloc, fill94 printf( "CFA array alloc, fill from array\n" );95 for ( i; 2 * dim ) { printf( "%#x %#x, ", p[i], p1[i] ); }96 free( p1 );97 printf( "\n" );98 99 87 100 88 // resize, non-array types … … 102 90 103 91 p = (int *)realloc( p, dim * sizeof(*p) ); // C realloc 104 printf( "C realloc\n" );105 for ( i; dim ) { printf( "%#x ", p[i] ); }106 printf( "\n" );107 // do not free92 for ( i; dim ) { p[i] = 0xdeadbeef; } 93 printf( "C realloc\n" ); 94 for ( i; dim ) { printf( "%#x ", p[i] ); } 95 printf( "\n" ); 108 96 109 97 p = realloc( p, 2 * dim * sizeof(*p) ); // CFA realloc … … 120 108 p = alloc( p, dim ); // CFA resize array alloc 121 109 for ( i; dim ) { p[i] = 0xdeadbeef; } 122 printf( "CFA resize array alloc\n" ); 123 for ( i; dim ) { printf( "%#x ", p[i] ); } 124 printf( "\n" ); 125 // do not free 110 printf( "CFA resize alloc\n" ); 111 for ( i; dim ) { printf( "%#x ", p[i] ); } 112 printf( "\n" ); 126 113 127 114 p = alloc( p, 2 * dim ); // CFA resize array alloc … … 130 117 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 131 118 printf( "\n" ); 132 // do not free 133 134 p = alloc( p, dim ); // CFA resize array alloc 119 120 p = alloc( p, dim ); // CFA array alloc 135 121 printf( "CFA resize array alloc\n" ); 136 122 for ( i; dim ) { printf( "%#x ", p[i] ); } 137 123 printf( "\n" ); 138 // do not free 139 140 p = alloc_set( p, 3 * dim, fill ); // CFA resize array alloc, fill 124 125 free( p ); 126 p = 0; 127 128 p = alloc( p, dim, fill ); // CFA array alloc, fill 141 129 printf( "CFA resize array alloc, fill\n" ); 142 for ( i; 3 * dim ) { printf( "%#x ", p[i] ); } 143 printf( "\n" ); 144 // do not free 145 146 p = alloc_set( p, dim, fill ); // CFA resize array alloc, fill 130 for ( i; dim ) { printf( "%#x ", p[i] ); } 131 printf( "\n" ); 132 133 p = alloc( p, 2 * dim, fill ); // CFA array alloc, fill 147 134 printf( "CFA resize array alloc, fill\n" ); 148 for ( i; dim ) { printf( "%#x ", p[i] ); } 149 printf( "\n" ); 150 // do not free 151 152 p = alloc_set( p, 3 * dim, fill ); // CFA resize array alloc, fill 135 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 136 printf( "\n" ); 137 138 p = alloc( p, dim, fill ); // CFA array alloc, fill 153 139 printf( "CFA resize array alloc, fill\n" ); 154 for ( i; 3 *dim ) { printf( "%#x ", p[i] );; }140 for ( i; dim ) { printf( "%#x ", p[i] );; } 155 141 printf( "\n" ); 156 142 free( p ); … … 186 172 free( stp ); 187 173 188 stp = &(*alloc_align( Alignment)){ 42, 42.5 }; // CFA alloc_align 189 assert( (uintptr_t)stp % Alignment == 0 ); 190 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 191 free( stp ); 192 193 stp = &(*alloc_align( Alignment )){ 42, 42.5 }; // CFA alloc_align 194 assert( (uintptr_t)stp % Alignment == 0 ); 195 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 196 free( stp ); 197 198 stp = alloc_align_set( Alignment, fill ); // CFA memalign, fill 199 assert( (uintptr_t)stp % Alignment == 0 ); 200 printf( "CFA alloc_align fill %#x %a\n", stp->x, stp->y ); 201 free( stp ); 202 203 stp = alloc_align_set( Alignment, (Struct){ 42, 42.5 } ); // CFA memalign, fill 204 assert( (uintptr_t)stp % Alignment == 0 ); 205 printf( "CFA alloc_align fill %d %g\n", stp->x, stp->y ); 206 // do not free 207 208 stp = &(*alloc_align( stp, 4096 )){ 42, 42.5 }; // CFA realign 209 assert( (uintptr_t)stp % 4096 == 0 ); 210 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 174 stp = &(*aligned_alloc( Alignment )){ 42, 42.5 }; // CFA aligned_alloc 175 assert( (uintptr_t)stp % Alignment == 0 ); 176 printf( "CFA aligned_alloc %d %g\n", stp->x, stp->y ); 177 free( stp ); 178 179 stp = &(*align_alloc( Alignment )){ 42, 42.5 }; // CFA align_alloc 180 assert( (uintptr_t)stp % Alignment == 0 ); 181 printf( "CFA align_alloc %d %g\n", stp->x, stp->y ); 182 free( stp ); 183 184 stp = align_alloc( Alignment, fill ); // CFA memalign, fill 185 assert( (uintptr_t)stp % Alignment == 0 ); 186 printf( "CFA align_alloc fill %#x %a\n", stp->x, stp->y ); 211 187 free( stp ); 212 188 … … 215 191 printf( "\n" ); 216 192 217 stp = al loc_align( Alignment, dim ); // CFA array memalign193 stp = align_alloc( Alignment, dim ); // CFA array memalign 218 194 assert( (uintptr_t)stp % Alignment == 0 ); 219 195 for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; } 220 printf( "CFA array al loc_align\n" );196 printf( "CFA array align_alloc\n" ); 221 197 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 222 198 printf( "\n" ); 223 199 free( stp ); 224 200 225 stp = al loc_align_set( Alignment, dim, fill );// CFA array memalign, fill226 assert( (uintptr_t)stp % Alignment == 0 ); 227 printf( "CFA array al loc_align, fill\n" );201 stp = align_alloc( Alignment, dim, fill ); // CFA array memalign, fill 202 assert( (uintptr_t)stp % Alignment == 0 ); 203 printf( "CFA array align_alloc, fill\n" ); 228 204 for ( i; dim ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); } 229 printf( "\n" );230 free( stp );231 232 stp = alloc_align_set( Alignment, dim, (Struct){ 42, 42.5 } ); // CFA array memalign, fill233 assert( (uintptr_t)stp % Alignment == 0 );234 printf( "CFA array alloc_align, fill\n" );235 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }236 printf( "\n" );237 // do not free238 239 stp1 = alloc_align_set( Alignment, dim, stp ); // CFA array memalign, fill240 assert( (uintptr_t)stp % Alignment == 0 );241 printf( "CFA array alloc_align, fill array\n" );242 for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); }243 printf( "\n" );244 free( stp1 );245 246 stp = alloc_align( stp, 4096, dim ); // CFA aligned realloc array247 assert( (uintptr_t)stp % 4096 == 0 );248 for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; }249 printf( "CFA realloc array alloc_align\n" );250 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }251 205 printf( "\n" ); 252 206 free( stp ); -
tests/concurrent/examples/quickSort.cfa
rc3a2007 rc921712 11 11 // Created On : Wed Dec 6 12:15:52 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Oct 10 13:58:18201914 // Update Count : 17 613 // Last Modified On : Fri Jun 21 08:27:45 2019 14 // Update Count : 172 15 15 // 16 16 … … 66 66 if ( depth > 0 ) { 67 67 depth -= 1; 68 Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 69 Quicksort rqs = { values, left, high, depth }; // concurrently sort upper half 70 // Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 71 // sort( values, left, high, depth ); // concurrently sort upper half 68 Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half 69 //Quicksort lqs( values, left, high, depth ); // concurrently sort lower half 70 sort( values, left, high, depth ); // concurrently sort lower half 72 71 } else { 73 72 sort( values, low, right, 0 ); // sequentially sort lower half … … 163 162 processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads 164 163 165 int * values = alloc( size ); // values to be sorted, too large to put on stack166 for ( counter; size ) { // generate unsorted numbers164 int * values = alloc( size ); // values to be sorted, too large to put on stack 165 for ( counter; size ) { // generate unsorted numbers 167 166 values[counter] = size - counter; // descending values 168 } // for169 for ( int i = 0; i < 200; i +=1 ) { // random shuffle a few values170 swap( values[rand() % size], values[rand() % size] );171 167 } // for 172 168 { … … 182 178 } // main 183 179 184 // for depth in 0 1 2 3 4 5 ; do echo "sort 500000000 values with ${depth} depth" ; time -f "%Uu %Ss %E %Mkb" a.out -t 500000000 ${depth} ; done185 186 180 // Local Variables: // 187 181 // tab-width: 4 // -
tests/labelledExit.cfa
rc3a2007 rc921712 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Oct 25 17:41:51 201913 // Update Count : 712 // Last Modified On : Tue Nov 6 17:57:42 2018 13 // Update Count : 4 14 14 // 15 15 … … 136 136 } 137 137 138 // all nested control options, labelled exits139 140 Comp: {141 Try: try {142 For: for ( ;; ) {143 While: while ( true ) {144 Do: do {145 If: if ( true ) {146 Switch2: switch ( 3 ) {147 case 3:148 break Try;149 break Comp;150 break For; continue For;151 break While; continue While;152 break Do; continue Do;153 break If;154 break Switch2;155 } // switch156 } // if157 } while ( true );158 } // while159 } // for160 } finally {} // always executed161 } // compound162 163 138 // computed goto 164 139 // { -
tests/pybin/settings.py
rc3a2007 rc921712 96 96 distribute = False 97 97 98 self.string = "installed" if value else "in tree"99 self.flags = """ installed=%s""" % ("yes" if value else "no")98 self.string = "installed" if value else "in-tree" 99 self.flags = """INSTALL_FLAGS=%s""" % ("" if value else "-in-tree") 100 100 101 101 class Timeouts: -
tests/pybin/tools.py
rc3a2007 rc921712 343 343 # make a directory for this test 344 344 # mkdir makes the parent directory only so add a dummy 345 mkdir(os.path.join(dst, name))345 mkdir(os.path.join(dst, "dir")) 346 346 347 347 # moves the files -
tools/Makefile.in
rc3a2007 rc921712 208 208 CCDEPMODE = @CCDEPMODE@ 209 209 CFACC = @CFACC@ 210 CFACC_INSTALL = @CFACC_INSTALL@211 210 CFACPP = @CFACPP@ 212 211 CFA_BACKEND_CC = @CFA_BACKEND_CC@ -
tools/prettyprinter/Makefile.in
rc3a2007 rc921712 237 237 CCDEPMODE = @CCDEPMODE@ 238 238 CFACC = @CFACC@ 239 CFACC_INSTALL = @CFACC_INSTALL@240 239 CFACPP = @CFACPP@ 241 240 CFA_BACKEND_CC = @CFA_BACKEND_CC@
Note:
See TracChangeset
for help on using the changeset viewer.