MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / setup

Method setup

src/runtime/context.cpp:74–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 }
73
74 void Context::setup(int totalVars, uint32_t globalStringHeapSize, CodeOfPolicies policies, AnnotationArgumentList options) {
75 verySafeContext = options.getBoolOption("very_safe_context",policies.very_safe_context);
76 breakOnException |= policies.debugger;
77 gcEnabled = options.getBoolOption("gc", false);
78 gcLogTime = options.getBoolOption("log_gc_time", policies.log_gc_time);
79 persistent = options.getBoolOption("persistent_heap", policies.persistent_heap);
80 if ( persistent ) {
81 heap = make_unique<PersistentHeapAllocator>();
82 stringHeap = make_unique<PersistentStringAllocator>();
83 } else {
84 heap = make_unique<LinearHeapAllocator>();
85 stringHeap = make_unique<LinearStringAllocator>();
86 }
87 heap->setInitialSize ( options.getIntOption("heap_size_hint", policies.heap_size_hint) );
88 heap->setLimit ( options.getUInt64OptionEx("heap_size_limit", "max_heap_allocated", policies.max_heap_allocated) );
89 stringHeap->setInitialSize ( options.getIntOption("string_heap_size_hint", policies.string_heap_size_hint) );
90 stringHeap->setLimit ( options.getUInt64OptionEx("string_heap_size_limit", "max_string_heap_allocated", policies.max_string_heap_allocated) );
91 bool track = options.getBoolOption("track_allocations", policies.track_allocations);
92 heap->setTrackAllocations(track);
93 stringHeap->setTrackAllocations(track);
94 constStringHeap = make_shared<ConstStringAllocator>();
95 totalVariables = totalVars;
96 if ( globalStringHeapSize ) {
97 constStringHeap->setInitialSize(globalStringHeapSize);
98 }
99 globalVariables = (GlobalVariable *) code->allocate( uint32_t(totalVars*sizeof(GlobalVariable)) );
100 globalsSize = 0;
101 sharedSize = 0;
102 }
103
104 void Context::strip() {
105 stringHeap.reset();

Callers 1

JitContextMethod · 0.80

Calls 6

getBoolOptionMethod · 0.80
getIntOptionMethod · 0.80
getUInt64OptionExMethod · 0.80
setTrackAllocationsMethod · 0.80
setInitialSizeMethod · 0.45
allocateMethod · 0.45

Tested by

no test coverage detected