-
Notifications
You must be signed in to change notification settings - Fork 140
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
Avoid MemoryManager allocations for constant strings #648
Comments
Hello, I would like to work on this issue. Could you please help me in getting started with this? |
First step is to get a feel for how the code generator works. All code generator related code is in
You can find the generated These debugging options will be useful when debugging code generator changes as well. When making changes to the code generator, make sure you run:
Feel free to ask more questions if you get stuck! |
@rahulmutt I am trying to get my head around solving this issue. I have currently generated the dump code and realized the task.
I am unable to get where to find the above packages in the codebase though. Can you give some suggestions? |
@betterclever Look inside So the first step toward achieving this might be to write the method inside of The key thing to note here is that when you compile java files with the Eta compiler (by specifying a Note that in this case |
The code:
generates
We should pattern match on the express above at the STG (code generator) level and perform a direct conversion from
java.lang.String
to Eta's list type[]
.[1] = 1 : [] = (:) 1 []
is the same asnew ZC(new Izh(1), DZMZN())
. whereZC
is defined inghc_prim.ghc.types.datacons.ZC
andDZMZN()
is defined inghc_prim.ghc.Types
. Thus, one can define a method on the Java side that performs the conversion. The code generator should call this method instead.The main thing to look for is
unpackCString#
with a literal string argument. If it has a variable argument, we cannot make this optimization. This most likely requires a special case incgIdApp
in the codegen.The text was updated successfully, but these errors were encountered: