Skip to content

Allow interface method calls to be inlined #11

@gprossliner

Description

@gprossliner

Currently the cobj generator declare a function in the .h file of the interface, and the implementation is in the interface-registry file, like:

// in interface.h
int interface_foo(interface * self, int j);

// in interface_registry.c
int interface_foo(interface * self, int j)
{
   return self->mt->foo(self->object, j);
}

This "forwarder" method could be inlined by the compiler, if the cobj generator would emit it with the "inline" keyword in the header. This would have this advantages:

  • it would reduce the overhead of calling an cobj interface method for one function call
  • if we could just use default references (see Consider "Default References" #10), then we would not need queryinterface at all, allowing us also to get rid of the interface-descriptor, and so get rid of the interface_registry completely.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions