Skip to content

feat: Add __getFunction method for loader #2037

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

Merged
merged 14 commits into from
Sep 4, 2021

Conversation

MaxGraey
Copy link
Member

@MaxGraey MaxGraey commented Aug 16, 2021

Also some refactoring and code reusage

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@MaxGraey MaxGraey changed the title [feat] Add __getFunction method for loader feat: Add __getFunction method for loader Aug 16, 2021
@MaxGraey MaxGraey requested a review from dcodeIO August 16, 2021 17:59
@MaxGraey MaxGraey requested a review from dcodeIO August 16, 2021 21:35
Comment on lines +49 to +51
Object.hasOwn = Object.hasOwn || function(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaxGraey MaxGraey merged commit b0549e0 into AssemblyScript:main Sep 4, 2021
@MaxGraey MaxGraey deleted the loader-get-function branch September 4, 2021 08:53
if (!table) throw Error(E_NO_EXPORT_TABLE);
const index = new Uint32Array(memory.buffer)[ptr >>> 2];
return table.get(index);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this slower than passing the fn.index from AS to JS? It could be

  function __getFunction(index) {
    if (!table) throw Error(E_NO_EXPORT_TABLE);
    return table.get(index);
  }

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.

3 participants