You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The get*() series of methods are used to access the fields of a data constructor by index, used by selector thunks. getP corresponds to normal lazy fields, getN corresponds to strict integer fields, and so on for all the primitive types. A list of all of them can be found in eta.runtime.stg.DataCon.
This is the generated code for (,) or ghc_prim.ghc.Types$Z2TD.
Create a local variable to store the result of each case of the switch, actually store the result in each case into that local variable, and return it at the very end. The above style of bytecode while efficient, is not Java-like, and unlikely to be optimised by the JIT.
Call super.getP() for the default case to save some space storing the invalid field index! string which is anyways present.
The improvements should be made in ETA.CodeGen.Main.cgDataCon.
The text was updated successfully, but these errors were encountered:
So basically you need to modify defineGetRep to generate slightly better code. You'll need some basic idea of JVM bytecode this - feel free to ask questions on generating any particular instructions.
The
get*()
series of methods are used to access the fields of a data constructor by index, used by selector thunks.getP
corresponds to normal lazy fields,getN
corresponds to strict integer fields, and so on for all the primitive types. A list of all of them can be found ineta.runtime.stg.DataCon
.This is the generated code for
(,)
orghc_prim.ghc.Types$Z2TD
.The improved code should:
Create a local variable to store the result of each case of the switch, actually store the result in each case into that local variable, and return it at the very end. The above style of bytecode while efficient, is not Java-like, and unlikely to be optimised by the JIT.
Call
super.getP()
for the default case to save some space storing theinvalid field index!
string which is anyways present.The improvements should be made in
ETA.CodeGen.Main.cgDataCon
.The text was updated successfully, but these errors were encountered: