Ignore:
Timestamp:
Jul 2, 2017, 10:35:03 AM (23 months ago)
Author:
cameron
Message:

Deallocating dynamic buffers

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5543 r5544  
    156156}
    157157
    158 void StreamSetBuffer::releaseBuffer(IDISA::IDISA_Builder * const /* iBuilder */, Value * /* self */) const {
     158void StreamSetBuffer::releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & /* kb */) const {
    159159    /* do nothing: memory is stack allocated */
    160160}
     
    515515}
    516516
    517 void ExpandableBuffer::releaseBuffer(IDISA::IDISA_Builder * const iBuilder, Value * self) const {
    518     iBuilder->CreateFree(getBaseAddress(iBuilder, self));
     517void ExpandableBuffer::releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & b) const {
     518    b->CreateFree(getBaseAddress(b.get(), mStreamSetBufferPtr));
    519519}
    520520
     
    643643}
    644644
    645 void DynamicBuffer::releaseBuffer(IDISA::IDISA_Builder * const b, Value * handle) const {
     645void DynamicBuffer::releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & b) const {
    646646    /* Free the dynamically allocated buffer, but not the stack-allocated buffer struct. */
    647     b->CreateFree(b->CreateLoad(b->CreateGEP(handle, {b->getInt32(0), b->getInt32(int(DynamicBuffer::Field::BaseAddress))})));
     647    b->CreateFree(b->CreateLoad(b->CreateGEP(mStreamSetBufferPtr, {b->getInt32(0), b->getInt32(int(DynamicBuffer::Field::BaseAddress))})));
    648648}
    649649
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5542 r5544  
    6060    virtual llvm::Type * getStreamSetBlockType() const;
    6161   
    62     virtual void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
    63 
    64     virtual void releaseBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
     62    virtual void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & kb);
     63
     64    virtual void releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & kb) const;
    6565
    6666    virtual llvm::Value * getStreamBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const;
     
    280280    llvm::Value * getStreamSetCount(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
    281281
    282     void releaseBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
     282    void releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & kb) const override;
    283283
    284284protected:
     
    311311    void allocateBuffer(const std::unique_ptr<kernel::KernelBuilder> & b) override;
    312312
    313     void releaseBuffer(IDISA::IDISA_Builder * const b, llvm::Value * handle) const override;
     313    void releaseBuffer(const std::unique_ptr<kernel::KernelBuilder> & kb) const override;
    314314
    315315    llvm::Value * getRawItemPointer(IDISA::IDISA_Builder * const b, llvm::Value * handle, llvm::Value * streamIndex, llvm::Value * absolutePosition) const override;
Note: See TracChangeset for help on using the changeset viewer.