-
Notifications
You must be signed in to change notification settings - Fork 615
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 Instanitate.definition to get Definition from cache. #4020
Conversation
232dbff
to
1db52e9
Compare
cb097f1
to
88a4d81
Compare
88a4d81
to
006cd74
Compare
} | ||
|
||
private object internal { | ||
// impl cannot be private, but it can be inside of a private object which hides it from the public | ||
|
||
def instance[A <: BaseModule: c.WeakTypeTag](c: Context)(con: c.Tree): c.Tree = { |
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.
I have no idea on how to dedup these macro, since it transforms args... seek help from @jackkoenig
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.
LGTM. From a user perspective, this indeed provides a better convenience.
|
d6c56c7
to
81d4cf7
Compare
): Instance[A] = Instance.do_apply(_defination(args, f))(sourceInfo) | ||
|
||
/** This is not part of the public API, do not call directly! */ | ||
def _defination[K, A <: BaseModule: ru.WeakTypeTag]( |
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.
Slight typo, should be _definition
, here and below.
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.
my bad! Super sorry!
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.
Not a big deal, we just should fix before 7.0.0-M2/RC1!
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.
Sure I'll fix that after getting up tomorrow.
Dep on #4018
This issue is designed for the use case of OM, but also apply to the future linking flow.
The type of
Class
should always be deduped at chisel elaboration time, since for each elaboration, newly generatedClass
has a different type to previous one.Thus we need to force user to pass
Definition
from top to down though hierarchy. I think is a bad user experience. :(Generally, all OM
Class
are cacheable since it only containing simple value or no values. This makes cache always work.Thus user only need to use
Instanitate.definition(new SomeOM)
to elaborateSomeOM
or fetchSomeOM
from builder cache if possible.Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.