Ignore:
Timestamp:
Feb 25, 2015, 3:04:36 PM (5 years ago)
Author:
nmedfort
Message:

More memory leak fixes. All known leaks accounted for.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4510 r4516  
    105105PabloCompiler::~PabloCompiler()
    106106{
    107     // delete mMod;
     107
    108108}
    109109   
     
    113113
    114114
    115 LLVM_Gen_RetVal PabloCompiler::compile(PabloBlock & pb)
     115CompiledPabloFunction PabloCompiler::compile(PabloBlock & pb)
    116116{
    117117    mNestingDepth = 0;
     
    194194    mExecutionEngine->finalizeObject();
    195195
    196     LLVM_Gen_RetVal retVal;
    197196    //Return the required size of the carry queue and a pointer to the process_block function.
    198     retVal.carry_q_size = mCarryQueueSize;
    199     retVal.advance_q_size = mAdvanceQueueSize;
    200     retVal.process_block_fptr = mExecutionEngine->getPointerToFunction(mFunction);
    201 
    202     return retVal;
     197    return CompiledPabloFunction(mCarryQueueSize, mAdvanceQueueSize, mFunction, mExecutionEngine);
    203198}
    204199
     
    10921087}
    10931088
    1094 }
     1089CompiledPabloFunction::CompiledPabloFunction(unsigned carryQSize, unsigned advanceQSize, Function * function, ExecutionEngine * executionEngine)
     1090: CarryQueueSize(carryQSize)
     1091, AdvanceQueueSize(advanceQSize)
     1092, FunctionPointer(executionEngine->getPointerToFunction(function))
     1093, mFunction(function)
     1094, mExecutionEngine(executionEngine)
     1095{
     1096
     1097}
     1098
     1099// Clean up the memory for the compiled function once we're finished using it.
     1100CompiledPabloFunction::~CompiledPabloFunction() {
     1101    if (mExecutionEngine) {
     1102        assert (mFunction);
     1103        // mExecutionEngine->freeMachineCodeForFunction(mFunction); // This function only prints a "not supported" message. Reevaluate with LLVM 3.6.
     1104        delete mExecutionEngine;
     1105    }
     1106}
     1107
     1108}
Note: See TracChangeset for help on using the changeset viewer.