From abe9cb48227b402a516e2d83c6ef7c83cd204694 Mon Sep 17 00:00:00 2001 From: Chris Recoskie Date: Fri, 20 Feb 2009 21:08:12 +0000 Subject: [PATCH] NEW - bug 205257: CDTProject creation scalability issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=205257 --- .../cdt/managedbuilder/core/ITool.java | 44 -------------- .../core/ManagedBuildManager.java | 25 +++++++- .../internal/core/HoldsOptions.java | 48 +++++++-------- .../managedbuilder/internal/core/Tool.java | 59 +++++++++++++------ 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java index 4199020096f..1eaed24c145 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.core; import java.util.List; -import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; import org.eclipse.cdt.core.settings.model.extension.CLanguageData; @@ -498,45 +497,12 @@ public interface ITool extends IBuildObject, IHoldsOptions { */ public void setCommandLinePattern(String pattern); - /** - * Returns the plugin.xml element of the commandLineGenerator extension or null if none. - * - * @return IConfigurationElement - * - * @deprecated - use getCommandLineGenerator - */ - public IConfigurationElement getCommandLineGeneratorElement(); - - /** - * Sets the CommandLineGenerator plugin.xml element - * - * @param element - * @deprecated - */ - public void setCommandLineGeneratorElement(IConfigurationElement element); - /** * Returns the command line generator specified for this tool * @return IManagedCommandLineGenerator */ public IManagedCommandLineGenerator getCommandLineGenerator(); - /** - * Returns the plugin.xml element of the dependencyGenerator extension or null if none. - * - * @return IConfigurationElement - * @deprecated - use getDependencyGeneratorForExtension or IInputType#getDependencyGenerator method - */ - public IConfigurationElement getDependencyGeneratorElement(); - - /** - * Sets the DependencyGenerator plugin.xml element - * - * @param element - * @deprecated - */ - public void setDependencyGeneratorElement(IConfigurationElement element); - /** * Returns a class instance that implements an interface to generate * source-level dependencies for the tool specified in the argument. @@ -747,22 +713,12 @@ public interface ITool extends IBuildObject, IHoldsOptions { IResourceInfo getParentResourceInfo(); -/* IInputType setSourceContentTypeIds(IInputType type, String[] ids); - - IInputType setHeaderContentTypeIds(IInputType type, String[] ids); - - IInputType setSourceExtensionsAttribute(IInputType type, String[] extensions); - - IInputType setHeaderExtensionsAttribute(IInputType type, String[] extensions); -*/ IInputType getEditableInputType(IInputType base); IOutputType getEditableOutputType(IOutputType base); boolean isEnabled(); -// boolean isReal(); - boolean supportsBuild(boolean managed); boolean matches(ITool tool); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 71f967e20df..0a0106663df 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -223,6 +223,8 @@ public class ManagedBuildManager extends AbstractCExtension { private static Map extensionOutputTypeMap; // Targets defined in the manifest files (CDT V2.0 object model) private static Map extensionTargetMap; + + // "Selected configuraton" elements defined in the manifest files. // These are configuration elements that map to objects in the internal // representation of the manifest files. For example, ListOptionValues @@ -232,7 +234,8 @@ public class ManagedBuildManager extends AbstractCExtension { // From the PDE Guide: // A configuration element, with its attributes and children, directly // reflects the content and structure of the extension section within the - // declaring plug-in's manifest (plugin.xml) file. + // declaring plug-in's manifest (plugin.xml) file. + // This map has a lifecycle corresponding to the build definitions extension loading. private static Map configElementMap; // private static List sortedToolChains; @@ -2249,6 +2252,12 @@ public class ManagedBuildManager extends AbstractCExtension { if (projectTypesLoading) return; projectTypesLoading = true; + + + // scalability issue: configElementMap does not need to live past when loading is done, so we will + // deallocate it upon exit with a try...finally + + try { //The list of the IManagedBuildDefinitionsStartup callbacks List buildDefStartupList = null; @@ -2555,6 +2564,12 @@ public class ManagedBuildManager extends AbstractCExtension { projectTypesLoaded = true; ToolChainModificationManager.getInstance().start(); + + } // try + + finally { + configElementMap = null; + } } private static void performAdjustments(){ @@ -3207,6 +3222,9 @@ public class ManagedBuildManager extends AbstractCExtension { } private static Map getConfigElementMap() { + if(!projectTypesLoading) + throw new IllegalStateException(); + if (configElementMap == null) { configElementMap = new HashMap(); } @@ -3214,8 +3232,9 @@ public class ManagedBuildManager extends AbstractCExtension { } /** - * This method public for implementation reasons. Not intended for use + * @noreference This method public for implementation reasons. Not intended for use * by clients. + * */ public static void putConfigElement(IBuildObject buildObj, IManagedConfigElement configElement) { getConfigElementMap().put(buildObj, configElement); @@ -3229,7 +3248,7 @@ public class ManagedBuildManager extends AbstractCExtension { } /** - * This method public for implementation reasons. Not intended for use + * @noreference This method public for implementation reasons. Not intended for use * by clients. */ public static IManagedConfigElement getConfigElement(IBuildObject buildObj) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java index 29c56380404..58f5e3a4b5b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java @@ -12,6 +12,8 @@ package org.eclipse.cdt.managedbuilder.internal.core; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -64,7 +66,6 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, private Vector categoryIds; private Map categoryMap; private List childOptionCategories; - private Vector