Skip to content

Commit e4cf63f

Browse files
authored
Remove unused Builder methods (#4647)
Remove some Builder methods which have no users. These methods may be useful, however, they can be added back if necessary. Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent f5853ee commit e4cf63f

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

core/src/main/scala/chisel3/internal/Builder.scala

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ private[chisel3] object Builder extends LazyLogging {
590590

591591
// Returns the current dynamic context
592592
def captureContext(): DynamicContext = dynamicContext
593-
// Sets the current dynamic contents
594-
def restoreContext(dc: DynamicContext) = dynamicContextVar.value = Some(dc)
595593

596594
// Ensure we have a thread-specific ChiselContext
597595
private val chiselContext = new ThreadLocal[ChiselContext] {
@@ -600,18 +598,6 @@ private[chisel3] object Builder extends LazyLogging {
600598
}
601599
}
602600

603-
// Initialize any singleton objects before user code inadvertently inherits them.
604-
private def initializeSingletons(): Unit = {
605-
// This used to contain:
606-
// val dummy = core.DontCare
607-
// but this would occasionally produce hangs due to static initialization deadlock
608-
// when Builder initialization collided with chisel3.package initialization of the DontCare value.
609-
// See:
610-
// http://ternarysearch.blogspot.com/2013/07/static-initialization-deadlock.html
611-
// https://bugs.openjdk.java.net/browse/JDK-8037567
612-
// https://stackoverflow.com/questions/28631656/runnable-thread-state-but-in-object-wait
613-
}
614-
615601
def namingStackOption: Option[NamingStack] = dynamicContextVar.value.map(_.namingStack)
616602

617603
def idGen: IdGen = chiselContext.get.idGen
@@ -636,7 +622,6 @@ private[chisel3] object Builder extends LazyLogging {
636622
def newAnnotations: ArrayBuffer[ChiselMultiAnnotation] = dynamicContext.newAnnotations
637623

638624
def annotationSeq: AnnotationSeq = dynamicContext.annotationSeq
639-
def namingStack: NamingStack = dynamicContext.namingStack
640625
def importedDefinitionMap: Map[String, String] = dynamicContext.importedDefinitionMap
641626

642627
def unnamedViews: ArrayBuffer[Data] = dynamicContext.unnamedViews
@@ -734,14 +719,6 @@ private[chisel3] object Builder extends LazyLogging {
734719
def retrieveParent(module: BaseModule, context: BaseModule): Option[BaseModule] = {
735720
module._parent
736721
}
737-
def forcedModule: BaseModule = currentModule match {
738-
case Some(module) => module
739-
case None =>
740-
throwException(
741-
"Error: Not in a Module. Likely cause: Missed Module() wrap or bare chisel API call."
742-
// A bare api call is, e.g. calling Wire() from the scala console).
743-
)
744-
}
745722
def referenceUserModule: RawModule = {
746723
currentModule match {
747724
case Some(module: RawModule) => module
@@ -795,8 +772,6 @@ private[chisel3] object Builder extends LazyLogging {
795772
dynamicContext.whenStack = s
796773
}
797774

798-
def currentWhen: Option[WhenContext] = dynamicContext.whenStack.headOption
799-
800775
def blockStack: List[Block] = dynamicContext.blockStack
801776
def blockStack_=(s: List[Block]): Unit = {
802777
dynamicContext.blockStack = s
@@ -1198,8 +1173,6 @@ private[chisel3] object Builder extends LazyLogging {
11981173
chiselContext.get().modulePrefixSeperator
11991174
}
12001175

1201-
initializeSingletons()
1202-
12031176
/** The representation of the state of the [[Builder]] at a current point in
12041177
* time. This is intended to capture _enough_ information to insert hardware
12051178
* at another point in the circuit.

0 commit comments

Comments
 (0)