blob: e87d389287daabe8ea1251bf4b9fd6ac046fdf0f [file] [log] [blame]
//===- RegionFactory.cpp --------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "mcld/Support/RegionFactory.h"
#include "mcld/Support/MemoryArea.h"
using namespace mcld;
//==========================
// RegionFactory
RegionFactory::RegionFactory(size_t pNum)
: GCFactory<MemoryRegion, 0>(pNum) {
}
RegionFactory::~RegionFactory()
{
}
MemoryRegion* RegionFactory::produce(MemoryArea::Space* pSpace,
const sys::fs::detail::Address pVMAStart,
size_t pSize)
{
MemoryRegion* result = Alloc::allocate();
new (result) MemoryRegion(pSpace, pVMAStart, pSize);
return result;
}
void RegionFactory::destruct(MemoryRegion* pRegion)
{
pRegion->drift();
destroy(pRegion);
deallocate(pRegion);
}