Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metadata-generator): Filter according to specified black/white lists #1246

Merged
merged 2 commits into from
Jan 22, 2020

Conversation

mbektchiev
Copy link
Contributor

Each text file contains a list of patterns of the form moduleGlob:symbolGlob,
where ? and * special symbols treated as any symbol and zero or more symbols.

A symbol is whitelisted if it's module name and native name pair matches a
pattern in the whitelist, or if a whitelist file is not passed as an argument. All
symbols which are not whitelisted or match a pattern in the blacklist are
excluded from the global table of metadata symbols.

  • Update metadata-generator submodule
  • Add a blacklist.mdg file to TestRunner and symlink from the root (because
    SRCROOT of TestRunner points to the directory of the main CMakeLists.txt)
  • Add a unit test which checks for the correct filtering of metadata according to
    the rules in blacklist.mdg
  • Add test case with function returning a struct which is blacklisted
    If a struct's metadata is missing it's not possible to silently ignore it and
    perform the call, because we don't know its size and cannot reliably
    allocate the stack frame for the cif. That's why we'll abort the call and
    throw a JS exception
  • Add test case with functions returning and taking as an argument
    objects from a blacklisted class. In this scenario the behavior is the
    same as with objects from private classes
  • Use Objective-C exceptions to propagate errors when filtered
    metadata is used and handle them in JSC callbacks
  • Update metadata generator to use native names in type encodings
    to allow correct discovery of interfaces and protocols when they
    have been filtered

PR Checklist

What is the current behavior?

Metadata is generated for all discovered supported native symbols

What is the new behavior?

Metadata can be filtered by specifying a whitelist and/or blacklist in
two files residing in $(SRCROOT) (blacklist.mdg and whitelist.mdg).
Each line should be of the form module-name-pattern[:symbol-name-pattern].

refs #1209

…ists

Each text file contains a list of patterns of the form `moduleGlob:symbolGlob`,
where `?` and `*` special symbols treated as `any symbol` and `zero or
more symbols`.

A symbol is whitelisted if it's module name and native name pair matches a
pattern in the whitelist, or if a whitelist file is not passed as an argument. All
symbols which are not whitelisted or match a pattern in the blacklist are
excluded from the global table of metadata symbols.

* Update metadata-generator submodule
* Add a `blacklist.mdg` file to TestRunner and symlink from the root (because
SRCROOT of TestRunner points to the directory of the main CMakeLists.txt)
* Add a unit test which checks for the correct filtering of metadata according to
the rules in `blacklist.mdg`
* Add test case with function returning a struct which is blacklisted
If a struct's metadata is missing it's not possible to silently ignore it and
perform the call, because we don't know its size and cannot reliably
allocate the stack frame for the cif. That's why we'll abort the call and
throw a JS exception
* Add test case with functions returning and taking as an argument
objects from a blacklisted class. In this scenario the behavior is the
same as with objects from private classes
* Use Objective-C exceptions to propagate errors when filtered
metadata is used and handle them in JSC callbacks
* Update metadata generator to use native names in type encodings
to allow correct discovery of interfaces and protocols when they
have been filtered
@mbektchiev mbektchiev added this to the 6.4.0 milestone Jan 20, 2020
@mbektchiev mbektchiev self-assigned this Jan 20, 2020
@cla-bot cla-bot bot added the cla: yes label Jan 20, 2020
@mbektchiev mbektchiev merged commit 53c3cb2 into master Jan 22, 2020
@mbektchiev mbektchiev deleted the bektchiev/filter-metadata branch January 22, 2020 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants