Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 277803 Details for
Bug 540712
Running JUnit test takes long due to Creating Type Hierarchy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed changes to reduce TypeBound[] instances
BountSet.patch (text/plain), 4.24 KB, created by
Eric Milles
on 2019-03-07 13:02:33 EST
(
hide
)
Description:
Proposed changes to reduce TypeBound[] instances
Filename:
MIME Type:
Creator:
Eric Milles
Created:
2019-03-07 13:02:33 EST
Size:
4.24 KB
patch
obsolete
>diff --git a/jdt-patch/e411/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java b/jdt-patch/e411/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java >index 2db7c5a..acc3978 100644 >--- a/jdt-patch/e411/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java >+++ b/jdt-patch/e411/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java >@@ -309,6 +309,7 @@ > this.instantiation = type; > } > } >+ > // main storage of type bounds: > HashMap<InferenceVariable, ThreeSets> boundsPerVariable = new HashMap<>(); > >@@ -316,14 +317,15 @@ > * 18.1.3 bullet 4: G<α1, ..., αn> = capture(G<A1, ..., An>) > * On both sides we only enter types with nonnull arguments. > */ >- HashMap<ParameterizedTypeBinding,ParameterizedTypeBinding> captures = new HashMap<>(); >+ HashMap<ParameterizedTypeBinding, ParameterizedTypeBinding> captures = new HashMap<>(); >+ > /** 18.1.3 bullet 5: throws α */ > Set<InferenceVariable> inThrows = new HashSet<>(); >- >- private TypeBound [] incorporatedBounds = new TypeBound[0]; >- private TypeBound [] unincorporatedBounds = new TypeBound [1024]; >+ >+ private TypeBound [] incorporatedBounds = Binding.NO_TYPE_BOUNDS; >+ private TypeBound [] unincorporatedBounds = new TypeBound [4]; > private int unincorporatedBoundsCount = 0; >- private TypeBound [] mostRecentBounds = new TypeBound[4]; // for quick & dirty duplicate elimination. >+ private TypeBound [] mostRecentBounds = new TypeBound [4]; // for quick & dirty duplicate elimination > > public BoundSet() {} > >@@ -348,8 +350,9 @@ > Iterator<ThreeSets> outerIt = this.boundsPerVariable.values().iterator(); > while (outerIt.hasNext()) > size += outerIt.next().size(); >+ if (size == 0) return Binding.NO_TYPE_BOUNDS; > TypeBound[] collected = new TypeBound[size]; >- if (size == 0) return collected; >+ //if (size == 0) return collected; > outerIt = this.boundsPerVariable.values().iterator(); > int idx = 0; > while (outerIt.hasNext()) >@@ -363,14 +366,18 @@ > */ > public BoundSet copy() { > BoundSet copy = new BoundSet(); >+ if (!this.boundsPerVariable.isEmpty()) { > Iterator<Entry<InferenceVariable, ThreeSets>> setsIterator = this.boundsPerVariable.entrySet().iterator(); > while (setsIterator.hasNext()) { > Entry<InferenceVariable, ThreeSets> entry = setsIterator.next(); > copy.boundsPerVariable.put(entry.getKey(), entry.getValue().copy()); > } >+ } > copy.inThrows.addAll(this.inThrows); > copy.captures.putAll(this.captures); >+ if (this.incorporatedBounds.length > 0) > System.arraycopy(this.incorporatedBounds, 0, copy.incorporatedBounds = new TypeBound[this.incorporatedBounds.length], 0, this.incorporatedBounds.length); >+ if (this.unincorporatedBoundsCount > 0) > System.arraycopy(this.unincorporatedBounds, 0, copy.unincorporatedBounds = new TypeBound[this.unincorporatedBounds.length], 0, this.unincorporatedBounds.length); > copy.unincorporatedBoundsCount = this.unincorporatedBoundsCount; > return copy; >@@ -403,7 +410,7 @@ > this.mostRecentBounds[2] = this.mostRecentBounds[1]; > this.mostRecentBounds[1] = this.mostRecentBounds[0]; > this.mostRecentBounds[0] = bound; >- >+ > InferenceVariable variable = bound.left.prototype(); > ThreeSets three = this.boundsPerVariable.get(variable); > if (three == null) >@@ -478,7 +485,7 @@ > // Driver for the real workhorse - Implements generational incorporation a la generational garbage collector. > boolean incorporate(InferenceContext18 context) throws InferenceFailureException { > >- if (this.unincorporatedBoundsCount == 0 && this.captures.size() == 0) >+ if (this.unincorporatedBoundsCount == 0 && this.captures.isEmpty()) > return true; > > do { >@@ -489,10 +496,10 @@ > // Pairwise bidirectional compare all bounds from previous generation with the fresh set. > if (!incorporate(context, this.incorporatedBounds, freshBounds)) > return false; >- // Pairwise bidirectional compare all fresh bounds. >+ // Pairwise bidirectional compare all fresh bounds. > if (!incorporate(context, freshBounds, freshBounds)) > return false; >- >+ > // Merge the bounds into one incorporated generation. > final int incorporatedLength = this.incorporatedBounds.length; > final int unincorporatedLength = freshBounds.length;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 540712
:
277802
| 277803 |
277857