Пример #1
0
void BakerGc::finalize(GarbageCollectableInterface * objPtr)
{
	if (objPtr->requiresFinalization())
	{
		Method* method = objPtr->getFinalizationMethod();

		if (method->isNative())
		{
			method->nativeMethod((Object*)objPtr, engine);
		}
		else
		{
			unsigned char* frameMemory = this->allocate(MethodFrame::getMemorySize(method->operandStackSize, method->localVariablesArraySize));
			MethodFrame * frame = new(frameMemory) MethodFrame(method->operandStackSize, method->localVariablesArraySize,
			this->runtime->executionEngine->getCurrentMethodFrame(), method->classPtr->constantPool, method, NULL);

			this->runtime->executionEngine->execute(frame);
		}
	}
}