Changeset 1b5c81ed
- Timestamp:
- Jun 30, 2016, 4:20:53 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- f80e0218
- Parents:
- 34b76a8
- Location:
- src/examples/gc_no_raii/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/src/internal/globals.h
r34b76a8 r1b5c81ed 16 16 // static const size_t OBJECT_PTR_MASK = ~(OBJECT_ALLIGNMENT - 1); 17 17 18 enum { 19 POOL_SIZE_EXP = 24, 20 POOL_SIZE_BYTES = 0x1 << POOL_SIZE_EXP, 21 POOL_PTR_MASK = ~(POOL_SIZE_BYTES - 1), 18 22 19 #define POOL_SIZE_EXP 24 20 #define POOL_SIZE_BYTES 0x1 << POOL_SIZE_EXP 21 #define POOL_PTR_MASK ~(POOL_SIZE_BYTES - 1) 23 CARDS_SIZE_EXP = 12, 24 CARDS_SIZE_BYTES = 0x1 << CARDS_SIZE_EXP, 25 CARDS_OFFSET_MASK = (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1), 26 CARDS_COUNT = POOL_SIZE_BYTES / CARDS_SIZE_BYTES, 22 27 23 #define CARDS_SIZE_EXP 12 24 #define CARDS_SIZE_BYTES 0x1 << CARDS_SIZE_EXP 25 #define CARDS_OFFSET_MASK (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1) 26 #define CARDS_COUNT POOL_SIZE_BYTES / CARDS_SIZE_BYTES 27 28 #define OBJECT_ALLIGNMENT sizeof(size_t) 29 #define OBJECT_PTR_MASK ~(OBJECT_ALLIGNMENT - 1) 28 OBJECT_ALLIGNMENT = sizeof(size_t), 29 OBJECT_PTR_MASK = ~(OBJECT_ALLIGNMENT - 1), 30 }; -
src/examples/gc_no_raii/src/internal/object_header.h
r34b76a8 r1b5c81ed 1 1 #pragma once 2 2 3 #include <stdbool.h> 3 4 #include <stddef.h> 4 5 #include <stdint.h> -
src/examples/gc_no_raii/src/internal/state.c
r34b76a8 r1b5c81ed 26 26 #endif 27 27 28 static gc_state s; 29 28 30 gc_state* gc_get_state() 29 31 { 30 static gc_state s;31 32 if(!s.is_initialized) ctor(&s); 32 33 return &s; -
src/examples/gc_no_raii/src/vector.c
r34b76a8 r1b5c81ed 64 64 inline void realloc(heap_allocator(T) *const this, size_t size) 65 65 { 66 static const size_t GROWTH_RATE = 2;66 enum { GROWTH_RATE = 2 }; 67 67 if(size > this->capacity) 68 68 {
Note: See TracChangeset
for help on using the changeset viewer.