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

Add support for context in nback.llvm #114

Closed
heshanpadmasiri opened this issue Jun 21, 2021 · 1 comment · Fixed by #120
Closed

Add support for context in nback.llvm #114

heshanpadmasiri opened this issue Jun 21, 2021 · 1 comment · Fixed by #120
Assignees
Milestone

Comments

@heshanpadmasiri
Copy link
Member

@jclark for this I am thinking of adding fallowing to the public API

  1. Public record type Context to represent LLVMContextRef. Initially this can be an empty place holder since we only need this to have API similar to what we get with Implement API of nback.llvm using LLVM C API via JNI #19.
  2. Public function createContext() returns Context similar to https://llvm.org/doxygen/group__LLVMCCoreContext.html#gaac4f39a2d0b9735e64ac7681ab543b4c.
  3. All public constructors (Module, Builder) will take Context as their first argument(Java api needs a name for module as well so I'll modify our constructor to take an optional name parameter)
  4. Other constructors such as those for functions will get the context from the parent (module in the case of function)

I am assuming when it comes for types we can ignore the context even though we use it in other places (ex for i64 use LLVMInt64Type instead of LLVMInt64TypeInContext in the C api. If not constant constructors (ex:intConst) will also need Context as an argument. (In otherplaces we should be able to get the context from parent (In most cases builder)).

@jclark
Copy link
Contributor

jclark commented Jun 22, 2021

Sorry, I didn't get to this earlier: I was busy with #94.

This is not quite right:

  • item 1 should be a class (not distinct)
  • item 2 should be a public constructor of the class
  • items in 3 should be done by createXXX method calls on Context, with the corresponding constructor no longer public

For types, you would need to make the appropriate calls to the C api with a context to construct the Ballerina type values.

jclark pushed a commit that referenced this issue Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants