Bug 162055 - Improve binding generator organization
Summary: Improve binding generator organization
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-16 01:10 PDT by youenn fablet
Modified: 2016-11-16 14:53 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-09-16 01:10:15 PDT
The binding generator current organization makes it hard to fully grasp all logic.
It would be good to refactor it so as to ease understanding and improving of this code.
Comment 1 youenn fablet 2016-09-16 01:18:05 PDT
The python generators have a more modular approach. Maybe this could be a source of inspiration.

There might be some initial steps we could do like:
- Have separate files for generating headers, generating sources and common utilities
- Further split into dedicated files for specific generation steps like constructor generation
- Have specific dedicated steps, like a single place where all includes would be done for headers, another for the sources includes.
- Extract the template CPP code to some places so that the script logic is easier to understand

It may also help if we would like to switch progressively to python for this code generator.
Comment 2 youenn fablet 2016-09-16 01:18:30 PDT
This bug entry is more a meta bug for improvement ideas actually.
Comment 3 BJ Burg 2016-09-16 09:19:40 PDT
If we want to do this, I recommend switching piece at a time, by handling one particular output file, getting it to work incrementally for all input cases, then expanding out from there.

One big problem is that as far as I know, all of our IDL parsing is in Perl, and the rest of code generation is predicated on being able to parse the IDL files. Is there some Python library we can use to parse IDL? Or is there a workable intermediate format we can use to shim IDLParser.pm to Python code generators?
Comment 4 Chris Dumez 2016-09-16 09:22:49 PDT
(In reply to comment #3)
> If we want to do this, I recommend switching piece at a time, by handling
> one particular output file, getting it to work incrementally for all input
> cases, then expanding out from there.
> 
> One big problem is that as far as I know, all of our IDL parsing is in Perl,
> and the rest of code generation is predicated on being able to parse the IDL
> files. Is there some Python library we can use to parse IDL? Or is there a
> workable intermediate format we can use to shim IDLParser.pm to Python code
> generators?

Rewriting our bindings generator in Python would be huge effort and would probably not bring huge benefits. I would much rather we improve / clean our current generator (I do agree its needs clean up / refactoring).
Comment 5 BJ Burg 2016-09-16 09:56:26 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > If we want to do this, I recommend switching piece at a time, by handling
> > one particular output file, getting it to work incrementally for all input
> > cases, then expanding out from there.
> > 
> > One big problem is that as far as I know, all of our IDL parsing is in Perl,
> > and the rest of code generation is predicated on being able to parse the IDL
> > files. Is there some Python library we can use to parse IDL? Or is there a
> > workable intermediate format we can use to shim IDLParser.pm to Python code
> > generators?
> 
> Rewriting our bindings generator in Python would be huge effort and would
> probably not bring huge benefits. I would much rather we improve / clean our
> current generator (I do agree its needs clean up / refactoring).

I agree, especially since so many people are familiar with the current thing. I was able to rewrite some other generators because < 5 people ever knew how they worked. ;-)