Changeset 5b7a60c8
- Timestamp:
- Aug 18, 2016, 5:00:32 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, 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:
- 12756de
- Parents:
- 99cad3aa (diff), 7ecbb7e (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. - Location:
- src
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r99cad3aa r5b7a60c8 49 49 } 50 50 51 template< typename T, typename U > 52 static inline T * maybeMoveBuild( const U *orig ) { 53 T* ret = maybeBuild<T>(orig); 54 delete orig; 55 return ret; 56 } 57 58 51 59 template< typename Input_iterator > 52 60 void printEnums( Input_iterator begin, Input_iterator end, const char * const *name_array, std::ostream &os ) { -
src/Parser/ExpressionNode.cc
r99cad3aa r5b7a60c8 167 167 168 168 NameExpr * build_varref( const string *name, bool labelp ) { 169 return new NameExpr( *name, nullptr ); 169 NameExpr *expr = new NameExpr( *name, nullptr ); 170 delete name; 171 return expr; 170 172 } 171 173 … … 184 186 if ( dynamic_cast< VoidType * >( targetType ) ) { 185 187 delete targetType; 186 return new CastExpr( maybe Build< Expression >(expr_node) );188 return new CastExpr( maybeMoveBuild< Expression >(expr_node) ); 187 189 } else { 188 return new CastExpr( maybe Build< Expression >(expr_node), targetType );190 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType ); 189 191 } // if 190 192 } 191 193 192 194 Expression *build_fieldSel( ExpressionNode *expr_node, NameExpr *member ) { 193 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybe Build< Expression >(expr_node) );195 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybeMoveBuild< Expression >(expr_node) ); 194 196 delete member; 195 197 return ret; … … 198 200 Expression *build_pfieldSel( ExpressionNode *expr_node, NameExpr *member ) { 199 201 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 200 deref->get_args().push_back( maybe Build< Expression >(expr_node) );202 deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) ); 201 203 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref ); 202 204 delete member; … … 205 207 206 208 Expression *build_addressOf( ExpressionNode *expr_node ) { 207 return new AddressExpr( maybe Build< Expression >(expr_node) );209 return new AddressExpr( maybeMoveBuild< Expression >(expr_node) ); 208 210 } 209 211 Expression *build_sizeOfexpr( ExpressionNode *expr_node ) { 210 return new SizeofExpr( maybe Build< Expression >(expr_node) );212 return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) ); 211 213 } 212 214 Expression *build_sizeOftype( DeclarationNode *decl_node ) { … … 214 216 } 215 217 Expression *build_alignOfexpr( ExpressionNode *expr_node ) { 216 return new AlignofExpr( maybe Build< Expression >(expr_node) );218 return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) ); 217 219 } 218 220 Expression *build_alignOftype( DeclarationNode *decl_node ) { … … 224 226 225 227 Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind ) { 226 return new LogicalExpr( notZeroExpr( maybe Build< Expression >(expr_node1) ), notZeroExpr( maybeBuild< Expression >(expr_node2) ), kind );228 return new LogicalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), notZeroExpr( maybeMoveBuild< Expression >(expr_node2) ), kind ); 227 229 } 228 230 229 231 Expression *build_unary_val( OperKinds op, ExpressionNode *expr_node ) { 230 232 std::list< Expression * > args; 231 args.push_back( maybe Build< Expression >(expr_node) );233 args.push_back( maybeMoveBuild< Expression >(expr_node) ); 232 234 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); 233 235 } 234 236 Expression *build_unary_ptr( OperKinds op, ExpressionNode *expr_node ) { 235 237 std::list< Expression * > args; 236 args.push_back( new AddressExpr( maybe Build< Expression >(expr_node) ) );238 args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) ); 237 239 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); 238 240 } 239 241 Expression *build_binary_val( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) { 240 242 std::list< Expression * > args; 241 args.push_back( maybe Build< Expression >(expr_node1) );242 args.push_back( maybe Build< Expression >(expr_node2) );243 args.push_back( maybeMoveBuild< Expression >(expr_node1) ); 244 args.push_back( maybeMoveBuild< Expression >(expr_node2) ); 243 245 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); 244 246 } 245 247 Expression *build_binary_ptr( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) { 246 248 std::list< Expression * > args; 247 args.push_back( new AddressExpr( maybe Build< Expression >(expr_node1) ) );248 args.push_back( maybe Build< Expression >(expr_node2) );249 args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1) ) ); 250 args.push_back( maybeMoveBuild< Expression >(expr_node2) ); 249 251 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); 250 252 } 251 253 252 254 Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 ) { 253 return new ConditionalExpr( notZeroExpr( maybe Build< Expression >(expr_node1) ), maybeBuild< Expression >(expr_node2), maybeBuild< Expression >(expr_node3) );255 return new ConditionalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), maybeMoveBuild< Expression >(expr_node2), maybeMoveBuild< Expression >(expr_node3) ); 254 256 } 255 257 256 258 Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) { 257 return new CommaExpr( maybe Build< Expression >(expr_node1), maybeBuild< Expression >(expr_node2) );259 return new CommaExpr( maybeMoveBuild< Expression >(expr_node1), maybeMoveBuild< Expression >(expr_node2) ); 258 260 } 259 261 260 262 Expression *build_attrexpr( NameExpr *var, ExpressionNode * expr_node ) { 261 return new AttrExpr( var, maybe Build< Expression >(expr_node) );263 return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) ); 262 264 } 263 265 Expression *build_attrtype( NameExpr *var, DeclarationNode * decl_node ) { … … 267 269 Expression *build_tuple( ExpressionNode * expr_node ) { 268 270 TupleExpr *ret = new TupleExpr(); 269 build List( expr_node, ret->get_exprs() );271 buildMoveList( expr_node, ret->get_exprs() ); 270 272 return ret; 271 273 } … … 273 275 Expression *build_func( ExpressionNode * function, ExpressionNode * expr_node ) { 274 276 std::list< Expression * > args; 275 276 buildList( expr_node, args ); 277 return new UntypedExpr( maybeBuild< Expression >(function), args, nullptr ); 277 buildMoveList( expr_node, args ); 278 return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr ); 278 279 } 279 280 280 281 Expression *build_range( ExpressionNode * low, ExpressionNode *high ) { 281 Expression *low_cexpr = maybeBuild< Expression >( low ); 282 Expression *high_cexpr = maybeBuild< Expression >( high ); 283 return new RangeExpr( low_cexpr, high_cexpr ); 282 return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) ); 284 283 } 285 284 286 285 Expression *build_asmexpr( ExpressionNode *inout, ConstantExpr *constraint, ExpressionNode *operand ) { 287 return new AsmExpr( maybe Build< Expression >( inout ), constraint, maybeBuild< Expression >(operand) );286 return new AsmExpr( maybeMoveBuild< Expression >( inout ), constraint, maybeMoveBuild< Expression >(operand) ); 288 287 } 289 288 290 289 Expression *build_valexpr( StatementNode *s ) { 291 return new UntypedValofExpr( maybe Build< Statement >(s), nullptr );290 return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr ); 292 291 } 293 292 Expression *build_typevalue( DeclarationNode *decl ) { … … 298 297 Declaration * newDecl = maybeBuild< Declaration >(decl_node); // compound literal type 299 298 if ( DeclarationWithType * newDeclWithType = dynamic_cast< DeclarationWithType * >( newDecl ) ) { // non-sue compound-literal type 300 return new CompoundLiteralExpr( newDeclWithType->get_type(), maybe Build< Initializer >(kids) );299 return new CompoundLiteralExpr( newDeclWithType->get_type(), maybeMoveBuild< Initializer >(kids) ); 301 300 // these types do not have associated type information 302 301 } else if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( newDecl ) ) { 303 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybe Build< Initializer >(kids) );302 return new CompoundLiteralExpr( new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 304 303 } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( newDecl ) ) { 305 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybe Build< Initializer >(kids) );304 return new CompoundLiteralExpr( new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 306 305 } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( newDecl ) ) { 307 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybe Build< Initializer >(kids) );306 return new CompoundLiteralExpr( new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ), maybeMoveBuild< Initializer >(kids) ); 308 307 } else { 309 308 assert( false ); -
src/Parser/ParseNode.h
r99cad3aa r5b7a60c8 387 387 void buildTypeList( const DeclarationNode *firstNode, std::list< Type * > &outputList ); 388 388 389 template< typename SynTreeType, typename NodeType > 390 void buildMoveList( const NodeType *firstNode, std::list< SynTreeType * > &outputList ) { 391 buildList(firstNode, outputList); 392 delete firstNode; 393 } 394 395 389 396 #endif // PARSENODE_H 390 397 -
src/Parser/StatementNode.cc
r99cad3aa r5b7a60c8 62 62 StatementNode *node = dynamic_cast< StatementNode * >(prev); 63 63 std::list< Statement * > stmts; 64 build List( stmt, stmts );64 buildMoveList( stmt, stmts ); 65 65 // splice any new Statements to end of current Statements 66 66 CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt); … … 70 70 71 71 Statement *build_expr( ExpressionNode *ctl ) { 72 Expression *e = maybe Build< Expression >( ctl );72 Expression *e = maybeMoveBuild< Expression >( ctl ); 73 73 74 74 if ( e ) … … 81 81 Statement *thenb, *elseb = 0; 82 82 std::list< Statement * > branches; 83 build List< Statement, StatementNode >( then_stmt, branches );83 buildMoveList< Statement, StatementNode >( then_stmt, branches ); 84 84 assert( branches.size() == 1 ); 85 85 thenb = branches.front(); … … 87 87 if ( else_stmt ) { 88 88 std::list< Statement * > branches; 89 build List< Statement, StatementNode >( else_stmt, branches );89 buildMoveList< Statement, StatementNode >( else_stmt, branches ); 90 90 assert( branches.size() == 1 ); 91 91 elseb = branches.front(); 92 92 } // if 93 return new IfStmt( noLabels, notZeroExpr( maybe Build< Expression >(ctl) ), thenb, elseb );93 return new IfStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), thenb, elseb ); 94 94 } 95 95 96 96 Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ) { 97 97 std::list< Statement * > branches; 98 build List< Statement, StatementNode >( stmt, branches );98 buildMoveList< Statement, StatementNode >( stmt, branches ); 99 99 assert( branches.size() >= 0 ); // size == 0 for switch (...) {}, i.e., no declaration or statements 100 return new SwitchStmt( noLabels, maybe Build< Expression >(ctl), branches );100 return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches ); 101 101 } 102 102 Statement *build_case( ExpressionNode *ctl ) { 103 103 std::list< Statement * > branches; 104 return new CaseStmt( noLabels, maybe Build< Expression >(ctl), branches );104 return new CaseStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches ); 105 105 } 106 106 Statement *build_default() { … … 111 111 Statement *build_while( ExpressionNode *ctl, StatementNode *stmt, bool kind ) { 112 112 std::list< Statement * > branches; 113 build List< Statement, StatementNode >( stmt, branches );113 buildMoveList< Statement, StatementNode >( stmt, branches ); 114 114 assert( branches.size() == 1 ); 115 return new WhileStmt( noLabels, notZeroExpr( maybe Build< Expression >(ctl) ), branches.front(), kind );115 return new WhileStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind ); 116 116 } 117 117 118 118 Statement *build_for( ForCtl *forctl, StatementNode *stmt ) { 119 119 std::list< Statement * > branches; 120 build List< Statement, StatementNode >( stmt, branches );120 buildMoveList< Statement, StatementNode >( stmt, branches ); 121 121 assert( branches.size() == 1 ); 122 122 123 123 std::list< Statement * > init; 124 124 if ( forctl->init != 0 ) { 125 build List( forctl->init, init );125 buildMoveList( forctl->init, init ); 126 126 } // if 127 127 128 128 Expression *cond = 0; 129 129 if ( forctl->condition != 0 ) 130 cond = notZeroExpr( maybe Build< Expression >(forctl->condition) );130 cond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) ); 131 131 132 132 Expression *incr = 0; 133 133 if ( forctl->change != 0 ) 134 incr = maybe Build< Expression >(forctl->change);134 incr = maybeMoveBuild< Expression >(forctl->change); 135 135 136 136 delete forctl; … … 142 142 } 143 143 Statement *build_computedgoto( ExpressionNode *ctl ) { 144 return new BranchStmt( noLabels, maybe Build< Expression >(ctl), BranchStmt::Goto );144 return new BranchStmt( noLabels, maybeMoveBuild< Expression >(ctl), BranchStmt::Goto ); 145 145 } 146 146 147 147 Statement *build_return( ExpressionNode *ctl ) { 148 148 std::list< Expression * > exps; 149 build List( ctl, exps );149 buildMoveList( ctl, exps ); 150 150 return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr ); 151 151 } 152 152 Statement *build_throw( ExpressionNode *ctl ) { 153 153 std::list< Expression * > exps; 154 build List( ctl, exps );154 buildMoveList( ctl, exps ); 155 155 return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr, true ); 156 156 } … … 158 158 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) { 159 159 std::list< Statement * > branches; 160 build List< Statement, StatementNode >( catch_stmt, branches );161 CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybe Build< Statement >(try_stmt));160 buildMoveList< Statement, StatementNode >( catch_stmt, branches ); 161 CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 162 162 assert( tryBlock ); 163 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybe Build< Statement >(finally_stmt) );163 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 164 164 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); 165 165 } 166 166 Statement *build_catch( DeclarationNode *decl, StatementNode *stmt, bool catchAny ) { 167 167 std::list< Statement * > branches; 168 build List< Statement, StatementNode >( stmt, branches );168 buildMoveList< Statement, StatementNode >( stmt, branches ); 169 169 assert( branches.size() == 1 ); 170 return new CatchStmt( noLabels, maybe Build< Declaration >(decl), branches.front(), catchAny );170 return new CatchStmt( noLabels, maybeMoveBuild< Declaration >(decl), branches.front(), catchAny ); 171 171 } 172 172 Statement *build_finally( StatementNode *stmt ) { 173 173 std::list< Statement * > branches; 174 build List< Statement, StatementNode >( stmt, branches );174 buildMoveList< Statement, StatementNode >( stmt, branches ); 175 175 assert( branches.size() == 1 ); 176 176 return new FinallyStmt( noLabels, dynamic_cast< CompoundStmt * >( branches.front() ) ); … … 179 179 Statement *build_compound( StatementNode *first ) { 180 180 CompoundStmt *cs = new CompoundStmt( noLabels ); 181 build List( first, cs->get_kids() );181 buildMoveList( first, cs->get_kids() ); 182 182 return cs; 183 183 } … … 187 187 std::list< ConstantExpr * > clob; 188 188 189 build List( output, out );190 build List( input, in );191 build List( clobber, clob );189 buildMoveList( output, out ); 190 buildMoveList( input, in ); 191 buildMoveList( clobber, clob ); 192 192 return new AsmStmt( noLabels, voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels ); 193 193 } -
src/examples/gc_no_raii/premake4.lua
r99cad3aa r5b7a60c8 6 6 "src/", 7 7 "../", 8 "containers/" 8 9 } 9 10 … … 48 49 linkoptions (linkOptionList) 49 50 includedirs (includeDirList) 50 files { "src/**.c" }51 files { "src/**.c", "containers/**.c" } 51 52 52 53 configuration "debug" -
src/examples/gc_no_raii/src/gc.h
r99cad3aa r5b7a60c8 4 4 #include "internal/collector.h" 5 5 6 forall(otype T)7 static inline gcpointer(T) gcmalloc()8 {9 gcpointer(T) ptr = { gc_allocate(sizeof(T)) };10 ptr{};11 gc_conditional_collect();12 return ptr;13 }6 // forall(otype T) 7 // static inline gcpointer(T) gcmalloc() 8 // { 9 // gcpointer(T) ptr = { gc_allocate(sizeof(T)) }; 10 // ptr{}; 11 // gc_conditional_collect(); 12 // return ptr; 13 // } 14 14 15 15 forall(otype T) 16 16 static inline void gcmalloc(gcpointer(T)* ptr) 17 17 { 18 ptr { gc_allocate(sizeof(T)) };19 (*ptr){};18 ptr { gc_allocate(sizeof(T)) }; 19 get(ptr) {}; 20 20 gc_conditional_collect(); 21 21 } -
src/examples/gc_no_raii/src/gcpointers.c
r99cad3aa r5b7a60c8 42 42 } 43 43 44 void gcpointer_ctor(gcpointer_t* this)44 void ?{}(gcpointer_t* this) 45 45 { 46 46 this->ptr = (intptr_t)NULL; … … 48 48 } 49 49 50 void gcpointer_ctor(gcpointer_t* this, void* address)50 void ?{}(gcpointer_t* this, void* address) 51 51 { 52 52 this->ptr = (intptr_t)address; … … 56 56 } 57 57 58 void gcpointer_ctor(gcpointer_t* this, gcpointer_t*other)58 void ?{}(gcpointer_t* this, gcpointer_t other) 59 59 { 60 this->ptr = other ->ptr;60 this->ptr = other.ptr; 61 61 this->next = NULL; 62 62 … … 64 64 } 65 65 66 void gcpointer_dtor(gcpointer_t* this)66 void ^?{}(gcpointer_t* this) 67 67 { 68 68 unregister_ptr(this); … … 98 98 return this->ptr == (intptr_t)NULL; 99 99 } 100 101 forall(otype T) void ?{}(gcpointer(T)* this) { 102 (&this->internal) {}; 103 } 104 105 forall(otype T) void ?{}(gcpointer(T)* this, void* address) { 106 (&this->internal) { address }; 107 } 108 109 forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other) { 110 (&this->internal) { other->internal }; 111 } 112 113 forall(otype T) void ^?{}(gcpointer(T)* this) { 114 ^?{}(&this->internal); 115 } 116 117 // forall(otype T) gcpointer(T) ?=?(gcpointer(T) this, gcpointer(T) rhs); 118 // 119 // forall(otype T) T *?(gcpointer(T) this); 120 121 forall(otype T) T* get(gcpointer(T)* this) { 122 return (T*)this->internal.ptr; 123 } 124 // 125 // //Logical operators 126 // forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs); 127 // forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs); -
src/examples/gc_no_raii/src/gcpointers.h
r99cad3aa r5b7a60c8 30 30 forall(otype T) void ?{}(gcpointer(T)* this); 31 31 forall(otype T) void ?{}(gcpointer(T)* this, void* address); 32 forall(otype T) void ctor(gcpointer(T)* this, void* address);33 32 forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other); 34 33 forall(otype T) void ^?{}(gcpointer(T)* this); … … 37 36 38 37 forall(otype T) T *?(gcpointer(T) this); 38 forall(otype T) T* get(gcpointer(T)* this); 39 39 40 40 //Logical operators -
src/examples/gc_no_raii/src/internal/collector.c
r99cad3aa r5b7a60c8 8 8 } 9 9 #endif 10 11 #include <fstream> 10 12 11 13 #include "state.h" … … 36 38 void* gc_allocate(size_t target_size) 37 39 { 40 sout | "Allocating " | target_size | " bytes" | endl; 41 38 42 size_t size = gc_compute_size(target_size + sizeof(gc_object_header)); 43 44 sout | "Object header size: " | sizeof(gc_object_header) | " bytes" | endl; 45 sout | "Actual allocation size: " | size | " bytes" | endl; 39 46 40 47 check(size < POOL_SIZE_BYTES); -
src/examples/gc_no_raii/src/internal/state.h
r99cad3aa r5b7a60c8 9 9 } 10 10 #endif 11 #include <fstream> 11 12 #include <vector> 12 13 … … 37 38 static inline bool gc_needs_collect(gc_state* state) 38 39 { 40 sout | "Used Space: " | state->used_space | " bytes" | endl; 39 41 return state->used_space * 2 > state->total_space; 40 42 } -
src/examples/gc_no_raii/test/gctest.c
r99cad3aa r5b7a60c8 2 2 3 3 #include "gc.h" 4 #include "internal/collector.h" 4 5 5 6 #warning default test … … 8 9 sout | "Bonjour au monde!\n"; 9 10 10 for(int i = 0; i < 1000000; i++) { 11 gcpointer(int) anInt; 12 gcmalloc(&anInt); 11 gcpointer(int) theInt; 12 gcmalloc(&theInt); 13 14 for(int i = 0; i < 10; i++) { 15 int a; 16 { 17 gcpointer(int) anInt; 18 gcmalloc(&anInt); 19 } 20 int p; 13 21 } 22 23 gc_collect(gc_get_state()); 24 gc_conditional_collect(); 14 25 }
Note: See TracChangeset
for help on using the changeset viewer.