-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Frontend specific PrimOps. #65
Conversation
6b03590
to
4c747d1
Compare
grin/src/Reducer/Pure.hs
Outdated
, storeSize :: !Int | ||
} | ||
|
||
emptyStore = StoreMap mempty 0 | ||
|
||
type ValueConstraints v = (Eq v, Show v, Pretty v) | ||
data EvalPlugin v = EvalPlugin | ||
{ evalPluginPrimOp :: Name -> [Val] -> [RTVal v] -> IO (RTVal v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the both the second and third arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the type signature for the
evalPrimOp :: MonadIO m => Name -> [Val] -> [RTVal Lit] -> m (RTVal Lit)
in the PrimOps module. I don't want to do an extensive refactor of that one.
grin/src/Reducer/Base.hs
Outdated
| RT_ValTag Tag | ||
| RT_Unit | ||
| RT_Lit Lit | ||
| RT_Lit v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation behind this generalization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the long run, the X-GRIN-backends should have their own primitive literals and types. The X-GRIN-backends will need to provide their own way of interpreting, representing them, a way of generate LLVM code etc. Currently the representation and interpretation do coincide with the Lit
type we use.
In the past, the Lit
was extended with the String type and its literal, because the need of the Idris-GRIN-Backend, although this type should not be there as it requires special treatment, and the implementation details of such types should be in the X-GRIN-backend codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a mid term goal, I am planning to move all those Idris-GRIN-backend specific codes under the Idris-GRIN codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the String literals, will they be represented using only primops? The above code only makes the representation pluginable, but not the possible literals. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This PR does not contain the abstraction for the literals. This was a necessary almost minimal change for the pluginable PrimOps. I will remove the type parameter from this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes as it started to disturb be too.
Looks good to me. |
No description provided.