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

Frontend specific PrimOps. #65

Merged
merged 2 commits into from
Jan 4, 2020
Merged

Frontend specific PrimOps. #65

merged 2 commits into from
Jan 4, 2020

Conversation

andorp
Copy link
Member

@andorp andorp commented Dec 29, 2019

No description provided.

@andorp andorp mentioned this pull request Dec 29, 2019
, 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)
Copy link
Member

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?

Copy link
Member Author

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.

| RT_ValTag Tag
| RT_Unit
| RT_Lit Lit
| RT_Lit v
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@andorp andorp added the review Ready for review label Jan 4, 2020
@Anabra
Copy link
Member

Anabra commented Jan 4, 2020

Looks good to me.

@andorp andorp merged commit 39a47bf into master Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants