Changeset a0ba5e6
- Timestamp:
- Nov 13, 2020, 5:02:51 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1e208ea
- Parents:
- a056f56 (diff), 726b748 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 13 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/defs.hfa
ra056f56 ra0ba5e6 10 10 // Created On : Thu Nov 9 13:24:10 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 26 16:22:32202013 // Update Count : 2 012 // Last Modified On : Sat Oct 24 10:53:15 2020 13 // Update Count : 21 14 14 // 15 15 … … 60 60 #else 61 61 #error unsupported hardware architecture 62 #endif // __ARM_ARCH62 #endif 63 63 } -
libcfa/src/concurrency/CtxSwitch-x86_64.S
ra056f56 ra0ba5e6 10 10 // Created On : Mon Aug 10 08:10:26 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 20 18:09:32202013 // Update Count : 912 // Last Modified On : Sat Oct 24 14:36:25 2020 13 // Update Count : 10 14 14 // 15 15 … … 79 79 80 80 // Local Variables: // 81 // mode: c//81 // mode: asm // 82 82 // tab-width: 4 // 83 83 // End: // -
libcfa/src/concurrency/invoke.c
ra056f56 ra0ba5e6 10 10 // Created On : Tue Jan 17 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 20 23:43:23202013 // Update Count : 3 112 // Last Modified On : Sat Oct 24 14:35:28 2020 13 // Update Count : 32 14 14 // 15 15 … … 184 184 fs->intRegs[1] = this; // argument to invoke x20 => x1 185 185 fs->intRegs[2] = invoke; 186 //for ( intptr_t i = 3; i < 12; i += 1 ) fs->intRegs[i] = (void *)i;187 186 fs->intRegs[11] = __cfactx_invoke_stub; // link register x30 => ret moves to pc 188 //for ( int i = 0; i < 8; i += 1 ) fs->fpRegs[i] = i + 12;189 187 #else 190 188 #error uknown hardware architecture -
libcfa/src/concurrency/preemption.cfa
ra056f56 ra0ba5e6 215 215 // available. 216 216 217 //----------------------------------------------------------------------------- 218 // Some assembly required 219 #define __cfaasm_label(label, when) when: asm volatile goto(".global __cfaasm_" #label "_" #when "\n" "__cfaasm_" #label "_" #when ":":::"memory":when) 220 217 221 //---------- 218 222 // special case for preemption since used often … … 220 224 // create a assembler label before 221 225 // marked as clobber all to avoid movement 222 asm volatile("__cfaasm_check_before:":::"memory");226 __cfaasm_label(check, before); 223 227 224 228 // access tls as normal … … 227 231 // create a assembler label after 228 232 // marked as clobber all to avoid movement 229 asm volatile("__cfaasm_check_after:":::"memory");233 __cfaasm_label(check, after); 230 234 return enabled; 231 235 } … … 246 250 uintptr_t __cfatls_get( unsigned long int offset ) __attribute__((__noinline__)); //no inline to avoid problems 247 251 uintptr_t __cfatls_get( unsigned long int offset ) { 248 // __cfaasm_get.before = ({ void * value; asm("movq $__cfaasm_get_before, %[v]\n\t" : [v]"=r"(value) ); value; });249 // __cfaasm_get.after = ({ void * value; asm("movq $__cfaasm_get_after , %[v]\n\t" : [v]"=r"(value) ); value; });250 252 // create a assembler label before 251 253 // marked as clobber all to avoid movement 252 asm volatile("__cfaasm_get_before:":::"memory");254 __cfaasm_label(get, before); 253 255 254 256 // access tls as normal (except for pointer arithmetic) … … 257 259 // create a assembler label after 258 260 // marked as clobber all to avoid movement 259 asm volatile("__cfaasm_get_after:":::"memory");261 __cfaasm_label(get, after); 260 262 return val; 261 263 } … … 266 268 // create a assembler label before 267 269 // marked as clobber all to avoid movement 268 asm volatile("__cfaasm_dsable_before:":::"memory");270 __cfaasm_label(dsable, before); 269 271 270 272 with( __cfaabi_tls.preemption_state ) { … … 288 290 // create a assembler label after 289 291 // marked as clobber all to avoid movement 290 asm volatile("__cfaasm_dsable_after:":::"memory"); 292 __cfaasm_label(dsable, after); 293 291 294 } 292 295 … … 294 297 // If counter reaches 0, execute any pending __cfactx_switch 295 298 void enable_interrupts( __cfaabi_dbg_ctx_param ) { 296 // create a assembler label before 297 // marked as clobber all to avoid movement 298 asm volatile("__cfaasm_enble_before:":::"memory"); 299 300 processor * proc = __cfaabi_tls.this_processor; // Cache the processor now since interrupts can start happening after the atomic store 299 // Cache the processor now since interrupts can start happening after the atomic store 300 processor * proc = __cfaabi_tls.this_processor; 301 301 /* paranoid */ verify( proc ); 302 302 … … 304 304 unsigned short prev = disable_count; 305 305 disable_count -= 1; 306 verify( prev != 0u ); // If this triggers someone is enabled already enabled interruptsverify( prev != 0u ); 306 307 // If this triggers someone is enabled already enabled interruptsverify( prev != 0u ); 308 /* paranoid */ verify( prev != 0u ); 307 309 308 310 // Check if we need to prempt the thread because an interrupt was missed 309 311 if( prev == 1 ) { 310 312 #if GCC_VERSION > 50000 311 static_assert(__atomic_always_lock_free(sizeof(enabled), &enabled), "Must be lock-free");313 static_assert(__atomic_always_lock_free(sizeof(enabled), &enabled), "Must be lock-free"); 312 314 #endif 313 315 … … 328 330 // For debugging purposes : keep track of the last person to enable the interrupts 329 331 __cfaabi_dbg_debug_do( proc->last_enable = caller; ) 330 331 // create a assembler label after332 // marked as clobber all to avoid movement333 asm volatile("__cfaasm_enble_after:":::"memory");334 332 } 335 333 … … 337 335 // Don't execute any pending __cfactx_switch even if counter reaches 0 338 336 void enable_interrupts_noPoll() { 339 // create a assembler label before340 // marked as clobber all to avoid movement341 asm volatile("__cfaasm_nopoll_before:":::"memory");342 343 337 unsigned short prev = __cfaabi_tls.preemption_state.disable_count; 344 338 __cfaabi_tls.preemption_state.disable_count -= 1; 345 verifyf( prev != 0u, "Incremented from %u\n", prev ); // If this triggers someone is enabled already enabled interrupts 339 // If this triggers someone is enabled already enabled interrupts 340 /* paranoid */ verifyf( prev != 0u, "Incremented from %u\n", prev ); 346 341 if( prev == 1 ) { 347 342 #if GCC_VERSION > 50000 348 static_assert(__atomic_always_lock_free(sizeof(__cfaabi_tls.preemption_state.enabled), &__cfaabi_tls.preemption_state.enabled), "Must be lock-free");343 static_assert(__atomic_always_lock_free(sizeof(__cfaabi_tls.preemption_state.enabled), &__cfaabi_tls.preemption_state.enabled), "Must be lock-free"); 349 344 #endif 350 345 // Set enabled flag to true … … 356 351 __atomic_signal_fence(__ATOMIC_RELEASE); 357 352 } 358 359 // create a assembler label after 360 // marked as clobber all to avoid movement 361 asm volatile("__cfaasm_nopoll_after:":::"memory"); 362 } 363 } 353 } 354 } 355 356 #undef __cfaasm_label 364 357 365 358 // sigprocmask wrapper : unblock a single signal … … 443 436 #elif defined( __aarch64__ ) 444 437 #ifdef __PIC__ 445 #define RELOC_TAG "@PLT" 446 #else 447 #define RELOC_TAG "" 448 #endif 449 #define __cfaasm_label( label ) \ 438 // Note that this works only for gcc 439 #define __cfaasm_label( label ) static struct asm_region label = \ 450 440 ({ \ 451 441 struct asm_region region; \ 452 442 asm( \ 453 "mov %[vb], __cfaasm_" #label "_before@GOTPCREL(%%rip)" "\n\t" \ 454 "mov %[va], __cfaasm_" #label "_after@GOTPCREL(%%rip)" "\n\t" \ 443 "adrp %[vb], _GLOBAL_OFFSET_TABLE_" "\n\t" \ 444 "ldr %[vb], [%[vb], #:gotpage_lo15:__cfaasm_" #label "_before]" "\n\t" \ 445 "adrp %[va], _GLOBAL_OFFSET_TABLE_" "\n\t" \ 446 "ldr %[va], [%[va], #:gotpage_lo15:__cfaasm_" #label "_after]" "\n\t" \ 455 447 : [vb]"=r"(region.before), [va]"=r"(region.after) \ 456 448 ); \ 457 449 region; \ 458 450 }); 451 #else 452 #error this is not the right thing to do 453 /* 454 #define __cfaasm_label( label ) static struct asm_region label = \ 455 ({ \ 456 struct asm_region region; \ 457 asm( \ 458 "adrp %[vb], __cfaasm_" #label "_before" "\n\t" \ 459 "add %[vb], %[vb], :lo12:__cfaasm_" #label "_before" "\n\t" \ 460 "adrp %[va], :got:__cfaasm_" #label "_after" "\n\t" \ 461 "add %[va], %[va], :lo12:__cfaasm_" #label "_after" "\n\t" \ 462 : [vb]"=r"(region.before), [va]"=r"(region.after) \ 463 ); \ 464 region; \ 465 }); 466 */ 467 #endif 459 468 #else 460 469 #error unknown hardware architecture … … 470 479 __cfaasm_label( check ); 471 480 __cfaasm_label( dsable ); 472 __cfaasm_label( enble );473 __cfaasm_label( nopoll );474 481 475 482 // Check if preemption is safe … … 478 485 if( __cfaasm_in( ip, check ) ) { ready = false; goto EXIT; }; 479 486 if( __cfaasm_in( ip, dsable ) ) { ready = false; goto EXIT; }; 480 if( __cfaasm_in( ip, enble ) ) { ready = false; goto EXIT; };481 if( __cfaasm_in( ip, nopoll ) ) { ready = false; goto EXIT; };482 487 if( !__cfaabi_tls.preemption_state.enabled) { ready = false; goto EXIT; }; 483 488 if( __cfaabi_tls.preemption_state.in_progress ) { ready = false; goto EXIT; }; -
libcfa/src/stdlib.hfa
ra056f56 ra0ba5e6 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 12 08:12:08 202013 // Update Count : 5 1512 // Last Modified On : Thu Nov 12 20:58:48 2020 13 // Update Count : 520 14 14 // 15 15 … … 101 101 return (T *)pvalloc( sizeof(T) ); // C pvalloc 102 102 } // pvalloc 103 104 void free( T * addr ) {105 free( (void *) addr ); // C free106 } // free107 103 } // distribution 108 104 … … 260 256 static inline forall( dtype T, ttype TT | { void free( TT ); } ) 261 257 void free( T * addr, TT rest ) { 262 free( addr );258 free( ( void *)addr ); // use C free 263 259 free( rest ); 264 260 } // free -
src/Common/Stats/ResolveTime.cc
ra056f56 ra0ba5e6 27 27 namespace ResolveTime { 28 28 static inline long long rdtscl(void) { 29 unsigned int lo, hi; 30 __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); 31 return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 ); 29 #if defined( __i386 ) || defined( __x86_64 ) 30 unsigned int lo, hi; 31 __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); 32 return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 ); 33 #elif defined( __aarch64__ ) 34 int64_t value; 35 asm volatile("mrs %0, cntvct_el0" : "=r"(value)); 36 return value; 37 #else 38 #error unknown hardware architecture 39 #endif 32 40 } 33 41 -
tests/generator/suspend_then.cfa
ra056f56 ra0ba5e6 40 40 Fibonacci f1, f2; 41 41 for ( 10 ) { // print N Fibonacci values 42 sout | next( f1 ) | next( f2 ); 42 int v1 = next( f1 ); 43 int v2 = next( f2 ); 44 sout | v1 | v2; 43 45 } // for 44 46 } -
tests/malloc.cfa
ra056f56 ra0ba5e6 319 319 free(ip); 320 320 321 free( (void *)0p ); // sanity check321 free( 0p ); // sanity check 322 322 free( NULL ); // sanity check 323 323 -
tests/pybin/tools.py
ra056f56 ra0ba5e6 73 73 ) 74 74 75 return proc.returncode, out.decode(" utf-8") if out else None75 return proc.returncode, out.decode("latin-1") if out else None 76 76 except subprocess.TimeoutExpired: 77 77 if settings.timeout2gdb: -
tests/references.cfa
ra056f56 ra0ba5e6 124 124 int *p = &a; 125 125 asm ( 126 "incl %[p]\n\t" 127 : [p] "+m" (*p) 126 #if defined( __i386 ) || defined( __x86_64 ) 127 "incl %[p]\n\t" 128 : [p] "+m" (*p) 129 #elif defined( __aarch64__ ) 130 "ldr w1, %[p]\n\t" 131 "add w1, w1, 1\n\t" 132 "str w1, %[p]\n\t" 133 : [p] "+m" (*p) ::"w1" 134 #endif 128 135 ); 129 136 printf("%d\n", a); -
tests/test.py
ra056f56 ra0ba5e6 99 99 100 100 # print a warning if it users didn't ask for a specific architecture 101 if not options.arch: 101 found_arch = [f.arch for f in found if f.arch] 102 if found_arch and not options.arch: 102 103 print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr) 103 104 104 105 105 106 # print a warning if it users didn't ask for a specific ast version 106 if not options.ast: 107 found_astv = [f.astv for f in found if f.astv] 108 if found_astv and not options.ast: 107 109 print('WARNING: "%s", test has ast version specific expected files but --ast was not specified, regenerating only for current ast' % testname, file=sys.stderr) 108 110 -
tests/tuple/tupleAssign.cfa
ra056f56 ra0ba5e6 44 44 double d = 0.0; 45 45 int i = 0; 46 char c = '\0';46 signed char c = '\0'; 47 47 struct X { 48 48 int z; … … 55 55 [t, x, d, i, c, x] = (double)94.12; 56 56 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t ); 57 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";57 sout | "d=" | d | "i=" | i | "c=" | (char)c | ' ' | "t=[" | t | "]"; 58 58 [x, c, i, d, x, t] = (double)-94.12; 59 59 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t ); 60 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";60 sout | "d=" | d | "i=" | i | "c=" | (char)c | ' ' | "t=[" | t | "]"; 61 61 } 62 62 }
Note: See TracChangeset
for help on using the changeset viewer.