Author: [email protected]
Date: Thu Apr 2 17:55:23 2009
New Revision: 5178
Modified:
changes/scottb/memory/dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java
Log:
Removed JTypeOracle.hasClinitSet()
Modified:
changes/scottb/memory/dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java
==============================================================================
---
changes/scottb/memory/dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java
(original)
+++
changes/scottb/memory/dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java
Thu Apr 2 17:55:23 2009
@@ -208,8 +208,6 @@
private final Set<JInterfaceType> dualImpl = new
IdentityHashSet<JInterfaceType>();
- private Set<JReferenceType> hasClinitSet;
-
private final Map<JClassType, Set<JInterfaceType>> implementsMap = new
IdentityHashMap<JClassType, Set<JInterfaceType>>();
private Set<JReferenceType> instantiatedTypes = null;
@@ -510,7 +508,6 @@
}
public boolean hasClinit(JReferenceType type) {
- assert type.hasClinit() == hasClinitSet.contains(type);
return type.hasClinit();
}
@@ -545,14 +542,11 @@
* associated JProgram.
*/
public void recomputeAfterOptimizations() {
- hasClinitSet = new IdentityHashSet<JReferenceType>();
Set<JReferenceType> computed = new IdentityHashSet<JReferenceType>();
for (int i = 0; i < program.getDeclaredTypes().size(); ++i) {
JReferenceType type = program.getDeclaredTypes().get(i);
if (type.hasClinit()) {
computeHasClinit(type, computed);
- } else {
- computed.add(type);
}
}
@@ -622,11 +616,10 @@
Set<JReferenceType> computed) {
if (computeHasClinitRecursive(type, computed,
new IdentityHashSet<JReferenceType>())) {
- hasClinitSet.add(type);
+ computed.add(type);
} else {
type.removeClinit();
}
- computed.add(type);
}
private boolean computeHasClinitRecursive(JReferenceType type,
@@ -634,12 +627,6 @@
// Track that we've been seen.
alreadySeen.add(type);
- // If we've been computed, hasClinitSet is accurate for me.
- if (computed.contains(type)) {
- assert type.hasClinit() == hasClinitSet.contains(type);
- return type.hasClinit();
- }
-
JMethod method = type.methods.get(0);
assert (JProgram.isClinit(method));
CheckClinitVisitor v = new CheckClinitVisitor();
@@ -648,8 +635,21 @@
return true;
}
for (JReferenceType target : v.getClinitTargets()) {
+ if (!target.hasClinit()) {
+ // A false result is always accurate.
+ continue;
+ }
+
+ // If we've been computed, my clinit state is up to date.
+ if (type.hasClinit() && computed.contains(type)) {
+ return true;
+ }
+
+ /*
+ * Prevent recursion sickness: ignore this call for now since this
call is
+ * being accounted for higher on the stack.
+ */
if (alreadySeen.contains(target)) {
- // Ignore this call for now.
continue;
}
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---