From 8c5f3483fa9da17a4ba12b5d1b9403be43d23b83 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 2 Jul 2009 08:57:39 +0000 Subject: Support for PDOMs larger than 2GB, bug 279620. --- .../internal/core/index/IIndexFragmentBinding.java | 2 +- .../index/composite/cpp/CPPCompositesFactory.java | 6 +- .../core/index/provider/IndexProviderManager.java | 4 +- .../internal/core/pdom/AbstractIndexerTask.java | 10 + .../org/eclipse/cdt/internal/core/pdom/PDOM.java | 83 +++++--- .../cdt/internal/core/pdom/PDOMFileSet.java | 4 +- .../cdt/internal/core/pdom/PDOMManager.java | 2 +- .../cdt/internal/core/pdom/WritablePDOM.java | 4 +- .../eclipse/cdt/internal/core/pdom/db/BTree.java | 136 ++++++------- .../eclipse/cdt/internal/core/pdom/db/Chunk.java | 127 ++++++++---- .../cdt/internal/core/pdom/db/DBProperties.java | 46 ++--- .../cdt/internal/core/pdom/db/Database.java | 223 +++++++++++++++------ .../internal/core/pdom/db/IBTreeComparator.java | 4 +- .../cdt/internal/core/pdom/db/IBTreeVisitor.java | 6 +- .../eclipse/cdt/internal/core/pdom/db/IString.java | 4 +- .../cdt/internal/core/pdom/db/ListItem.java | 24 +-- .../cdt/internal/core/pdom/db/LongString.java | 44 ++-- .../internal/core/pdom/db/PDOMNodeLinkedList.java | 30 +-- .../cdt/internal/core/pdom/db/ShortString.java | 56 +++--- .../cdt/internal/core/pdom/dom/ApplyVisitor.java | 4 +- .../cdt/internal/core/pdom/dom/FindBinding.java | 26 +-- .../internal/core/pdom/dom/IInternalPDOMNode.java | 2 +- .../cdt/internal/core/pdom/dom/IPDOMBinding.java | 2 +- .../core/pdom/dom/IPDOMLinkageFactory.java | 2 +- .../core/pdom/dom/MacroContainerCollector.java | 4 +- .../core/pdom/dom/MacroContainerFinder.java | 4 +- .../pdom/dom/MacroContainerPatternCollector.java | 4 +- .../internal/core/pdom/dom/NamedNodeCollector.java | 4 +- .../cdt/internal/core/pdom/dom/PDOMArrayType.java | 8 +- .../cdt/internal/core/pdom/dom/PDOMBinding.java | 52 ++--- .../cdt/internal/core/pdom/dom/PDOMFile.java | 93 ++++----- .../cdt/internal/core/pdom/dom/PDOMInclude.java | 59 +++--- .../cdt/internal/core/pdom/dom/PDOMLinkage.java | 34 ++-- .../cdt/internal/core/pdom/dom/PDOMMacro.java | 38 ++-- .../internal/core/pdom/dom/PDOMMacroContainer.java | 20 +- .../core/pdom/dom/PDOMMacroReferenceName.java | 26 +-- .../cdt/internal/core/pdom/dom/PDOMName.java | 38 ++-- .../cdt/internal/core/pdom/dom/PDOMNamedNode.java | 14 +- .../cdt/internal/core/pdom/dom/PDOMNode.java | 26 +-- .../internal/core/pdom/dom/PDOMPointerType.java | 8 +- .../internal/core/pdom/dom/PDOMQualifierType.java | 6 +- .../cdt/internal/core/pdom/dom/PDOMValue.java | 28 +-- .../internal/core/pdom/dom/c/PDOMCBasicType.java | 2 +- .../internal/core/pdom/dom/c/PDOMCEnumeration.java | 6 +- .../internal/core/pdom/dom/c/PDOMCEnumerator.java | 12 +- .../cdt/internal/core/pdom/dom/c/PDOMCField.java | 2 +- .../internal/core/pdom/dom/c/PDOMCFunction.java | 16 +- .../core/pdom/dom/c/PDOMCFunctionType.java | 6 +- .../cdt/internal/core/pdom/dom/c/PDOMCLinkage.java | 16 +- .../core/pdom/dom/c/PDOMCLinkageFactory.java | 2 +- .../internal/core/pdom/dom/c/PDOMCParameter.java | 14 +- .../internal/core/pdom/dom/c/PDOMCStructure.java | 2 +- .../cdt/internal/core/pdom/dom/c/PDOMCTypedef.java | 6 +- .../internal/core/pdom/dom/c/PDOMCVariable.java | 14 +- .../internal/core/pdom/dom/cpp/CPPFindBinding.java | 16 +- .../core/pdom/dom/cpp/PDOMCPPArgumentList.java | 28 +-- .../internal/core/pdom/dom/cpp/PDOMCPPBase.java | 18 +- .../core/pdom/dom/cpp/PDOMCPPBasicType.java | 2 +- .../internal/core/pdom/dom/cpp/PDOMCPPBinding.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPClassInstance.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPClassScope.java | 4 +- .../pdom/dom/cpp/PDOMCPPClassSpecialization.java | 14 +- .../core/pdom/dom/cpp/PDOMCPPClassTemplate.java | 16 +- .../PDOMCPPClassTemplatePartialSpecialization.java | 20 +- ...emplatePartialSpecializationSpecialization.java | 18 +- .../cpp/PDOMCPPClassTemplateSpecialization.java | 6 +- .../core/pdom/dom/cpp/PDOMCPPClassType.java | 20 +- .../core/pdom/dom/cpp/PDOMCPPConstructor.java | 2 +- .../pdom/dom/cpp/PDOMCPPConstructorInstance.java | 2 +- .../dom/cpp/PDOMCPPConstructorSpecialization.java | 2 +- .../pdom/dom/cpp/PDOMCPPConstructorTemplate.java | 2 +- .../PDOMCPPConstructorTemplateSpecialization.java | 2 +- .../pdom/dom/cpp/PDOMCPPDeferredClassInstance.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPEnumeration.java | 6 +- .../core/pdom/dom/cpp/PDOMCPPEnumerator.java | 12 +- .../internal/core/pdom/dom/cpp/PDOMCPPField.java | 2 +- .../pdom/dom/cpp/PDOMCPPFieldSpecialization.java | 12 +- .../internal/core/pdom/dom/cpp/PDOMCPPFriend.java | 14 +- .../core/pdom/dom/cpp/PDOMCPPFunction.java | 26 +-- .../core/pdom/dom/cpp/PDOMCPPFunctionInstance.java | 14 +- .../dom/cpp/PDOMCPPFunctionSpecialization.java | 20 +- .../core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java | 8 +- .../cpp/PDOMCPPFunctionTemplateSpecialization.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPFunctionType.java | 2 +- .../internal/core/pdom/dom/cpp/PDOMCPPLinkage.java | 24 +-- .../core/pdom/dom/cpp/PDOMCPPLinkageFactory.java | 2 +- .../internal/core/pdom/dom/cpp/PDOMCPPMethod.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPMethodInstance.java | 2 +- .../pdom/dom/cpp/PDOMCPPMethodSpecialization.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPMethodTemplate.java | 2 +- .../cpp/PDOMCPPMethodTemplateSpecialization.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPNamespace.java | 10 +- .../core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java | 6 +- .../core/pdom/dom/cpp/PDOMCPPParameter.java | 20 +- .../dom/cpp/PDOMCPPParameterSpecialization.java | 20 +- .../pdom/dom/cpp/PDOMCPPPointerToMemberType.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPReferenceType.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPSpecialization.java | 12 +- .../dom/cpp/PDOMCPPTemplateNonTypeParameter.java | 16 +- .../pdom/dom/cpp/PDOMCPPTemplateParameterMap.java | 28 +-- .../dom/cpp/PDOMCPPTemplateTemplateParameter.java | 24 +-- .../pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPTypeList.java | 20 +- .../internal/core/pdom/dom/cpp/PDOMCPPTypedef.java | 8 +- .../pdom/dom/cpp/PDOMCPPTypedefSpecialization.java | 6 +- .../pdom/dom/cpp/PDOMCPPUnknownClassInstance.java | 8 +- .../core/pdom/dom/cpp/PDOMCPPUnknownClassType.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java | 12 +- .../core/pdom/dom/cpp/PDOMCPPUsingDirective.java | 26 +-- .../core/pdom/dom/cpp/PDOMCPPVariable.java | 14 +- .../core/pdom/dom/cpp/PDOMGPPBasicType.java | 2 +- .../core/pdom/dom/cpp/PDOMInstanceCache.java | 4 +- .../pdom/dom/cpp/PDOMTemplateParameterArray.java | 12 +- .../cdt/internal/core/pdom/indexer/Messages.java | 7 + .../core/pdom/indexer/PDOMRebuildTask.java | 2 +- .../internal/core/pdom/indexer/messages.properties | 7 + 116 files changed, 1134 insertions(+), 915 deletions(-) (limited to 'core/org.eclipse.cdt.core/parser/org') diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java index cec6d3f6b29..0d853632ca8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java @@ -62,5 +62,5 @@ public interface IIndexFragmentBinding extends IIndexBinding { * Returns a unique id for the binding within the fragment * @since 5.1 */ - int getBindingID(); + long getBindingID(); } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java index ac0e7c6e6d3..9981c53f527 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java @@ -303,8 +303,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { private static class Key { final long i; final int j; - final int k; - public Key(long id1, int id2, int id3) { + final long k; + public Key(long id1, int id2, long id3) { i= id1; j= id2; k= id3; @@ -315,7 +315,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { int result = 1; result = prime * result + (int) (i ^ (i >>> 32)); result = prime * result + j; - result = prime * result + k; + result = prime * result + (int)k; return result; } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java index 8733a42db24..92c401da5b9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/provider/IndexProviderManager.java @@ -80,7 +80,9 @@ public final class IndexProviderManager implements IElementChangedListener { * Note: This method should not be called by clients for purposes other than testing */ public void reset() { - reset(new VersionRange(new Version(PDOM.MAJOR_VERSION,0, 0), true, new Version(PDOM.MAJOR_VERSION+1, 0, 0), false)); + Version minVersion= Version.parseVersion(PDOM.versionString(PDOM.getMinSupportedVersion())); + Version maxVersion= Version.parseVersion(PDOM.versionString(PDOM.getMaxSupportedVersion())); + reset(new VersionRange(minVersion, true, maxVersion, true)); } /** diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index 57c55268749..fd9c19901ad 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -784,6 +784,16 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private void swallowError(IPath file, Throwable e) throws CoreException { IStatus s; + /* + * If the thrown CoreException is for a STATUS_PDOM_TOO_LARGE, we don't want to + * swallow this one. + */ + if (e instanceof CoreException) { + s=((CoreException)e).getStatus(); + if( s != null && s.getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE ) { + throw (CoreException)e; + } + } if (e instanceof CoreException) { s= ((CoreException) e).getStatus(); if (s.getException() == null) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java index 8d4babc1bc7..a7aee2e492c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java @@ -95,11 +95,7 @@ import org.eclipse.core.runtime.Status; * Database for storing semantic information for one project. */ public class PDOM extends PlatformObject implements IPDOM { - /** - * mstodo - */ private static final int BLOCKED_WRITELOCK_OUTPUT_INTERVAL = 30000; - static boolean sDEBUG_LOCKS= "true".equals(Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/index/locks")); //$NON-NLS-1$//$NON-NLS-2$ /** @@ -167,6 +163,7 @@ public class PDOM extends PlatformObject implements IPDOM { * 60.0 - store integral values with basic types (bug 207871) * #61.0# - properly insert macro undef statements into macro-containers (bug 234591) - <> * + * CDT 6.0 development * 70.0 - cleaned up templates, fixes bug 236197 * 71.0 - proper support for anonymous unions, bug 206450 * 72.0 - store project-relative paths for resources that belong to the project, bug 239472 @@ -181,18 +178,43 @@ public class PDOM extends PlatformObject implements IPDOM { * 80.0 - support for specializations of partial specializations, bug 259872 * 81.0 - change to c++ function types, bug 264479 * 82.0 - offsets for using directives, bug 270806 - * 83.0 - unconditionally store name in PROMInclude, bug 272815 + * #83.0# - unconditionally store name in PDOMInclude, bug 272815 - <> + * 84.0 - storing free record pointers as (ptr>>3) and allocated pointers as (ptr-2)>>3 RECPTR_DENSE_VERSION + * + * CDT 7.0 development (versions not supported on the 6.0.x branch) + * next: 90.0 */ - private static int version(int major, int minor) { - return major << 16 + minor; + private static final int MIN_SUPPORTED_VERSION= version(83, 0); + private static final int MAX_SUPPORTED_VERSION= version(84, Short.MAX_VALUE); + private static int DEFAULT_VERSION = version(84, 0); + public static final int DENSE_RECPTR_VERSION = version(84, 0); + + static { + if (System.getProperty("org.eclipse.cdt.core.parser.pdom.useDensePointers", "false").equals("true")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + DEFAULT_VERSION= DENSE_RECPTR_VERSION; + } } - public static final int MAJOR_VERSION = 83; - public static final int MINOR_VERSION = 0; // minor versions must be compatible - public static final int CURRENT_VERSION= version(MAJOR_VERSION, MINOR_VERSION); - public static final int MIN_SUPPORTED_VERSION= version(MAJOR_VERSION, 0); - public static final int MAX_SUPPORTED_VERSION= version(MAJOR_VERSION+1, 0)-1; + private static int version(int major, int minor) { + return (major << 16) + minor; + } + /** + * Returns the version that shall be used when creating new databases + */ + public static int getDefaultVersion() { + return DEFAULT_VERSION; + } + + public static boolean isSupportedVersion(int vers) { + return vers >= MIN_SUPPORTED_VERSION && vers <= MAX_SUPPORTED_VERSION; + } + public static int getMinSupportedVersion() { + return MIN_SUPPORTED_VERSION; + } + public static int getMaxSupportedVersion() { + return MAX_SUPPORTED_VERSION; + } public static String versionString(int version) { final int major= version >> 16; final int minor= version & 0xffff; @@ -268,7 +290,7 @@ public class PDOM extends PlatformObject implements IPDOM { final boolean lockDB= db == null || lockCount != 0; clearCaches(); - db = new Database(fPath, cache, CURRENT_VERSION, isPermanentlyReadOnly()); + db = new Database(fPath, cache, getDefaultVersion(), isPermanentlyReadOnly()); db.setLocked(lockDB); if (isSupportedVersion()) { @@ -287,7 +309,7 @@ public class PDOM extends PlatformObject implements IPDOM { } private void readLinkages() throws CoreException { - int record= getFirstLinkageRecord(); + long record= getFirstLinkageRecord(); while (record != 0) { String linkageID= PDOMLinkage.getLinkageID(this, record).getString(); IPDOMLinkageFactory factory= fPDOMLinkageFactoryCache.get(linkageID); @@ -373,10 +395,10 @@ public class PDOM extends PlatformObject implements IPDOM { public IIndexFragmentFile[] getAllFiles() throws CoreException { final List locations = new ArrayList(); getFileIndex().accept(new IBTreeVisitor(){ - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { PDOMFile file = PDOMFile.recreateFile(PDOM.this, record); locations.add(file); return true; @@ -397,7 +419,7 @@ public class PDOM extends PlatformObject implements IPDOM { } protected void clearFileIndex() throws CoreException { - db.putInt(FILE_INDEX, 0); + db.putRecPtr(FILE_INDEX, 0); fileIndex = null; } @@ -405,7 +427,8 @@ public class PDOM extends PlatformObject implements IPDOM { assert lockCount < 0; // needs write-lock. // Clear out the database, everything is set to zero. - db.clear(CURRENT_VERSION); + int vers = getDefaultVersion(); + db.clear(vers); clearCaches(); fEvent.setCleared(); } @@ -647,8 +670,8 @@ public class PDOM extends PlatformObject implements IPDOM { } - private int getFirstLinkageRecord() throws CoreException { - return db.getInt(LINKAGES); + private long getFirstLinkageRecord() throws CoreException { + return db.getRecPtr(LINKAGES); } public IIndexLinkage[] getLinkages() { @@ -662,8 +685,8 @@ public class PDOM extends PlatformObject implements IPDOM { } public void insertLinkage(PDOMLinkage linkage) throws CoreException { - linkage.setNext(db.getInt(LINKAGES)); - db.putInt(LINKAGES, linkage.getRecord()); + linkage.setNext(db.getRecPtr(LINKAGES)); + db.putRecPtr(LINKAGES, linkage.getRecord()); fLinkageIDCache.put(linkage.getLinkageID(), linkage); } @@ -996,10 +1019,18 @@ public class PDOM extends PlatformObject implements IPDOM { if(IIndexFragment.PROPERTY_FRAGMENT_FORMAT_ID.equals(propertyName)) { return FRAGMENT_PROPERTY_VALUE_FORMAT_ID; } + int version = db.getVersion(); if(IIndexFragment.PROPERTY_FRAGMENT_FORMAT_VERSION.equals(propertyName)) { - return PDOM.versionString(db.getVersion()); + return PDOM.versionString(version); + } + // play it safe, properties are accessed before version checks. + if (PDOM.isSupportedVersion(version)) { + return new DBProperties(db, PROPERTIES).getProperty(propertyName); } - return new DBProperties(db, PROPERTIES).getProperty(propertyName); + if (IIndexFragment.PROPERTY_FRAGMENT_ID.equals(propertyName)) { + return "Unknown"; //$NON-NLS-1$ + } + return null; } public void close() throws CoreException { @@ -1062,7 +1093,7 @@ public class PDOM extends PlatformObject implements IPDOM { } } - public String createKeyForCache(int record, char[] name) { + public String createKeyForCache(long record, char[] name) { return new StringBuilder(name.length+2).append((char) (record >> 16)).append((char) record).append(name).toString(); } @@ -1328,4 +1359,4 @@ public class PDOM extends PlatformObject implements IPDOM { } } } -} \ No newline at end of file +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMFileSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMFileSet.java index 66e1a214146..bf00566c876 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMFileSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMFileSet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.CoreException; public class PDOMFileSet implements IIndexFragmentFileSet { - private HashSet fFileIDs= new HashSet(); + private HashSet fFileIDs= new HashSet(); public void add(IIndexFragmentFile fragFile) { PDOMFile pdomFile= (PDOMFile) fragFile; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index e6c820a1441..88431c62ae5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -1199,7 +1199,7 @@ public class PDOMManager implements IWritableIndexManager, IListener { version= (version << 8) + (b & 0xff); out.write(b); } - if (version < PDOM.MIN_SUPPORTED_VERSION || version > PDOM.MAX_SUPPORTED_VERSION) { + if ( !PDOM.isSupportedVersion( version ) ) { final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedVersion"), null); //$NON-NLS-1$ throw new CoreException(status); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/WritablePDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/WritablePDOM.java index 40d22f4d3ae..f192329038f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/WritablePDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/WritablePDOM.java @@ -117,10 +117,10 @@ public class WritablePDOM extends PDOM implements IWritableIndexFragment { public void rewriteLocations(final IIndexLocationConverter newConverter) throws CoreException { final List pdomfiles = new ArrayList(); getFileIndex().accept(new IBTreeVisitor(){ - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { PDOMFile file = PDOMFile.recreateFile(WritablePDOM.this, record); pdomfiles.add(file); return true; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java index 26e92b194d1..718fc77340c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 QNX Software Systems and others. + * Copyright (c) 2005, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,7 +31,7 @@ public class BTree { private static final int DELMODE_DELETE_MAXIMUM = 2; protected final Database db; - protected final int rootPointer; + protected final long rootPointer; protected final int DEGREE; protected final int MAX_RECORDS; @@ -42,7 +42,7 @@ public class BTree { protected final IBTreeComparator cmp; - public BTree(Database db, int rootPointer, IBTreeComparator cmp) { + public BTree(Database db, long rootPointer, IBTreeComparator cmp) { this(db, rootPointer, 8, cmp); } @@ -52,7 +52,7 @@ public class BTree { * @param db the database containing the btree * @param rootPointer offset into database of the pointer to the root node */ - public BTree(Database db, int rootPointer, int degree, IBTreeComparator cmp) { + public BTree(Database db, long rootPointer, int degree, IBTreeComparator cmp) { if(degree<2) throw new IllegalArgumentException(Messages.getString("BTree.IllegalDegree")); //$NON-NLS-1$ @@ -68,24 +68,24 @@ public class BTree { this.MEDIAN_RECORD = DEGREE - 1; } - protected int getRoot() throws CoreException { - return db.getInt(rootPointer); + protected long getRoot() throws CoreException { + return db.getRecPtr(rootPointer); } - protected final void putRecord(Chunk chunk, int node, int index, int record) { - chunk.putInt(node + index * Database.INT_SIZE, record); + protected final void putRecord(Chunk chunk, long node, int index, long record) { + chunk.putRecPtr(node + index * Database.INT_SIZE, record); } - protected final int getRecord(Chunk chunk, int node, int index) { - return chunk.getInt(node + index * Database.INT_SIZE); + protected final long getRecord(Chunk chunk, long node, int index) { + return chunk.getRecPtr(node + index * Database.INT_SIZE); } - protected final void putChild(Chunk chunk, int node, int index, int child) { - chunk.putInt(node + OFFSET_CHILDREN + index * Database.INT_SIZE, child); + protected final void putChild(Chunk chunk, long node, int index, long child) { + chunk.putRecPtr(node + OFFSET_CHILDREN + index * Database.INT_SIZE, child); } - protected final int getChild(Chunk chunk, int node, int index) { - return chunk.getInt(node + OFFSET_CHILDREN + index * Database.INT_SIZE); + protected final long getChild(Chunk chunk, long node, int index) { + return chunk.getRecPtr(node + OFFSET_CHILDREN + index * Database.INT_SIZE); } /** @@ -95,8 +95,8 @@ public class BTree { * * @param record offset of the record */ - public int insert(int record) throws CoreException { - int root = getRoot(); + public long insert(long record) throws CoreException { + long root = getRoot(); // is this our first time in if (root == 0) { @@ -107,19 +107,19 @@ public class BTree { return insert(null, 0, 0, root, record); } - private int insert(Chunk pChunk, int parent, int iParent, int node, int record) throws CoreException { + private long insert(Chunk pChunk, long parent, int iParent, long node, long record) throws CoreException { Chunk chunk = db.getChunk(node); // if this node is full (last record isn't null), split it if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) { - int median = getRecord(chunk, node, MEDIAN_RECORD); + long median = getRecord(chunk, node, MEDIAN_RECORD); if (median == record) // found it, never mind return median; else { // split it // create the new node and move the larger records over - int newnode = allocateNode(); + long newnode = allocateNode(); Chunk newchunk = db.getChunk(newnode); for (int i = 0; i < MEDIAN_RECORD; ++i) { putRecord(newchunk, newnode, i, getRecord(chunk, node, MEDIAN_RECORD + 1 + i)); @@ -134,12 +134,12 @@ public class BTree { // create a new root parent = allocateNode(); pChunk = db.getChunk(parent); - db.putInt(rootPointer, parent); + db.putRecPtr(rootPointer, parent); putChild(pChunk, parent, 0, node); } else { // insert the median into the parent for (int i = MAX_RECORDS - 2; i >= iParent; --i) { - int r = getRecord(pChunk, parent, i); + long r = getRecord(pChunk, parent, i); if (r != 0) { putRecord(pChunk, parent, i + 1, r); putChild(pChunk, parent, i + 2, getChild(pChunk, parent, i + 1)); @@ -168,7 +168,7 @@ public class BTree { while (lower < upper) { int middle= (lower+upper)/2; - int checkRec= getRecord(chunk, node, middle); + long checkRec= getRecord(chunk, node, middle); if (checkRec == 0) { upper= middle; } @@ -187,7 +187,7 @@ public class BTree { } } final int i= lower; - int child = getChild(chunk, node, i); + long child = getChild(chunk, node, i); if (child != 0) { // visit the children return insert(chunk, node, i, child, record); @@ -195,7 +195,7 @@ public class BTree { // were at the leaf, add us in. // first copy everything after over one for (int j = MAX_RECORDS - 2; j >= i; --j) { - int r = getRecord(chunk, node, j); + long r = getRecord(chunk, node, j); if (r != 0) putRecord(chunk, node, j + 1, r); } @@ -204,15 +204,15 @@ public class BTree { } } - private void firstInsert(int record) throws CoreException { + private void firstInsert(long record) throws CoreException { // create the node and save it as root - int root = allocateNode(); - db.putInt(rootPointer, root); + long root = allocateNode(); + db.putRecPtr(rootPointer, root); // put the record in the first slot of the node putRecord(db.getChunk(root), root, 0, record); } - private int allocateNode() throws CoreException { + private long allocateNode() throws CoreException { return db.malloc((2 * MAX_RECORDS + 1) * Database.INT_SIZE); } @@ -230,7 +230,7 @@ public class BTree { * @param record the record to delete * @throws CoreException */ - public void delete(int record) throws CoreException { + public void delete(long record) throws CoreException { try { deleteImp(record, getRoot(), DELMODE_NORMAL); } catch(BTreeKeyNotFoundException e) { @@ -249,11 +249,11 @@ public class BTree { * Used in implementation of delete routines */ private class BTNode { - final int node; + final long node; final int keyCount; final Chunk chunk; - BTNode(int node) throws CoreException { + BTNode(long node) throws CoreException { this.node = node; this.chunk = db.getChunk(node); int i=0; @@ -264,7 +264,7 @@ public class BTree { private BTNode getChild(int index) throws CoreException { if(0<=index && index MIN_RECORDS) { /* Case 2a: Delete key by overwriting it with its successor (which occurs in a leaf node) */ - int subst = deleteImp(-1, succ.node, DELMODE_DELETE_MINIMUM); + long subst = deleteImp(-1, succ.node, DELMODE_DELETE_MINIMUM); putRecord(node.chunk, node.node, keyIndexInNode, subst); return key; } @@ -336,7 +336,7 @@ public class BTree { BTNode pred = node.getChild(keyIndexInNode); if(pred!=null && pred.keyCount > MIN_RECORDS) { /* Case 2b: Delete key by overwriting it with its predecessor (which occurs in a leaf node) */ - int subst = deleteImp(-1, pred.node, DELMODE_DELETE_MAXIMUM); + long subst = deleteImp(-1, pred.node, DELMODE_DELETE_MAXIMUM); putRecord(node.chunk, node.node, keyIndexInNode, subst); return key; } @@ -378,8 +378,8 @@ public class BTree { BTNode sibR = node.getChild(subtreeIndex+1); if(sibR!=null && sibR.keyCount > MIN_RECORDS) { /* Case 3a (i): child will underflow upon deletion, take a key from rightSibling */ - int rightKey = getRecord(node.chunk, node.node, subtreeIndex); - int leftmostRightSiblingKey = getRecord(sibR.chunk, sibR.node, 0); + long rightKey = getRecord(node.chunk, node.node, subtreeIndex); + long leftmostRightSiblingKey = getRecord(sibR.chunk, sibR.node, 0); append(child, rightKey, getChild(sibR.chunk, sibR.node, 0)); nodeContentDelete(sibR, 0, 1); putRecord(node.chunk, node.node, subtreeIndex, leftmostRightSiblingKey); @@ -389,9 +389,9 @@ public class BTree { BTNode sibL = node.getChild(subtreeIndex-1); if(sibL!=null && sibL.keyCount > MIN_RECORDS) { /* Case 3a (ii): child will underflow upon deletion, take a key from leftSibling */ - int leftKey = getRecord(node.chunk, node.node, subtreeIndex-1); + long leftKey = getRecord(node.chunk, node.node, subtreeIndex-1); prepend(child, leftKey, getChild(sibL.chunk, sibL.node, sibL.keyCount)); - int rightmostLeftSiblingKey = getRecord(sibL.chunk, sibL.node, sibL.keyCount-1); + long rightmostLeftSiblingKey = getRecord(sibL.chunk, sibL.node, sibL.keyCount-1); putRecord(sibL.chunk, sibL.node, sibL.keyCount-1, 0); putChild(sibL.chunk, sibL.node, sibL.keyCount, 0); putRecord(node.chunk, node.node, subtreeIndex-1, rightmostLeftSiblingKey); @@ -412,7 +412,7 @@ public class BTree { throw new BTreeKeyNotFoundException( MessageFormat.format(Messages.getString("BTree.DeletionOnAbsentKey"), //$NON-NLS-1$ - new Object[]{new Integer(key), new Integer(mode)})); + new Object[]{new Long(key), new Integer(mode)})); } } } @@ -430,9 +430,9 @@ public class BTree { public void mergeNodes(BTNode src, BTNode keyProvider, int kIndex, BTNode dst) throws CoreException { nodeContentCopy(src, 0, dst, dst.keyCount+1, src.keyCount+1); - int midKey = getRecord(keyProvider.chunk, keyProvider.node, kIndex); + long midKey = getRecord(keyProvider.chunk, keyProvider.node, kIndex); putRecord(dst.chunk, dst.node, dst.keyCount, midKey); - int keySucc = kIndex+1 == MAX_RECORDS ? 0 : getRecord(keyProvider.chunk, keyProvider.node, kIndex+1); + long keySucc = kIndex+1 == MAX_RECORDS ? 0 : getRecord(keyProvider.chunk, keyProvider.node, kIndex+1); db.free(getChild(keyProvider.chunk, keyProvider.node, kIndex+1)); nodeContentDelete(keyProvider, kIndex+1, 1); putRecord(keyProvider.chunk, keyProvider.node, kIndex, keySucc); @@ -442,9 +442,9 @@ public class BTree { * This means we must special case it at the point when its had all of its keys deleted * entirely during merge operations (which push one of its keys down as a pivot) */ - int rootNode = getRoot(); + long rootNode = getRoot(); if(rootNode == keyProvider.node) { - db.putInt(rootPointer, dst.node); + db.putRecPtr(rootPointer, dst.node); db.free(rootNode); } } @@ -457,7 +457,7 @@ public class BTree { * @param key the new leftmost (least) key * @param child the new leftmost (least) subtree root */ - private void prepend(BTNode node, int key, int child) { + private void prepend(BTNode node, long key, long child) { nodeContentCopy(node, 0, node, 1, node.keyCount+1); putRecord(node.chunk, node.node, 0, key); putChild(node.chunk, node.node, 0, child); @@ -470,7 +470,7 @@ public class BTree { * @param key * @param child */ - private void append(BTNode node, int key, int child) { + private void append(BTNode node, long key, long child) { putRecord(node.chunk, node.node, node.keyCount, key); putChild(node.chunk, node.node, node.keyCount + 1, child); } @@ -492,11 +492,11 @@ public class BTree { int dstIndex = dstPos + i; if(srcIndex 0) { // start point is to the left return accept(getChild(chunk, node, i), visitor); @@ -605,8 +605,8 @@ public class BTree { * IBTreeVisitor2 if this is acceptable. */ private interface IBTreeVisitor2 extends IBTreeVisitor { - void preNode(int node) throws CoreException; - void postNode(int node) throws CoreException; + void preNode(long node) throws CoreException; + void postNode(long node) throws CoreException; } /** @@ -633,11 +633,11 @@ public class BTree { public String getMsg() { return msg; } public boolean isValid() { return valid; } - public void postNode(int node) throws CoreException { depth--; } - public int compare(int record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { return true; } + public void postNode(long node) throws CoreException { depth--; } + public int compare(long record) throws CoreException { return 0; } + public boolean visit(long record) throws CoreException { return true; } - public void preNode(int node) throws CoreException { + public void preNode(long node) throws CoreException { depth++; // collect information for checking @@ -667,25 +667,25 @@ public class BTree { if(!full && !empty){ valid = false; msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorA"), //$NON-NLS-1$ - new Object[]{new Integer(node), new Integer(indexFirstBlankKey), new Integer(indexLastNonBlankKey)}); + new Object[]{new Long(node), new Integer(indexFirstBlankKey), new Integer(indexLastNonBlankKey)}); } } // Check: Key number constrains child numbers if(childCount!=0 && childCount!=keyCount+1) { valid = false; - msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorB"), new Object[]{new Integer(node)}); //$NON-NLS-1$ + msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorB"), new Object[]{new Long(node)}); //$NON-NLS-1$ } // the root node is excused from the remaining node constraints - if(node == db.getInt(rootPointer)) { + if(node == db.getRecPtr(rootPointer)) { return; } // Check: Non-root nodes must have a keyCount within a certain range if(keyCount < MIN_RECORDS || keyCount > MAX_RECORDS) { valid = false; - msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorC"), new Object[]{new Integer(node)}); //$NON-NLS-1$ + msg += MessageFormat.format(Messages.getString("BTree.IntegrityErrorC"), new Object[]{new Long(node)}); //$NON-NLS-1$ } // Check: All leaf nodes are at the same depth diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java index 0ed179b604f..5b8a80ce3c5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 QNX Software Systems and others. + * Copyright (c) 2005, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,7 +39,7 @@ final class Chunk { void read() throws CoreException { try { final ByteBuffer buf= ByteBuffer.wrap(fBuffer); - fDatabase.read(buf, fSequenceNumber*Database.CHUNK_SIZE); + fDatabase.read(buf, (long)fSequenceNumber*Database.CHUNK_SIZE); } catch (IOException e) { throw new CoreException(new DBStatus(e)); } @@ -48,84 +48,141 @@ final class Chunk { void flush() throws CoreException { try { final ByteBuffer buf= ByteBuffer.wrap(fBuffer); - fDatabase.write(buf, fSequenceNumber*Database.CHUNK_SIZE); + fDatabase.write(buf, (long)fSequenceNumber*Database.CHUNK_SIZE); } catch (IOException e) { throw new CoreException(new DBStatus(e)); } fDirty= false; } + private static int recPtrToIndex( final long offset ) { + return (int)(offset & Database.OFFSET_IN_CHUNK_MASK ); + } - public void putByte(final int offset, final byte value) { + public void putByte(final long offset, final byte value) { assert fLocked; fDirty= true; - fBuffer[offset & Database.OFFSET_IN_CHUNK_MASK]= value; + fBuffer[recPtrToIndex( offset )]= value; } - public byte getByte(final int offset) { - return fBuffer[offset & Database.OFFSET_IN_CHUNK_MASK]; + public byte getByte(final long offset) { + return fBuffer[recPtrToIndex( offset )]; } - public byte[] getBytes(final int offset, final int length) { + public byte[] getBytes(final long offset, final int length) { final byte[] bytes = new byte[length]; - System.arraycopy(fBuffer, offset & Database.OFFSET_IN_CHUNK_MASK, bytes, 0, length); + System.arraycopy(fBuffer, recPtrToIndex( offset ), bytes, 0, length); return bytes; } - public void putBytes(final int offset, final byte[] bytes) { + public void putBytes(final long offset, final byte[] bytes) { assert fLocked; fDirty= true; - System.arraycopy(bytes, 0, fBuffer, offset & Database.OFFSET_IN_CHUNK_MASK, bytes.length); + System.arraycopy(bytes, 0, fBuffer, recPtrToIndex( offset ), bytes.length); } - public void putInt(final int offset, final int value) { + public void putInt(final long offset, final int value) { assert fLocked; fDirty= true; - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + int idx= recPtrToIndex( offset ); fBuffer[idx]= (byte)(value >> 24); fBuffer[++idx]= (byte)(value >> 16); fBuffer[++idx]= (byte)(value >> 8); fBuffer[++idx]= (byte)(value); } - public int getInt(final int offset) { - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + public int getInt(final long offset) { + int idx= recPtrToIndex( offset ); return ((fBuffer[idx] & 0xff) << 24) | ((fBuffer[++idx] & 0xff) << 16) | ((fBuffer[++idx] & 0xff) << 8) | ((fBuffer[++idx] & 0xff) << 0); } + + /* + * A Record Pointer is a pointer as returned by Database.malloc(). + * This is a pointer to a block + BLOCK_HEADER_SIZE. + * + * A free Record Pointer is a pointer to a raw block, i.e. the + * pointer is not moved past the BLOCK_HEADER_SIZE. + */ + public void putRecPtr(final long offset, final long value) { + if (!fDatabase.usesDensePointers()) { + putFreeRecPtr(offset, value); + } else { + putFreeRecPtr(offset, value == 0 ? value : value - Database.BLOCK_HEADER_SIZE); + } + return; + } + + public void putFreeRecPtr(final long offset, final long value) { + if (!fDatabase.usesDensePointers()) { + putInt(offset, (int) value); + return; + } + /* + * This assert verifies the alignment. We expect the low bits to be clear. + */ + assert (value & (Database.BLOCK_SIZE_DELTA - 1)) == 0; + putInt(offset, (int) (value >> Database.BLOCK_SIZE_DELTA_BITS)); + } + + public long getRecPtr(final long offset) { + if (!fDatabase.usesDensePointers()) { + return getInt(offset); + } + long address = getFreeRecPtr(offset); + return address != 0 ? (address + Database.BLOCK_HEADER_SIZE) : address; + } + + + public long getFreeRecPtr(final long offset) { + int value = getInt(offset); + if (!fDatabase.usesDensePointers()) { + return value; + } + /* + * We need to properly manage the integer that was read. The value will be sign-extended + * so if the most significant bit is set, the resulting long will look negative. By + * masking it with ((long)1 << 32) - 1 we remove all the sign-extended bits and just + * have an unsigned 32-bit value as a long. This gives us one more useful bit in the + * stored record pointers. + */ + long address = value & (((long) 1 << Integer.SIZE) - 1); + return address << Database.BLOCK_SIZE_DELTA_BITS; + } - public void put3ByteUnsignedInt(final int offset, final int value) { + + public void put3ByteUnsignedInt(final long offset, final int value) { assert fLocked; fDirty= true; - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + int idx= recPtrToIndex( offset ); fBuffer[idx]= (byte)(value >> 16); fBuffer[++idx]= (byte)(value >> 8); fBuffer[++idx]= (byte)(value); } - public int get3ByteUnsignedInt(final int offset) { - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + public int get3ByteUnsignedInt(final long offset) { + int idx= recPtrToIndex( offset ); return ((fBuffer[idx] & 0xff) << 16) | ((fBuffer[++idx] & 0xff) << 8) | ((fBuffer[++idx] & 0xff) << 0); } - public void putShort(final int offset, final short value) { + public void putShort(final long offset, final short value) { assert fLocked; fDirty= true; - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + int idx= recPtrToIndex( offset ); fBuffer[idx]= (byte)(value >> 8); fBuffer[++idx]= (byte)(value); } - public short getShort(final int offset) { - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + public short getShort(final long offset) { + int idx= recPtrToIndex( offset ); return (short) (((fBuffer[idx] << 8) | (fBuffer[++idx] & 0xff))); } - public long getLong(final int offset) { - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + public long getLong(final long offset) { + int idx= recPtrToIndex( offset ); return ((((long)fBuffer[idx] & 0xff) << 56) | (((long)fBuffer[++idx] & 0xff) << 48) | (((long)fBuffer[++idx] & 0xff) << 40) | @@ -136,10 +193,10 @@ final class Chunk { (((long)fBuffer[++idx] & 0xff) << 0)); } - public void putLong(final int offset, final long value) { + public void putLong(final long offset, final long value) { assert fLocked; fDirty= true; - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + int idx= recPtrToIndex( offset ); fBuffer[idx]= (byte)(value >> 56); fBuffer[++idx]= (byte)(value >> 48); @@ -151,29 +208,29 @@ final class Chunk { fBuffer[++idx]= (byte)(value); } - public void putChar(final int offset, final char value) { + public void putChar(final long offset, final char value) { assert fLocked; fDirty= true; - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + int idx= recPtrToIndex( offset ); fBuffer[idx]= (byte)(value >> 8); fBuffer[++idx]= (byte)(value); } - public char getChar(final int offset) { - int idx= offset & Database.OFFSET_IN_CHUNK_MASK; + public char getChar(final long offset) { + int idx= recPtrToIndex( offset ); return (char) (((fBuffer[idx] << 8) | (fBuffer[++idx] & 0xff))); } - public void getCharArray(final int offset, final char[] result) { + public void getCharArray(final long offset, final char[] result) { final ByteBuffer buf= ByteBuffer.wrap(fBuffer); - buf.position(offset & Database.OFFSET_IN_CHUNK_MASK); + buf.position(recPtrToIndex( offset )); buf.asCharBuffer().get(result); } - void clear(final int offset, final int length) { + void clear(final long offset, final int length) { assert fLocked; fDirty= true; - int idx= (offset & Database.OFFSET_IN_CHUNK_MASK); + int idx= recPtrToIndex( offset ); final int end= idx + length; for (; idx < end; idx++) { fBuffer[idx]= 0; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBProperties.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBProperties.java index 7ff860d827d..5cdf202b075 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBProperties.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBProperties.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Symbian Software Systems and others. + * Copyright (c) 2007, 2009 Symbian Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ public class DBProperties { protected BTree index; protected Database db; - protected int record; + protected long record; /** * Allocate storage for a new DBProperties record in the specified database @@ -44,7 +44,7 @@ public class DBProperties { * @param record * @throws CoreException */ - public DBProperties(Database db, int record) throws CoreException { + public DBProperties(Database db, long record) throws CoreException { this.record= record; this.index= new BTree(db, record + PROP_INDEX, DBProperty.getComparator(db)); this.db= db; @@ -127,10 +127,10 @@ public class DBProperties { */ public void clear() throws CoreException { index.accept(new IBTreeVisitor(){ - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { new DBProperty(db, record).delete(); return false; // there should never be duplicates } @@ -148,7 +148,7 @@ public class DBProperties { db.free(record); } - public int getRecord() { + public long getRecord() { return record; } @@ -159,9 +159,9 @@ public class DBProperties { static final int RECORD_SIZE = 8; Database db; - int record; + long record; - public int getRecord() { + public long getRecord() { return record; } @@ -178,8 +178,8 @@ public class DBProperties { IString dbkey= db.newString(key); IString dbvalue= db.newString(value); this.record= db.malloc(RECORD_SIZE); - db.putInt(record + KEY, dbkey.getRecord()); - db.putInt(record + VALUE, dbvalue.getRecord()); + db.putRecPtr(record + KEY, dbkey.getRecord()); + db.putRecPtr(record + VALUE, dbvalue.getRecord()); this.db= db; } @@ -189,24 +189,24 @@ public class DBProperties { * @param db * @param record */ - DBProperty(Database db, int record) { + DBProperty(Database db, long record) { this.record= record; this.db= db; } public IString getKey() throws CoreException { - return db.getString(db.getInt(record + KEY)); + return db.getString(db.getRecPtr(record + KEY)); } public IString getValue() throws CoreException { - return db.getString(db.getInt(record + VALUE)); + return db.getString(db.getRecPtr(record + VALUE)); } public static IBTreeComparator getComparator(final Database db) { return new IBTreeComparator() { - public int compare(int record1, int record2) throws CoreException { - IString left= db.getString(db.getInt(record1 + KEY)); - IString right= db.getString(db.getInt(record2 + KEY)); + public int compare(long record1, long record2) throws CoreException { + IString left= db.getString(db.getRecPtr(record1 + KEY)); + IString right= db.getString(db.getRecPtr(record2 + KEY)); return left.compare(right, true); } }; @@ -215,10 +215,10 @@ public class DBProperties { public static DBProperty search(final Database db, final BTree index, final String key) throws CoreException { final DBProperty[] result= new DBProperty[1]; index.accept(new IBTreeVisitor(){ - public int compare(int record) throws CoreException { - return db.getString(db.getInt(record + KEY)).compare(key, true); + public int compare(long record) throws CoreException { + return db.getString(db.getRecPtr(record + KEY)).compare(key, true); } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { result[0] = new DBProperty(db, record); return false; // there should never be duplicates } @@ -229,10 +229,10 @@ public class DBProperties { public static Set getKeySet(final Database db, final BTree index) throws CoreException { final Set result= new HashSet(); index.accept(new IBTreeVisitor(){ - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { result.add(new DBProperty(db, record).getKey().getString()); return true; // there should never be duplicates } @@ -241,8 +241,8 @@ public class DBProperties { } public void delete() throws CoreException { - db.getString(db.getInt(record + KEY)).delete(); - db.getString(db.getInt(record + VALUE)).delete(); + db.getString(db.getRecPtr(record + KEY)).delete(); + db.getString(db.getRecPtr(record + VALUE)).delete(); db.free(record); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java index cc777f34ca1..07f51a85d9d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 QNX Software Systems and others. + * Copyright (c) 2005, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,9 +24,11 @@ import java.nio.channels.FileChannel; import java.util.ArrayList; import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.internal.core.pdom.PDOM; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; /** @@ -38,7 +40,7 @@ import org.eclipse.core.runtime.Status; /* * The file encapsulated is divided into Chunks of size CHUNK_SIZE, and a table of contents * mapping chunk index to chunk address is maintained. Chunk structure exists only conceptually - - * its not a structure that appears in the file. + * it is not a structure that appears in the file. * * ===== The first chunk is used by Database itself for house-keeping purposes and has structure * @@ -56,9 +58,9 @@ import org.eclipse.core.runtime.Status; * * offset content * _____________________________ - * 0 | size of block (negative indicates in use, positive unused) - * PREV_OFFSET | pointer to prev block (of same size) - * NEXT_OFFSET | pointer to next block (of same size) + * 0 | size of block (negative indicates in use, positive unused) (2 bytes) + * PREV_OFFSET | pointer to prev block (of same size) (only in free blocks) + * NEXT_OFFSET | pointer to next block (of same size) (only in free blocks) * */ public class Database { @@ -67,7 +69,8 @@ public class Database { public static final int CHUNK_SIZE = 1024 * 4; public static final int OFFSET_IN_CHUNK_MASK= CHUNK_SIZE-1; public static final int BLOCK_HEADER_SIZE= 2; - public static final int BLOCK_SIZE_DELTA= 8; + public static final int BLOCK_SIZE_DELTA_BITS = 3; + public static final int BLOCK_SIZE_DELTA= 1 << BLOCK_SIZE_DELTA_BITS; public static final int MIN_BLOCK_DELTAS = 2; // a block must at least be 2 + 2*4 bytes to link the free blocks. public static final int MAX_BLOCK_DELTAS = CHUNK_SIZE/BLOCK_SIZE_DELTA; public static final int MAX_MALLOC_SIZE = MAX_BLOCK_DELTAS*BLOCK_SIZE_DELTA - BLOCK_HEADER_SIZE; @@ -88,6 +91,8 @@ public class Database { private int fVersion; private final Chunk fHeaderChunk; private Chunk[] fChunks; + private int fChunksUsed; + private int fChunksAllocated; private ChunkCache fCache; private long malloced; @@ -116,11 +121,13 @@ public class Database { if (nChunksOnDisk <= 0) { fVersion= version; fChunks= new Chunk[1]; + fChunksUsed = fChunksAllocated = fChunks.length; } else { fHeaderChunk.read(); fVersion= fHeaderChunk.getInt(VERSION_OFFSET); fChunks = new Chunk[nChunksOnDisk]; // chunk[0] is unused. + fChunksUsed = fChunksAllocated = nChunksOnDisk; } } catch (IOException e) { throw new CoreException(new DBStatus(e)); @@ -131,11 +138,11 @@ public class Database { fFile = new RandomAccessFile(fLocation, fReadOnly ? "r" : "rw"); //$NON-NLS-1$ //$NON-NLS-2$ } - void read(ByteBuffer buf, int i) throws IOException { + void read(ByteBuffer buf, long position) throws IOException { int retries= 0; do { try { - fFile.getChannel().read(buf, i); + fFile.getChannel().read(buf, position); return; } catch (ClosedChannelException e) { @@ -145,11 +152,11 @@ public class Database { } while (true); } - void write(ByteBuffer buf, int i) throws IOException { + void write(ByteBuffer buf, long position) throws IOException { int retries= 0; do { try { - fFile.getChannel().write(buf, i); + fFile.getChannel().write(buf, position); return; } catch (ClosedChannelException e) { @@ -184,7 +191,7 @@ public class Database { } } - public int getVersion() throws CoreException { + public int getVersion() { return fVersion; } @@ -207,6 +214,7 @@ public class Database { fHeaderChunk.clear(0, CHUNK_SIZE); // chunks have been removed from the cache, so we may just reset the array of chunks. fChunks = new Chunk[] {null}; + fChunksUsed = fChunksAllocated = fChunks.length; try { fHeaderChunk.flush(); // zero out header chunk fFile.getChannel().truncate(CHUNK_SIZE); // truncate database @@ -215,6 +223,21 @@ public class Database { CCorePlugin.log(e); } malloced = freed = 0; + /* + * This is for debugging purposes in order to simulate having a very large PDOM database. + * This will set aside the specified number of chunks. + * Nothing uses these chunks so subsequent allocations come after these fillers. + * The special function createNewChunks allocates all of these chunks at once. + * 524288 for a file starting at 2G + * 8388608 for a file starting at 32G + * + */ + long setasideChunks = Long.getLong("org.eclipse.cdt.core.parser.pdom.dense.recptr.setaside.chunks", 0 ); //$NON-NLS-1$ + if( setasideChunks != 0 ) { + setVersion( getVersion() ); + createNewChunks( (int) setasideChunks ); + flush(); + } } private void removeChunksFromCache() { @@ -234,13 +257,16 @@ public class Database { * Return the Chunk that contains the given offset. * @throws CoreException */ - public Chunk getChunk(int offset) throws CoreException { + public Chunk getChunk(long offset) throws CoreException { if (offset < CHUNK_SIZE) { return fHeaderChunk; } + long long_index = offset / CHUNK_SIZE; + assert long_index < Integer.MAX_VALUE; + synchronized(fCache) { assert fLocked; - final int index = offset / CHUNK_SIZE; + final int index = (int)long_index; Chunk chunk= fChunks[index]; if (chunk == null) { cacheMisses++; @@ -258,20 +284,17 @@ public class Database { /** * Allocate a block out of the database. */ - public int malloc(final int datasize) throws CoreException { + public long malloc(final int datasize) throws CoreException { assert fExclusiveLock; - if (datasize < 0 || datasize > MAX_MALLOC_SIZE) - // Too Big - throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, - CCorePlugin.getResourceString("pdom.requestTooLarge"), new IllegalArgumentException())); //$NON-NLS-1$ - + assert datasize >=0 && datasize <= MAX_MALLOC_SIZE; + int needDeltas= (datasize + BLOCK_HEADER_SIZE + BLOCK_SIZE_DELTA - 1) / BLOCK_SIZE_DELTA; if (needDeltas < MIN_BLOCK_DELTAS) { needDeltas= MIN_BLOCK_DELTAS; } // Which block size - int freeblock = 0; + long freeblock = 0; int useDeltas; for (useDeltas= needDeltas; useDeltas <= MAX_BLOCK_DELTAS; useDeltas++) { freeblock = getFirstBlock(useDeltas*BLOCK_SIZE_DELTA); @@ -309,56 +332,114 @@ public class Database { return freeblock + BLOCK_HEADER_SIZE; } - private int createNewChunk() throws CoreException { + private long createNewChunk() throws CoreException { assert fExclusiveLock; synchronized (fCache) { - final int oldLen= fChunks.length; - final Chunk chunk= new Chunk(this, oldLen); - chunk.fDirty= true; + final int newChunkIndex = fChunksUsed; // fChunks.length; + + final Chunk chunk = new Chunk(this, newChunkIndex); + chunk.fDirty = true; + + if (newChunkIndex >= fChunksAllocated) { + int increment = Math.max(1024, fChunksAllocated/20); + Chunk[] newchunks = new Chunk[fChunksAllocated + increment]; + System.arraycopy(fChunks, 0, newchunks, 0, fChunksAllocated); + + fChunks = newchunks; + fChunksAllocated += increment; + } + fChunksUsed += 1; + fChunks[newChunkIndex] = chunk; - Chunk[] newchunks = new Chunk[oldLen+1]; + fCache.add(chunk, true); + long address = (long) newChunkIndex * CHUNK_SIZE; + + /* + * non-dense pointers are at most 31 bits dense pointers are at most 35 bits Check the sizes here + * and throw an exception if the address is too large. By throwing the CoreException with the + * special status, the indexing operation should be stopped. This is desired since generally, once + * the max size is exceeded, there are lots of errors. + */ + long max_size; + if (usesDensePointers()) { + max_size = ((long) 1 << (Integer.SIZE + BLOCK_SIZE_DELTA_BITS)); + } else { + max_size = ((long) 1 << (Integer.SIZE - 1)); + } + if (address >= max_size) { + Object bindings[] = { this.getLocation().getAbsolutePath(), max_size }; + throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, + CCorePlugin.STATUS_PDOM_TOO_LARGE, NLS.bind(CCorePlugin + .getResourceString("pdom.DatabaseTooLarge"), bindings), null)); //$NON-NLS-1$ + } + return address; + } + } + + /** + * Returns whether this database uses dense pointers. + */ + boolean usesDensePointers() { + return getVersion() >= PDOM.DENSE_RECPTR_VERSION; + } + + /** + * for testing purposes, only. + */ + private long createNewChunks(int numChunks) throws CoreException { + assert fExclusiveLock; + synchronized (fCache) { + final int oldLen= fChunks.length; + Chunk[] newchunks = new Chunk[oldLen+numChunks]; System.arraycopy(fChunks, 0, newchunks, 0, oldLen); - newchunks[oldLen]= chunk; + for( int i = oldLen; i < oldLen + numChunks; i++ ) { + newchunks[i]= null; + } + final Chunk chunk= new Chunk(this, oldLen + numChunks - 1); + chunk.fDirty= true; + newchunks[ oldLen + numChunks - 1 ] = chunk; fChunks= newchunks; fCache.add(chunk, true); - return oldLen * CHUNK_SIZE; + fChunksAllocated=oldLen+numChunks; + fChunksUsed=oldLen+numChunks; + return (long)(oldLen + numChunks - 1) * CHUNK_SIZE; } } - private int getFirstBlock(int blocksize) throws CoreException { + private long getFirstBlock(int blocksize) throws CoreException { assert fLocked; - return fHeaderChunk.getInt((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE); + return fHeaderChunk.getFreeRecPtr((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE); } - private void setFirstBlock(int blocksize, int block) throws CoreException { + private void setFirstBlock(int blocksize, long block) throws CoreException { assert fExclusiveLock; - fHeaderChunk.putInt((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE, block); + fHeaderChunk.putFreeRecPtr((blocksize/BLOCK_SIZE_DELTA - MIN_BLOCK_DELTAS + 1) * INT_SIZE, block); } - private void removeBlock(Chunk chunk, int blocksize, int block) throws CoreException { + private void removeBlock(Chunk chunk, int blocksize, long block) throws CoreException { assert fExclusiveLock; - int prevblock = chunk.getInt(block + BLOCK_PREV_OFFSET); - int nextblock = chunk.getInt(block + BLOCK_NEXT_OFFSET); + long prevblock = chunk.getFreeRecPtr(block + BLOCK_PREV_OFFSET); + long nextblock = chunk.getFreeRecPtr(block + BLOCK_NEXT_OFFSET); if (prevblock != 0) - putInt(prevblock + BLOCK_NEXT_OFFSET, nextblock); + putFreeRecPtr(prevblock + BLOCK_NEXT_OFFSET, nextblock); else // we were the head setFirstBlock(blocksize, nextblock); if (nextblock != 0) - putInt(nextblock + BLOCK_PREV_OFFSET, prevblock); + putFreeRecPtr(nextblock + BLOCK_PREV_OFFSET, prevblock); } - private void addBlock(Chunk chunk, int blocksize, int block) throws CoreException { + private void addBlock(Chunk chunk, int blocksize, long block) throws CoreException { assert fExclusiveLock; // Mark our size chunk.putShort(block, (short) blocksize); // Add us to the head of the list - int prevfirst = getFirstBlock(blocksize); - chunk.putInt(block + BLOCK_PREV_OFFSET, 0); - chunk.putInt(block + BLOCK_NEXT_OFFSET, prevfirst); + long prevfirst = getFirstBlock(blocksize); + chunk.putFreeRecPtr(block + BLOCK_PREV_OFFSET, 0); + chunk.putFreeRecPtr(block + BLOCK_NEXT_OFFSET, prevfirst); if (prevfirst != 0) - putInt(prevfirst + BLOCK_PREV_OFFSET, block); + putFreeRecPtr(prevfirst + BLOCK_PREV_OFFSET, block); setFirstBlock(blocksize, block); } @@ -367,10 +448,10 @@ public class Database { * * @param offset */ - public void free(int offset) throws CoreException { + public void free(long offset) throws CoreException { assert fExclusiveLock; // TODO - look for opportunities to merge blocks - int block = offset - BLOCK_HEADER_SIZE; + long block = offset - BLOCK_HEADER_SIZE; Chunk chunk = getChunk(block); int blocksize = - chunk.getShort(block); if (blocksize < 0) @@ -380,51 +461,67 @@ public class Database { freed += blocksize; } - public void putByte(int offset, byte value) throws CoreException { + public void putByte(long offset, byte value) throws CoreException { getChunk(offset).putByte(offset, value); } - public byte getByte(int offset) throws CoreException { + public byte getByte(long offset) throws CoreException { return getChunk(offset).getByte(offset); } - public void putInt(int offset, int value) throws CoreException { + public void putInt(long offset, int value) throws CoreException { getChunk(offset).putInt(offset, value); } - public int getInt(int offset) throws CoreException { + public int getInt(long offset) throws CoreException { return getChunk(offset).getInt(offset); } + + public void putRecPtr(long offset, long value) throws CoreException { + getChunk(offset).putRecPtr(offset, value); + } + + public long getRecPtr(long offset) throws CoreException { + return getChunk(offset).getRecPtr(offset); + } + + private void putFreeRecPtr(long offset, long value) throws CoreException { + getChunk(offset).putFreeRecPtr(offset, value); + } + + private long getFreeRecPtr(long offset) throws CoreException { + return getChunk(offset).getFreeRecPtr(offset); + } - public void put3ByteUnsignedInt(int offset, int value) throws CoreException { + public void put3ByteUnsignedInt(long offset, int value) throws CoreException { getChunk(offset).put3ByteUnsignedInt(offset, value); } - public int get3ByteUnsignedInt(int offset) throws CoreException { + public int get3ByteUnsignedInt(long offset) throws CoreException { return getChunk(offset).get3ByteUnsignedInt(offset); } - public void putShort(int offset, short value) throws CoreException { + public void putShort(long offset, short value) throws CoreException { getChunk(offset).putShort(offset, value); } - public short getShort(int offset) throws CoreException { + public short getShort(long offset) throws CoreException { return getChunk(offset).getShort(offset); } - public void putLong(int offset, long value) throws CoreException { + public void putLong(long offset, long value) throws CoreException { getChunk(offset).putLong(offset, value); } - public long getLong(int offset) throws CoreException { + public long getLong(long offset) throws CoreException { return getChunk(offset).getLong(offset); } - public void putChar(int offset, char value) throws CoreException { + public void putChar(long offset, char value) throws CoreException { getChunk(offset).putChar(offset, value); } - public char getChar(int offset) throws CoreException { + public char getChar(long offset) throws CoreException { return getChunk(offset).getChar(offset); } @@ -442,7 +539,7 @@ public class Database { return new ShortString(this, chars); } - public IString getString(int offset) throws CoreException { + public IString getString(long offset) throws CoreException { int length = getInt(offset); if (length > ShortString.MAX_LENGTH) return new LongString(this, offset); @@ -454,17 +551,17 @@ public class Database { * For debugging purposes, only. */ public void reportFreeBlocks() throws CoreException { - System.out.println("Allocated size: " + fChunks.length * CHUNK_SIZE); //$NON-NLS-1$ + System.out.println("Allocated size: " + fChunksUsed * CHUNK_SIZE); //$NON-NLS-1$ System.out.println("malloc'ed: " + malloced); //$NON-NLS-1$ System.out.println("free'd: " + freed); //$NON-NLS-1$ - System.out.println("wasted: " + (fChunks.length * CHUNK_SIZE - (malloced - freed))); //$NON-NLS-1$ + System.out.println("wasted: " + (fChunksUsed * CHUNK_SIZE - (malloced - freed))); //$NON-NLS-1$ System.out.println("Free blocks"); //$NON-NLS-1$ for (int bs = MIN_BLOCK_DELTAS*BLOCK_SIZE_DELTA; bs <= CHUNK_SIZE; bs += BLOCK_SIZE_DELTA) { int count = 0; - int block = getFirstBlock(bs); + long block = getFirstBlock(bs); while (block != 0) { ++count; - block = getInt(block + BLOCK_NEXT_OFFSET); + block = getFreeRecPtr(block + BLOCK_NEXT_OFFSET); } if (count != 0) System.out.println("Block size: " + bs + "=" + count); //$NON-NLS-1$ //$NON-NLS-2$ @@ -486,6 +583,7 @@ public class Database { fHeaderChunk.clear(0, CHUNK_SIZE); fHeaderChunk.fDirty= false; fChunks= new Chunk[] {null}; + fChunksUsed = fChunksAllocated = fChunks.length; try { fFile.close(); } catch (IOException e) { @@ -535,7 +633,7 @@ public class Database { try { ArrayList dirtyChunks= new ArrayList(); synchronized (fCache) { - for (int i= 1; i < fChunks.length; i++) { + for (int i= 1; i < fChunksUsed; i++) { Chunk chunk= fChunks[i]; if (chunk != null) { if (chunk.fCacheIndex < 0) { @@ -589,7 +687,7 @@ public class Database { // be careful as other readers may access chunks concurrently ArrayList dirtyChunks= new ArrayList(); synchronized (fCache) { - for (int i= 1; i < fChunks.length ; i++) { + for (int i= 1; i < fChunksUsed ; i++) { Chunk chunk= fChunks[i]; if (chunk != null && chunk.fDirty) { dirtyChunks.add(chunk); @@ -667,4 +765,5 @@ public class Database { } return 0; } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java index 4124abe0094..530b8d11c24 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 QNX Software Systems and others. + * Copyright (c) 2005, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,6 @@ public interface IBTreeComparator { /** * Compare two records. Used for insert. */ - public abstract int compare(int record1, int record2) throws CoreException; + public abstract int compare(long record1, long record2) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java index 051677b7886..cb3461b0ea6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 QNX Software Systems and others. + * Copyright (c) 2005, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,7 +29,7 @@ public interface IBTreeVisitor { * @return -1 if record < key, 0 if record == key, 1 if record > key * @throws CoreException */ - public abstract int compare(int record) throws CoreException; + public abstract int compare(long record) throws CoreException; /** * Visit a given record and return whether to continue or not. @@ -37,6 +37,6 @@ public interface IBTreeVisitor { * @return true to continue the visit, false to abort it. * @throws CoreException */ - public abstract boolean visit(int record) throws CoreException; + public abstract boolean visit(long record) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IString.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IString.java index 94d34777f91..c2368730a4d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IString.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IString.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 QNX Software Systems and others. + * Copyright (c) 2006, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ public interface IString { /** * Get the offset of this IString record in the PDOM */ - public int getRecord(); + public long getRecord(); // strcmp equivalents /** diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ListItem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ListItem.java index 23d5e740d96..8186d1d14da 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ListItem.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ListItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 QNX Software Systems and others. + * Copyright (c) 2006, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.CoreException; */ public class ListItem { protected final Database db; - protected final int record; + protected final long record; protected static final int NEXT = 0; protected static final int PREV = 4; @@ -30,7 +30,7 @@ public class ListItem { protected static final int RECORD_SIZE = 12; - public ListItem(Database db, int record) { + public ListItem(Database db, long record) { this.db = db; this.record = record; } @@ -40,7 +40,7 @@ public class ListItem { this.record = db.malloc(RECORD_SIZE); } - public int getRecord() { + public long getRecord() { return record; } @@ -54,29 +54,29 @@ public class ListItem { return false; } - public void setItem(int item) throws CoreException { - db.putInt(record + ITEM, item); + public void setItem(long item) throws CoreException { + db.putRecPtr(record + ITEM, item); } - public int getItem() throws CoreException { - return db.getInt(record + ITEM); + public long getItem() throws CoreException { + return db.getRecPtr(record + ITEM); } public void setNext(ListItem next) throws CoreException { - db.putInt(record + NEXT, next.getRecord()); + db.putRecPtr(record + NEXT, next.getRecord()); } public ListItem getNext() throws CoreException { - int next = db.getInt(record + NEXT); + long next = db.getRecPtr(record + NEXT); return next != 0 ? new ListItem(db, next) : null; } public void setPrev(ListItem prev) throws CoreException { - db.putInt(record + PREV, prev.getRecord()); + db.putRecPtr(record + PREV, prev.getRecord()); } public ListItem getPrev() throws CoreException { - int prev = db.getInt(record + PREV); + long prev = db.getRecPtr(record + PREV); return prev != 0 ? new ListItem(db, prev) : null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/LongString.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/LongString.java index ced5a9bf02a..fc09ec08f72 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/LongString.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/LongString.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 QNX Software Systems and others. + * Copyright (c) 2006, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException; public class LongString implements IString { private final Database db; - private final int record; + private final long record; private int hash; // Additional fields of first record @@ -44,28 +44,28 @@ public class LongString implements IString { private static final int NUM_CHARSN = (Database.MAX_MALLOC_SIZE - CHARSN) / 2; - public LongString(Database db, int record) { + public LongString(Database db, long record) { this.db = db; this.record = record; } private interface IWriter { - public void writeChars(int start, int length, int p) throws CoreException; + public void writeChars(int start, int length, long p) throws CoreException; } - private int createString(int length, IWriter writer) throws CoreException { + private long createString(int length, IWriter writer) throws CoreException { // write the first record - int firstRecord = db.malloc(Database.MAX_MALLOC_SIZE); + long firstRecord = db.malloc(Database.MAX_MALLOC_SIZE); int start = 0; db.putInt(firstRecord, length); writer.writeChars(start, NUM_CHARS1, firstRecord + CHARS1); // write the subsequent records - int lastNext = firstRecord + NEXT1; + long lastNext = firstRecord + NEXT1; start += NUM_CHARS1; while (length - start > NUM_CHARSN) { - int nextRecord = db.malloc(Database.MAX_MALLOC_SIZE); - db.putInt(lastNext, nextRecord); + long nextRecord = db.malloc(Database.MAX_MALLOC_SIZE); + db.putRecPtr(lastNext, nextRecord); writer.writeChars(start, NUM_CHARSN, nextRecord + CHARSN); start += NUM_CHARSN; lastNext = nextRecord + NEXTN; @@ -73,8 +73,8 @@ public class LongString implements IString { // Write the final record length -= start; - int finalRecord = db.malloc(CHARSN + (length) * 2); - db.putInt(lastNext, finalRecord); + long finalRecord = db.malloc(CHARSN + (length) * 2); + db.putRecPtr(lastNext, finalRecord); writer.writeChars(start, length, finalRecord + CHARSN); return firstRecord; @@ -83,7 +83,7 @@ public class LongString implements IString { public LongString(Database db, final String string) throws CoreException { this.db = db; this.record = createString(string.length(), new IWriter() { - public void writeChars(int start, int length, int p) throws CoreException { + public void writeChars(int start, int length, long p) throws CoreException { for (int i = start; i < start + length; ++i) { LongString.this.db.putChar(p, string.charAt(i)); p += 2; @@ -95,7 +95,7 @@ public class LongString implements IString { public LongString(Database db, final char[] chars) throws CoreException { this.db = db; this.record = createString(chars.length, new IWriter() { - public void writeChars(int start, int length, int p) throws CoreException { + public void writeChars(int start, int length, long p) throws CoreException { for (int i = start; i < start + length; ++i) { LongString.this.db.putChar(p, chars[i]); p += 2; @@ -104,19 +104,19 @@ public class LongString implements IString { }); } - public int getRecord() { + public long getRecord() { return record; } public void delete() throws CoreException { int length = db.getInt(record + LENGTH) - NUM_CHARS1; - int nextRecord = db.getInt(record + NEXT1); + long nextRecord = db.getRecPtr(record + NEXT1); db.free(record); // Middle records while (length > NUM_CHARSN) { length -= NUM_CHARSN; - int nextnext = db.getInt(nextRecord + NEXTN); + long nextnext = db.getRecPtr(nextRecord + NEXTN); db.free(nextRecord); nextRecord = nextnext; } @@ -295,13 +295,13 @@ public class LongString implements IString { private void readChars(int length, IReader reader) throws CoreException { // First record - int p = record + CHARS1; + long p = record + CHARS1; for (int i = 0; i < NUM_CHARS1; ++i) { reader.appendChar(db.getChar(p)); p += 2; } length -= NUM_CHARS1; - int nextRecord = db.getInt(record + NEXT1); + long nextRecord = db.getRecPtr(record + NEXT1); // Middle records while (length > NUM_CHARSN) { @@ -311,7 +311,7 @@ public class LongString implements IString { p += 2; } length -= NUM_CHARSN; - nextRecord = db.getInt(nextRecord + NEXTN); + nextRecord = db.getRecPtr(nextRecord + NEXTN); } // Last record @@ -326,7 +326,7 @@ public class LongString implements IString { * Convenience class for sequential access to LongString characters */ private class CharIterator { - int p; + long p; int count; int length; @@ -343,10 +343,10 @@ public class LongString implements IString { throw new NoSuchElementException(); } if(count == NUM_CHARS1) { - p = db.getInt(record + NEXT1) + CHARSN; + p = db.getRecPtr(record + NEXT1) + CHARSN; } if(count > NUM_CHARS1 && ((count-NUM_CHARS1) % NUM_CHARSN)==0) { - p = db.getInt(p-(NUM_CHARSN*2)-4) + CHARSN; + p = db.getRecPtr(p-(NUM_CHARSN*2)-4) + CHARSN; } return result; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/PDOMNodeLinkedList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/PDOMNodeLinkedList.java index fa4d75cde22..a259cedd961 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/PDOMNodeLinkedList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/PDOMNodeLinkedList.java @@ -24,14 +24,14 @@ import org.eclipse.core.runtime.CoreException; * */ public class PDOMNodeLinkedList { - private int offset; + private long offset; private PDOMLinkage linkage; private boolean allowsNull; private static final int FIRST_MEMBER = 0; protected static final int RECORD_SIZE = 4; - public PDOMNodeLinkedList(PDOMLinkage linkage, int offset, boolean allowsNulls) { + public PDOMNodeLinkedList(PDOMLinkage linkage, long offset, boolean allowsNulls) { this.offset = offset; this.linkage = linkage; this.allowsNull = allowsNulls; @@ -43,7 +43,7 @@ public class PDOMNodeLinkedList { * @param linkage * @param offset */ - public PDOMNodeLinkedList(PDOMLinkage linkage, int offset) { + public PDOMNodeLinkedList(PDOMLinkage linkage, long offset) { this(linkage, offset, false); } @@ -53,14 +53,14 @@ public class PDOMNodeLinkedList { public void accept(IPDOMVisitor visitor) throws CoreException { Database db = linkage.getDB(); - int firstItem = db.getInt(offset + FIRST_MEMBER); + long firstItem = db.getRecPtr(offset + FIRST_MEMBER); if (firstItem == 0) return; - int item = firstItem; + long item = firstItem; do { PDOMNode node; - final int record= db.getInt(item + ListItem.ITEM); + final long record= db.getRecPtr(item + ListItem.ITEM); if (record == 0) { if (!allowsNull) { throw new NullPointerException(); @@ -73,12 +73,12 @@ public class PDOMNodeLinkedList { node.accept(visitor); } visitor.leave(node); - } while ((item = db.getInt(item + ListItem.NEXT)) != firstItem); + } while ((item = db.getRecPtr(item + ListItem.NEXT)) != firstItem); } private ListItem getFirstMemberItem() throws CoreException { Database db = linkage.getDB(); - int item = db.getInt(offset + FIRST_MEMBER); + long item = db.getRecPtr(offset + FIRST_MEMBER); return item != 0 ? new ListItem(db, item) : null; } @@ -90,14 +90,14 @@ public class PDOMNodeLinkedList { */ public PDOMNode getNodeAt(int pos) throws CoreException { Database db = linkage.getDB(); - int firstItem = db.getInt(offset + FIRST_MEMBER); + long firstItem = db.getRecPtr(offset + FIRST_MEMBER); if (firstItem == 0) { return null; } - int item = firstItem; + long item = firstItem; do { if (--pos < 0) { - int record = db.getInt(item + ListItem.ITEM); + long record = db.getRecPtr(item + ListItem.ITEM); if (record == 0) { if (!allowsNull) { throw new NullPointerException(); @@ -107,7 +107,7 @@ public class PDOMNodeLinkedList { return linkage.getNode(record); } } - } while ((item = db.getInt(item + ListItem.NEXT)) != firstItem); + } while ((item = db.getRecPtr(item + ListItem.NEXT)) != firstItem); return null; } @@ -115,7 +115,7 @@ public class PDOMNodeLinkedList { addMember(allowsNull && member==null ? 0 : member.getRecord()); } - protected void addMember(int record) throws CoreException { + protected void addMember(long record) throws CoreException { Database db = linkage.getDB(); ListItem firstMember = getFirstMemberItem(); if (firstMember == null) { @@ -123,7 +123,7 @@ public class PDOMNodeLinkedList { firstMember.setItem(record); firstMember.setNext(firstMember); firstMember.setPrev(firstMember); - db.putInt(offset + FIRST_MEMBER, firstMember.getRecord()); + db.putRecPtr(offset + FIRST_MEMBER, firstMember.getRecord()); } else { ListItem newMember = new ListItem(db); newMember.setItem(record); @@ -138,7 +138,7 @@ public class PDOMNodeLinkedList { public void deleteListItems() throws CoreException { ListItem item = getFirstMemberItem(); if (item != null) { - int firstRec= item.record; + long firstRec= item.record; do { ListItem nextItem= item.getNext(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ShortString.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ShortString.java index 887b59f1231..ce3f236b97b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ShortString.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/ShortString.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 QNX Software Systems and others. + * Copyright (c) 2006, 2009 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.CoreException; public class ShortString implements IString { private final Database db; - private final int record; + private final long record; private int hash; private static final int LENGTH = 0; @@ -32,7 +32,7 @@ public class ShortString implements IString { public static final int MAX_LENGTH = (Database.MAX_MALLOC_SIZE - CHARS) / 2; - public ShortString(Database db, int offset) { + public ShortString(Database db, long offset) { this.db = db; this.record = offset; } @@ -44,7 +44,7 @@ public class ShortString implements IString { Chunk chunk = db.getChunk(record); chunk.putInt(record + LENGTH, (char)chars.length); int n = chars.length; - int p = record + CHARS; + long p = record + CHARS; for (int i = 0; i < n; ++i) { chunk.putChar(p, chars[i]); p += 2; @@ -58,14 +58,14 @@ public class ShortString implements IString { Chunk chunk = db.getChunk(record); chunk.putInt(record + LENGTH, string.length()); int n = string.length(); - int p = record + CHARS; + long p = record + CHARS; for (int i = 0; i < n; ++i) { chunk.putChar(p, string.charAt(i)); p += 2; } } - public int getRecord() { + public long getRecord() { return record; } @@ -99,13 +99,13 @@ public class ShortString implements IString { Chunk chunk1 = db.getChunk(record); Chunk chunk2 = string.db.getChunk(string.record); - int n1 = chunk1.getInt(record); + int n1 = chunk1.getInt(record); int n2 = chunk2.getInt(string.record); if (n1 != n2) return false; - int p1 = record + CHARS; - int p2 = string.record + CHARS; + long p1 = record + CHARS; + long p2 = string.record + CHARS; for (int i = 0; i < n1; ++i) { if (chunk1.getChar(p1) != chunk2.getChar(p2)) return false; @@ -123,7 +123,7 @@ public class ShortString implements IString { return false; // Check each character - int p = record + CHARS; + long p = record + CHARS; for (int i = 0; i < n; ++i) { if (chunk.getChar(p) != chars[i]) return false; @@ -140,7 +140,7 @@ public class ShortString implements IString { return false; // Check each character - int p = record + CHARS; + long p = record + CHARS; for (int i = 0; i < n; ++i) { if (chunk.getChar(p) != string.charAt(i)) return false; @@ -178,9 +178,9 @@ public class ShortString implements IString { public int compare(char[] other, boolean caseSensitive) throws CoreException { Chunk chunk = db.getChunk(record); - int i1 = record + CHARS; + long i1 = record + CHARS; int i2 = 0; - int n1 = i1 + chunk.getInt(record + LENGTH) * 2; + long n1 = i1 + chunk.getInt(record + LENGTH) * 2; int n2 = other.length; while (i1 < n1 && i2 < n2) { @@ -213,10 +213,10 @@ public class ShortString implements IString { Chunk chunk1 = db.getChunk(record); Chunk chunk2 = other.db.getChunk(other.record); - int i1 = record + CHARS; - int i2 = other.record + CHARS; - int n1 = i1 + chunk1.getInt(record + LENGTH) * 2; - int n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2; + long i1 = record + CHARS; + long i2 = other.record + CHARS; + long n1 = i1 + chunk1.getInt(record + LENGTH) * 2; + long n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2; while (i1 < n1 && i2 < n2) { int cmp= compareChars(chunk1.getChar(i1), chunk2.getChar(i2), caseSensitive); @@ -238,9 +238,9 @@ public class ShortString implements IString { public int compare(String other, boolean caseSensitive) throws CoreException { Chunk chunk = db.getChunk(record); - int i1 = record + CHARS; + long i1 = record + CHARS; int i2 = 0; - int n1 = i1 + chunk.getInt(record + LENGTH) * 2; + long n1 = i1 + chunk.getInt(record + LENGTH) * 2; int n2 = other.length(); while (i1 < n1 && i2 < n2) { @@ -275,10 +275,10 @@ public class ShortString implements IString { Chunk chunk1 = db.getChunk(record); Chunk chunk2 = other.db.getChunk(other.record); - int i1 = record + CHARS; - int i2 = other.record + CHARS; - int n1 = i1 + chunk1.getInt(record + LENGTH) * 2; - int n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2; + long i1 = record + CHARS; + long i2 = other.record + CHARS; + long n1 = i1 + chunk1.getInt(record + LENGTH) * 2; + long n2 = i2 + chunk2.getInt(other.record + LENGTH) * 2; int sensitiveCmp= 0; while (i1 < n1 && i2 < n2) { final char c1= chunk1.getChar(i1); @@ -313,9 +313,9 @@ public class ShortString implements IString { public int compareCompatibleWithIgnoreCase(char[] chars) throws CoreException { Chunk chunk1 = db.getChunk(record); - int i1 = record + CHARS; + long i1 = record + CHARS; int i2 = 0; - int n1 = i1 + chunk1.getInt(record + LENGTH) * 2; + long n1 = i1 + chunk1.getInt(record + LENGTH) * 2; int n2 = chars.length; int sensitiveCmp= 0; while (i1 < n1 && i2 < n2) { @@ -351,9 +351,9 @@ public class ShortString implements IString { public int comparePrefix(char[] other, boolean caseSensitive) throws CoreException { Chunk chunk = db.getChunk(record); - int i1 = record + CHARS; + long i1 = record + CHARS; int i2 = 0; - int n1 = i1 + chunk.getInt(record + LENGTH) * 2; + long n1 = i1 + chunk.getInt(record + LENGTH) * 2; int n2 = other.length; while (i1 < n1 && i2 < n2) { @@ -372,7 +372,7 @@ public class ShortString implements IString { } public char charAt(int i) throws CoreException { - int ptr = record + CHARS + (i*2); + long ptr = record + CHARS + (i*2); return db.getChar(ptr); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/ApplyVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/ApplyVisitor.java index 631ce68ceb0..aec7be638c9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/ApplyVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/ApplyVisitor.java @@ -28,7 +28,7 @@ public class ApplyVisitor implements IBTreeVisitor, IPDOMVisitor { this.visitor= visitor; } - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; // visit all nodes in a b-tree } @@ -40,7 +40,7 @@ public class ApplyVisitor implements IBTreeVisitor, IPDOMVisitor { return false; // don't visit children of the node } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { if (record == 0) return true; PDOMNode node= linkage.getNode(record); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java index b845f5d6a29..13beb3f0813 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java @@ -34,13 +34,13 @@ public class FindBinding { this.database= linkage.getDB(); } - public int compare(int record1, int record2) throws CoreException { + public int compare(long record1, long record2) throws CoreException { IString nm1 = PDOMNamedNode.getDBName(database, record1); IString nm2 = PDOMNamedNode.getDBName(database, record2); int cmp= nm1.compareCompatibleWithIgnoreCase(nm2); if (cmp == 0) { - int t1= PDOMBinding.getLocalToFileRec(database, record1); - int t2= PDOMBinding.getLocalToFileRec(database, record2); + long t1= PDOMBinding.getLocalToFileRec(database, record1); + long t2= PDOMBinding.getLocalToFileRec(database, record2); if (t1 == t2) { t1 = PDOMNode.getNodeType(database, record1); t2 = PDOMNode.getNodeType(database, record2); @@ -55,10 +55,10 @@ public class FindBinding { protected final PDOMLinkage fLinkage; private final char[] fName; private final int[] fConstants; - private final int fLocalToFile; + private final long fLocalToFile; protected PDOMBinding fResult; - protected DefaultFindBindingVisitor(PDOMLinkage linkage, char[] name, int[] constants, int localToFile) { + protected DefaultFindBindingVisitor(PDOMLinkage linkage, char[] name, int[] constants, long localToFile) { fLinkage = linkage; fName = name; fConstants = constants; @@ -66,20 +66,20 @@ public class FindBinding { } // IBTreeVisitor - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { final Database db = fLinkage.getDB(); IString nm1 = PDOMNamedNode.getDBName(db, record); int cmp= nm1.compareCompatibleWithIgnoreCase(fName); if (cmp == 0) { - int t1= PDOMBinding.getLocalToFileRec(db, record); - int t2= fLocalToFile; + long t1= PDOMBinding.getLocalToFileRec(db, record); + long t2= fLocalToFile; cmp= t1 < t2 ? -1 : (t1 > t2 ? 1 : 0); } return cmp; } // IBTreeVisitor - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { final PDOMNamedNode nnode = (PDOMNamedNode) fLinkage.getNode(record); if (nnode instanceof PDOMBinding) { final PDOMBinding binding = (PDOMBinding) nnode; @@ -128,7 +128,7 @@ public class FindBinding { } @Override - public int compare(int record1, int record2) throws CoreException { + public int compare(long record1, long record2) throws CoreException { int cmp= super.compare(record1, record2); // compare names if (cmp == 0) { // any order will do. if (record1 < record2) { @@ -147,7 +147,7 @@ public class FindBinding { public MacroBTreeComparator(Database database) { db= database; } - public int compare(int record1, int record2) throws CoreException { + public int compare(long record1, long record2) throws CoreException { return compare(PDOMNamedNode.getDBName(db, record1), PDOMNamedNode.getDBName(db, record2)); // compare names } private int compare(IString nameInDB, IString nameInDB2) throws CoreException { @@ -156,14 +156,14 @@ public class FindBinding { } public static PDOMBinding findBinding(BTree btree, final PDOMLinkage linkage, final char[] name, - final int[] constants, final int localToFileRec) throws CoreException { + final int[] constants, final long localToFileRec) throws CoreException { final DefaultFindBindingVisitor visitor = new DefaultFindBindingVisitor(linkage, name, constants, localToFileRec); btree.accept(visitor); return visitor.getResult(); } public static PDOMBinding findBinding(IPDOMNode node, final PDOMLinkage linkage, final char[] name, final int[] constants, - int localToFileRec) throws CoreException { + long localToFileRec) throws CoreException { final DefaultFindBindingVisitor visitor = new DefaultFindBindingVisitor(linkage, name, constants, localToFileRec); try { node.accept(visitor); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IInternalPDOMNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IInternalPDOMNode.java index 8d98495725c..16a06d80aa4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IInternalPDOMNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IInternalPDOMNode.java @@ -16,5 +16,5 @@ import org.eclipse.cdt.core.dom.IPDOMNode; * Common, but internal methods for all pdom nodes. */ public interface IInternalPDOMNode extends IPDOMNode { - public int getRecord(); + public long getRecord(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java index b00b33700d4..b83a577f815 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java @@ -28,7 +28,7 @@ public interface IPDOMBinding extends IPDOMNode, IIndexFragmentBinding { /** * Returns the database record for this binding. */ - int getRecord(); + long getRecord(); /** * Returns the linkage of the binding. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMLinkageFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMLinkageFactory.java index 3f4ad3f3077..9cd07efbeea 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMLinkageFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMLinkageFactory.java @@ -20,7 +20,7 @@ import org.eclipse.core.runtime.CoreException; */ public interface IPDOMLinkageFactory { - public PDOMLinkage getLinkage(PDOM pdom, int record); + public PDOMLinkage getLinkage(PDOM pdom, long record); public PDOMLinkage createLinkage(PDOM pdom) throws CoreException; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerCollector.java index 23681cb9685..e1173b5a634 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerCollector.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerCollector.java @@ -53,7 +53,7 @@ public final class MacroContainerCollector implements IBTreeVisitor { monitor= pm; } - final public int compare(int record) throws CoreException { + final public int compare(long record) throws CoreException { if (monitor != null) checkCancelled(); IString rhsName= PDOMNamedNode.getDBName(linkage.getDB(), record); @@ -79,7 +79,7 @@ public final class MacroContainerCollector implements IBTreeVisitor { return cmp; } - final public boolean visit(int record) throws CoreException { + final public boolean visit(long record) throws CoreException { if (monitor != null) checkCancelled(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerFinder.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerFinder.java index a30de333710..cf349ee613d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerFinder.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerFinder.java @@ -31,7 +31,7 @@ public final class MacroContainerFinder implements IBTreeVisitor { fLinkage= linkage; } - final public int compare(int record) throws CoreException { + final public int compare(long record) throws CoreException { IString name= PDOMNamedNode.getDBName(fLinkage.getDB(), record); return compare(name); } @@ -40,7 +40,7 @@ public final class MacroContainerFinder implements IBTreeVisitor { return rhsName.compareCompatibleWithIgnoreCase(fName); } - final public boolean visit(int record) throws CoreException { + final public boolean visit(long record) throws CoreException { if (record == 0) return true; fMacroContainer= new PDOMMacroContainer(fLinkage, record); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerPatternCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerPatternCollector.java index e71747da257..b2a4a283e34 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerPatternCollector.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/MacroContainerPatternCollector.java @@ -39,13 +39,13 @@ public final class MacroContainerPatternCollector implements IBTreeVisitor { } - final public int compare(int record) throws CoreException { + final public int compare(long record) throws CoreException { if (fMonitor != null) checkCancelled(); return 0; } - final public boolean visit(int record) throws CoreException { + final public boolean visit(long record) throws CoreException { if (record == 0) return true; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/NamedNodeCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/NamedNodeCollector.java index a10aad42653..99c33ed6b44 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/NamedNodeCollector.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/NamedNodeCollector.java @@ -61,7 +61,7 @@ public class NamedNodeCollector implements IBTreeVisitor, IPDOMVisitor { monitor= pm; } - final public int compare(int record) throws CoreException { + final public int compare(long record) throws CoreException { if (monitor != null) checkCancelled(); IString rhsName= PDOMNamedNode.getDBName(linkage.getDB(), record); @@ -87,7 +87,7 @@ public class NamedNodeCollector implements IBTreeVisitor, IPDOMVisitor { return cmp; } - final public boolean visit(int record) throws CoreException { + final public boolean visit(long record) throws CoreException { if (monitor != null) checkCancelled(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMArrayType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMArrayType.java index ddb7b932fdd..2592539e6cc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMArrayType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMArrayType.java @@ -29,7 +29,7 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I @SuppressWarnings("hiding") private static final int RECORD_SIZE= TYPE+4; - public PDOMArrayType(PDOMLinkage linkage, int record) { + public PDOMArrayType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -38,8 +38,8 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I try { PDOMNode targetTypeNode = getLinkage().addType(this, type.getType()); if (targetTypeNode != null) { - int typeRec = targetTypeNode.getRecord(); - getDB().putInt(record + TYPE, typeRec); + long typeRec = targetTypeNode.getRecord(); + getDB().putRecPtr(record + TYPE, typeRec); } } catch (DOMException e) { CCorePlugin.log(e); @@ -62,7 +62,7 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I public IType getType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java index f03e4680b81..4561c920888 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java @@ -57,7 +57,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding super(linkage, parent, name); } - public PDOMBinding(PDOMLinkage linkage, int record) { + public PDOMBinding(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -79,18 +79,18 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding * @return true if the binding is orphaned. * @throws CoreException */ - public static boolean isOrphaned(PDOM pdom, int record) throws CoreException { + public static boolean isOrphaned(PDOM pdom, long record) throws CoreException { Database db = pdom.getDB(); - return db.getInt(record + FIRST_DECL_OFFSET) == 0 - && db.getInt(record + FIRST_DEF_OFFSET) == 0 - && db.getInt(record + FIRST_REF_OFFSET) == 0; + return db.getRecPtr(record + FIRST_DECL_OFFSET) == 0 + && db.getRecPtr(record + FIRST_DEF_OFFSET) == 0 + && db.getRecPtr(record + FIRST_REF_OFFSET) == 0; } public final boolean hasDeclaration() throws CoreException { if (hasDeclaration == -1) { final Database db = getDB(); - if (db.getInt(record + FIRST_DECL_OFFSET) != 0 - || db.getInt(record + FIRST_DEF_OFFSET) != 0) { + if (db.getRecPtr(record + FIRST_DECL_OFFSET) != 0 + || db.getRecPtr(record + FIRST_DEF_OFFSET) != 0) { hasDeclaration= 1; return true; } @@ -128,50 +128,50 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding } public PDOMName getFirstDeclaration() throws CoreException { - int namerec = getDB().getInt(record + FIRST_DECL_OFFSET); + long namerec = getDB().getRecPtr(record + FIRST_DECL_OFFSET); return namerec != 0 ? new PDOMName(getLinkage(), namerec) : null; } public void setFirstDeclaration(PDOMName name) throws CoreException { - int namerec = name != null ? name.getRecord() : 0; - getDB().putInt(record + FIRST_DECL_OFFSET, namerec); + long namerec = name != null ? name.getRecord() : 0; + getDB().putRecPtr(record + FIRST_DECL_OFFSET, namerec); } public PDOMName getFirstDefinition() throws CoreException { - int namerec = getDB().getInt(record + FIRST_DEF_OFFSET); + long namerec = getDB().getRecPtr(record + FIRST_DEF_OFFSET); return namerec != 0 ? new PDOMName(getLinkage(), namerec) : null; } public void setFirstDefinition(PDOMName name) throws CoreException { - int namerec = name != null ? name.getRecord() : 0; - getDB().putInt(record + FIRST_DEF_OFFSET, namerec); + long namerec = name != null ? name.getRecord() : 0; + getDB().putRecPtr(record + FIRST_DEF_OFFSET, namerec); } public PDOMName getFirstReference() throws CoreException { - int namerec = getDB().getInt(record + FIRST_REF_OFFSET); + long namerec = getDB().getRecPtr(record + FIRST_REF_OFFSET); return namerec != 0 ? new PDOMName(getLinkage(), namerec) : null; } public void setFirstReference(PDOMName name) throws CoreException { - int namerec = name != null ? name.getRecord() : 0; - getDB().putInt(record + FIRST_REF_OFFSET, namerec); + long namerec = name != null ? name.getRecord() : 0; + getDB().putRecPtr(record + FIRST_REF_OFFSET, namerec); } public final PDOMFile getLocalToFile() throws CoreException { - final int filerec = getLocalToFileRec(getDB(), record); + final long filerec = getLocalToFileRec(getDB(), record); return filerec == 0 ? null : new PDOMFile(getLinkage(), filerec); } - public final int getLocalToFileRec() throws CoreException { + public final long getLocalToFileRec() throws CoreException { return getLocalToFileRec(getDB(), record); } - public static int getLocalToFileRec(Database db, int record) throws CoreException { - return db.getInt(record + LOCAL_TO_FILE); + public static long getLocalToFileRec(Database db, long record) throws CoreException { + return db.getRecPtr(record + LOCAL_TO_FILE); } - public final void setLocalToFileRec(int rec) throws CoreException { - getDB().putInt(record + LOCAL_TO_FILE, rec); + public final void setLocalToFileRec(long rec) throws CoreException { + getDB().putRecPtr(record + LOCAL_TO_FILE, rec); } public String getName() { @@ -329,7 +329,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding } final public boolean isFileLocal() throws CoreException { - return getDB().getInt(record + LOCAL_TO_FILE) != 0; + return getDB().getRecPtr(record + LOCAL_TO_FILE) != 0; } public boolean hasDefinition() throws CoreException { @@ -361,8 +361,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding IString s0 = b0.getDBName(), s1 = b1.getDBName(); cmp = s0.compare(s1, true); if (cmp == 0) { - int l1= b0.getLocalToFileRec(); - int l2= b1.getLocalToFileRec(); + long l1= b0.getLocalToFileRec(); + long l2= b1.getLocalToFileRec(); if (l1 != l2) { return l1 < l2 ? -1 : 1; } @@ -444,4 +444,4 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding throws DOMException { return null; } -} \ No newline at end of file +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java index 9d24f494921..37b8f47d812 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java @@ -58,7 +58,7 @@ import org.eclipse.core.runtime.Status; */ public class PDOMFile implements IIndexFragmentFile { private final PDOMLinkage fLinkage; - private final int record; + private final long record; private IIndexFileLocation location; private static final int FIRST_NAME = 0; @@ -81,9 +81,9 @@ public class PDOMFile implements IIndexFragmentFile { this.db = db; } - public int compare(int record1, int record2) throws CoreException { - IString name1 = db.getString(db.getInt(record1 + LOCATION_REPRESENTATION)); - IString name2 = db.getString(db.getInt(record2 + LOCATION_REPRESENTATION)); + public int compare(long record1, long record2) throws CoreException { + IString name1 = db.getString(db.getRecPtr(record1 + LOCATION_REPRESENTATION)); + IString name2 = db.getString(db.getRecPtr(record2 + LOCATION_REPRESENTATION)); int cmp= name1.compare(name2, true); if (cmp == 0) { cmp= db.getInt(record1 + LINKAGE_ID) - db.getInt(record2 + LINKAGE_ID); @@ -92,7 +92,7 @@ public class PDOMFile implements IIndexFragmentFile { } } - public PDOMFile(PDOMLinkage linkage, int record) { + public PDOMFile(PDOMLinkage linkage, long record) { fLinkage = linkage; this.record = record; } @@ -106,7 +106,7 @@ public class PDOMFile implements IIndexFragmentFile { if (locationString==null) throw new CoreException(CCorePlugin.createStatus(Messages.getString("PDOMFile.toInternalProblem")+location.getURI())); //$NON-NLS-1$ IString locationDBString = db.newString(locationString); - db.putInt(record + LOCATION_REPRESENTATION, locationDBString.getRecord()); + db.putRecPtr(record + LOCATION_REPRESENTATION, locationDBString.getRecord()); db.putInt(record + LINKAGE_ID, linkageID); db.putLong(record + TIME_STAMP, 0); setFirstName(null); @@ -115,7 +115,7 @@ public class PDOMFile implements IIndexFragmentFile { setTimestamp(-1); } - public int getRecord() { + public long getRecord() { return record; } @@ -132,7 +132,7 @@ public class PDOMFile implements IIndexFragmentFile { @Override public final int hashCode() { - return System.identityHashCode(fLinkage.getPDOM()) + 41*record; + return System.identityHashCode(fLinkage.getPDOM()) + (int)(41*record); } /** @@ -144,9 +144,9 @@ public class PDOMFile implements IIndexFragmentFile { */ public void setInternalLocation(String internalLocation) throws CoreException { Database db = fLinkage.getDB(); - int oldRecord = db.getInt(record + LOCATION_REPRESENTATION); + long oldRecord = db.getRecPtr(record + LOCATION_REPRESENTATION); db.free(oldRecord); - db.putInt(record + LOCATION_REPRESENTATION, db.newString(internalLocation).getRecord()); + db.putRecPtr(record + LOCATION_REPRESENTATION, db.newString(internalLocation).getRecord()); location= null; } @@ -176,37 +176,37 @@ public class PDOMFile implements IIndexFragmentFile { } private PDOMName getFirstName() throws CoreException { - int namerec = fLinkage.getDB().getInt(record + FIRST_NAME); + long namerec = fLinkage.getDB().getRecPtr(record + FIRST_NAME); return namerec != 0 ? new PDOMName(fLinkage, namerec) : null; } private void setFirstName(PDOMName firstName) throws CoreException { - int namerec = firstName != null ? firstName.getRecord() : 0; - fLinkage.getDB().putInt(record + FIRST_NAME, namerec); + long namerec = firstName != null ? firstName.getRecord() : 0; + fLinkage.getDB().putRecPtr(record + FIRST_NAME, namerec); } private PDOMMacroReferenceName getFirstMacroReference() throws CoreException { - int namerec = fLinkage.getDB().getInt(record + FIRST_MACRO_REFERENCE); + long namerec = fLinkage.getDB().getRecPtr(record + FIRST_MACRO_REFERENCE); return namerec != 0 ? new PDOMMacroReferenceName(fLinkage, namerec) : null; } private void setFirstMacroReference(PDOMMacroReferenceName firstName) throws CoreException { - int namerec = firstName != null ? firstName.getRecord() : 0; - fLinkage.getDB().putInt(record + FIRST_MACRO_REFERENCE, namerec); + long namerec = firstName != null ? firstName.getRecord() : 0; + fLinkage.getDB().putRecPtr(record + FIRST_MACRO_REFERENCE, namerec); } public PDOMInclude getFirstInclude() throws CoreException { - int increc = fLinkage.getDB().getInt(record + FIRST_INCLUDE); + long increc = fLinkage.getDB().getRecPtr(record + FIRST_INCLUDE); return increc != 0 ? new PDOMInclude(fLinkage, increc) : null; } public void setFirstInclude(PDOMInclude include) throws CoreException { - int rec = include != null ? include.getRecord() : 0; - fLinkage.getDB().putInt(record + FIRST_INCLUDE, rec); + long rec = include != null ? include.getRecord() : 0; + fLinkage.getDB().putRecPtr(record + FIRST_INCLUDE, rec); } public PDOMInclude getFirstIncludedBy() throws CoreException { - int rec = fLinkage.getDB().getInt(record + FIRST_INCLUDED_BY); + long rec = fLinkage.getDB().getRecPtr(record + FIRST_INCLUDED_BY); return rec != 0 ? new PDOMInclude(fLinkage, rec) : null; } @@ -215,18 +215,18 @@ public class PDOMFile implements IIndexFragmentFile { } public void setFirstIncludedBy(PDOMInclude includedBy) throws CoreException { - int rec = includedBy != null ? includedBy.getRecord() : 0; - fLinkage.getDB().putInt(record + FIRST_INCLUDED_BY, rec); + long rec = includedBy != null ? includedBy.getRecord() : 0; + fLinkage.getDB().putRecPtr(record + FIRST_INCLUDED_BY, rec); } public PDOMMacro getFirstMacro() throws CoreException { - int rec = fLinkage.getDB().getInt(record + FIRST_MACRO); + long rec = fLinkage.getDB().getRecPtr(record + FIRST_MACRO); return rec != 0 ? new PDOMMacro(fLinkage, rec) : null; } public void setFirstMacro(PDOMMacro macro) throws CoreException { - int rec = macro != null ? macro.getRecord() : 0; - fLinkage.getDB().putInt(record + FIRST_MACRO, rec); + long rec = macro != null ? macro.getRecord() : 0; + fLinkage.getDB().putRecPtr(record + FIRST_MACRO, rec); } public void addMacros(IASTPreprocessorStatement[] macros) throws CoreException { @@ -293,7 +293,7 @@ public class PDOMFile implements IIndexFragmentFile { } } - private IIndexFragmentName createPDOMName(PDOMLinkage linkage, IASTName name, PDOMName caller) { + private IIndexFragmentName createPDOMName(PDOMLinkage linkage, IASTName name, PDOMName caller) throws CoreException { final IBinding binding = name.getBinding(); if (binding instanceof IParameter) { return null; @@ -310,6 +310,9 @@ public class PDOMFile implements IIndexFragmentFile { return result; } } catch (CoreException e) { + if( e.getStatus() != null && e.getStatus().getCode() == CCorePlugin.STATUS_PDOM_TOO_LARGE ) { + throw e; + } CCorePlugin.log(e); } return null; @@ -490,7 +493,7 @@ public class PDOMFile implements IIndexFragmentFile { public static PDOMFile findFile(PDOMLinkage linkage, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy) throws CoreException { String internalRepresentation= strategy.toInternalFormat(location); - int record= 0; + long record= 0; if (internalRepresentation != null) { Finder finder = new Finder(linkage.getDB(), internalRepresentation, linkage.getLinkageID()); btree.accept(finder); @@ -508,7 +511,7 @@ public class PDOMFile implements IIndexFragmentFile { if (internalRepresentation != null) { Finder finder = new Finder(pdom.getDB(), internalRepresentation, -1); btree.accept(finder); - int[] records= finder.getRecords(); + long[] records= finder.getRecords(); PDOMFile[] result= new PDOMFile[records.length]; for (int i = 0; i < result.length; i++) { result[i] = recreateFile(pdom, records[i]); @@ -518,7 +521,7 @@ public class PDOMFile implements IIndexFragmentFile { return new IIndexFragmentFile[0]; } - public static PDOMFile recreateFile(PDOM pdom, final int record) throws CoreException { + public static PDOMFile recreateFile(PDOM pdom, final long record) throws CoreException { final Database db= pdom.getDB(); final int linkageID= db.getInt(record + PDOMFile.LINKAGE_ID); PDOMLinkage linkage= pdom.getLinkage(linkageID); @@ -529,11 +532,11 @@ public class PDOMFile implements IIndexFragmentFile { } private static class Finder implements IBTreeVisitor { - private static final int[] EMPTY = {}; + private static final long[] EMPTY = {}; private final Database db; private final String rawKey; - private int record; - private int[] records; + private long record; + private long[] records; private final int linkageID; /** @@ -545,18 +548,18 @@ public class PDOMFile implements IIndexFragmentFile { this.linkageID= linkageID; } - public int[] getRecords() { + public long[] getRecords() { if (records == null) { if (record == 0) { return EMPTY; } - return new int[] { record }; + return new long[] { record }; } return records; } - public int compare(int record) throws CoreException { - IString name = db.getString(db.getInt(record + PDOMFile.LOCATION_REPRESENTATION)); + public int compare(long record) throws CoreException { + IString name = db.getString(db.getRecPtr(record + PDOMFile.LOCATION_REPRESENTATION)); int cmp= name.compare(rawKey, true); if (cmp == 0 && linkageID >= 0) { cmp= db.getInt(record + PDOMFile.LINKAGE_ID) - linkageID; @@ -564,7 +567,7 @@ public class PDOMFile implements IIndexFragmentFile { return cmp; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { if (linkageID >= 0) { this.record = record; return false; @@ -572,9 +575,9 @@ public class PDOMFile implements IIndexFragmentFile { if (this.record == 0) { this.record= record; } else if (this.records == null) { - this.records= new int[] {this.record, record}; + this.records= new long[] {this.record, record}; } else { - int[] cpy= new int[this.records.length+1]; + long[] cpy= new long[this.records.length+1]; System.arraycopy(this.records, 0, cpy, 0, this.records.length); cpy[cpy.length-1]= record; this.records= cpy; @@ -582,7 +585,7 @@ public class PDOMFile implements IIndexFragmentFile { return linkageID < 0; } - public int getRecord() { + public long getRecord() { return record; } } @@ -590,7 +593,7 @@ public class PDOMFile implements IIndexFragmentFile { public IIndexFileLocation getLocation() throws CoreException { if (location == null) { Database db = fLinkage.getDB(); - String raw = db.getString(db.getInt(record + LOCATION_REPRESENTATION)).getString(); + String raw = db.getString(db.getRecPtr(record + LOCATION_REPRESENTATION)).getString(); location= fLinkage.getPDOM().getLocationConverter().fromInternalFormat(raw); if (location == null) { URI uri; @@ -623,12 +626,12 @@ public class PDOMFile implements IIndexFragmentFile { setFirstIncludedBy(null); } - public int getLastUsingDirectiveRec() throws CoreException { - return fLinkage.getDB().getInt(record + LAST_USING_DIRECTIVE); + public long getLastUsingDirectiveRec() throws CoreException { + return fLinkage.getDB().getRecPtr(record + LAST_USING_DIRECTIVE); } - public void setFirstUsingDirectiveRec(int rec) throws CoreException { - fLinkage.getDB().putInt(record + LAST_USING_DIRECTIVE, rec); + public void setFirstUsingDirectiveRec(long rec) throws CoreException { + fLinkage.getDB().putRecPtr(record + LAST_USING_DIRECTIVE, rec); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java index 52065425ad8..8d686d134e2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java @@ -38,7 +38,7 @@ public class PDOMInclude implements IIndexFragmentInclude { // we store the length of the name instead of the name itself, and indicate that // by turning on FLAG_DEDUCIBLE_NAME flag. Notice that the length of include name // can be different from the node length, if the name is defined by a macro. - private static final int INCLUDE_NAME_OR_LENGTH = 20; + private static final int INCLUDE_NAME_OR_LENGTH = 20; // TODO: assumes that int and stored pointers are the same size private static final int NODE_OFFSET = 24; // 3-byte unsigned int (sufficient for files <= 16mb) private static final int NODE_LENGTH = 27; // short (sufficient for names <= 32k) private static final int FLAGS = 29; @@ -50,12 +50,12 @@ public class PDOMInclude implements IIndexFragmentInclude { private static final int FLAG_DEDUCIBLE_NAME = 0x08; private final PDOMLinkage linkage; - private final int record; + private final long record; // Cached fields private String fName; - public PDOMInclude(PDOMLinkage pdom, int record) { + public PDOMInclude(PDOMLinkage pdom, long record) { this.linkage = pdom; this.record = record; } @@ -75,13 +75,16 @@ public class PDOMInclude implements IIndexFragmentInclude { final Database db = linkage.getDB(); if (targetFile != null) { - db.putInt(record + INCLUDED_FILE, targetFile.getRecord()); + db.putRecPtr(record + INCLUDED_FILE, targetFile.getRecord()); } boolean deducible_name = isDeducibleName(targetFile, nameChars); // If the name is the same as an end part of the path of the included file, // store the length of the name instead of the name itself. - int rec= deducible_name ? nameChars.length : db.newString(nameChars).getRecord(); - db.putInt(record + INCLUDE_NAME_OR_LENGTH, rec); + if( deducible_name ) { + db.putInt( record + INCLUDE_NAME_OR_LENGTH, nameChars.length ); + } else { + db.putRecPtr( record + INCLUDE_NAME_OR_LENGTH, db.newString(nameChars).getRecord() ); + } setFlag(encodeFlags(include, deducible_name)); setIncludedBy(containerFile); } @@ -102,7 +105,7 @@ public class PDOMInclude implements IIndexFragmentInclude { return flags; } - public int getRecord() { + public long getRecord() { return record; } @@ -113,7 +116,7 @@ public class PDOMInclude implements IIndexFragmentInclude { } final Database db = linkage.getDB(); if ((getFlag() & FLAG_DEDUCIBLE_NAME) == 0) { - int rec = db.getInt(record + INCLUDE_NAME_OR_LENGTH); + long rec = db.getRecPtr(record + INCLUDE_NAME_OR_LENGTH); db.getString(rec).delete(); } // Delete our record @@ -134,7 +137,7 @@ public class PDOMInclude implements IIndexFragmentInclude { } public IIndexFragmentFile getIncludes() throws CoreException { - int rec = linkage.getDB().getInt(record + INCLUDED_FILE); + long rec = linkage.getDB().getRecPtr(record + INCLUDED_FILE); return rec != 0 ? new PDOMFile(linkage, rec) : null; } @@ -159,47 +162,47 @@ public class PDOMInclude implements IIndexFragmentInclude { } public IIndexFile getIncludedBy() throws CoreException { - int rec = linkage.getDB().getInt(record + INCLUDED_BY); + long rec = linkage.getDB().getRecPtr(record + INCLUDED_BY); return rec != 0 ? new PDOMFile(linkage, rec) : null; } private void setIncludedBy(PDOMFile includedBy) throws CoreException { - int rec = includedBy != null ? includedBy.getRecord() : 0; - linkage.getDB().putInt(record + INCLUDED_BY, rec); + long rec = includedBy != null ? includedBy.getRecord() : 0; + linkage.getDB().putRecPtr(record + INCLUDED_BY, rec); } public PDOMInclude getNextInIncludes() throws CoreException { - int rec = linkage.getDB().getInt(record + INCLUDES_NEXT); + long rec = linkage.getDB().getRecPtr(record + INCLUDES_NEXT); return rec != 0 ? new PDOMInclude(linkage, rec) : null; } public void setNextInIncludes(PDOMInclude include) throws CoreException { - int rec = include != null ? include.getRecord() : 0; - linkage.getDB().putInt(record + INCLUDES_NEXT, rec); + long rec = include != null ? include.getRecord() : 0; + linkage.getDB().putRecPtr(record + INCLUDES_NEXT, rec); } public PDOMInclude getNextInIncludedBy() throws CoreException { - int rec = linkage.getDB().getInt(record + INCLUDED_BY_NEXT); + long rec = linkage.getDB().getRecPtr(record + INCLUDED_BY_NEXT); return rec != 0 ? new PDOMInclude(linkage, rec) : null; } public void setNextInIncludedBy(PDOMInclude include) throws CoreException { - int rec = include != null ? include.getRecord() : 0; - linkage.getDB().putInt(record + INCLUDED_BY_NEXT, rec); + long rec = include != null ? include.getRecord() : 0; + linkage.getDB().putRecPtr(record + INCLUDED_BY_NEXT, rec); } public PDOMInclude getPrevInIncludedBy() throws CoreException { - int rec = getPrevInIncludedByRecord(); + long rec = getPrevInIncludedByRecord(); return rec != 0 ? new PDOMInclude(linkage, rec) : null; } - int getPrevInIncludedByRecord() throws CoreException { - return linkage.getDB().getInt(record + INCLUDED_BY_PREV); + long getPrevInIncludedByRecord() throws CoreException { + return linkage.getDB().getRecPtr(record + INCLUDED_BY_PREV); } public void setPrevInIncludedBy(PDOMInclude include) throws CoreException { - int rec = include != null ? include.getRecord() : 0; - linkage.getDB().putInt(record + INCLUDED_BY_PREV, rec); + long rec = include != null ? include.getRecord() : 0; + linkage.getDB().putRecPtr(record + INCLUDED_BY_PREV, rec); } public IIndexFileLocation getIncludedByLocation() throws CoreException { @@ -232,7 +235,7 @@ public class PDOMInclude implements IIndexFragmentInclude { } public boolean isResolved() throws CoreException { - return linkage.getDB().getInt(record + INCLUDED_FILE) != 0; + return linkage.getDB().getRecPtr(record + INCLUDED_FILE) != 0; } public boolean isResolvedByHeuristics() throws CoreException { @@ -253,7 +256,7 @@ public class PDOMInclude implements IIndexFragmentInclude { // The include name is either stored explicitly, or can be deduced from the path // of the included file. if ((getFlag() & FLAG_DEDUCIBLE_NAME) == 0) { - int rec = db.getInt(record + INCLUDE_NAME_OR_LENGTH); + long rec = db.getRecPtr(record + INCLUDE_NAME_OR_LENGTH); fName = db.getString(rec).getString(); } else { String path = getIncludes().getLocation().getURI().getPath(); @@ -276,11 +279,11 @@ public class PDOMInclude implements IIndexFragmentInclude { int flag = getFlag(); // Since included file is going away, the name is no longer deducible. if ((flag & FLAG_DEDUCIBLE_NAME) != 0) { - int rec= db.newString(getFullName()).getRecord(); - db.putInt(record + INCLUDE_NAME_OR_LENGTH, rec); + long rec= db.newString(getFullName()).getRecord(); + db.putRecPtr(record + INCLUDE_NAME_OR_LENGTH, rec); setFlag((byte) (flag & ~FLAG_DEDUCIBLE_NAME)); } - db.putInt(record + INCLUDED_FILE, 0); + db.putRecPtr(record + INCLUDED_FILE, 0); } } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java index aae94387ee7..31046feb2fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java @@ -64,7 +64,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage @SuppressWarnings("hiding") protected static final int RECORD_SIZE = PDOMNamedNode.RECORD_SIZE + 20; - protected static final int[] FILE_LOCAL_REC_DUMMY = new int[]{0}; + protected static final long[] FILE_LOCAL_REC_DUMMY = new long[]{0}; // node types protected static final int LINKAGE= 0; // special one for myself @@ -73,7 +73,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage private final PDOM fPDOM; private final Database fDatabase; - public PDOMLinkage(PDOM pdom, int record) { + public PDOMLinkage(PDOM pdom, long record) { super(null, record); fPDOM= pdom; fDatabase= pdom.getDB(); @@ -85,7 +85,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage fPDOM= pdom; fDatabase= db; - db.putInt(record + ID_OFFSET, db.newString(languageId).getRecord()); + db.putRecPtr(record + ID_OFFSET, db.newString(languageId).getRecord()); pdom.insertLinkage(this); } @@ -114,18 +114,18 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage return LINKAGE; } - public static IString getLinkageID(PDOM pdom, int record) throws CoreException { + public static IString getLinkageID(PDOM pdom, long record) throws CoreException { Database db = pdom.getDB(); - int namerec = db.getInt(record + ID_OFFSET); + long namerec = db.getRecPtr(record + ID_OFFSET); return db.getString(namerec); } - public static int getNextLinkageRecord(PDOM pdom, int record) throws CoreException { - return pdom.getDB().getInt(record + NEXT_OFFSET); + public static long getNextLinkageRecord(PDOM pdom, long record) throws CoreException { + return pdom.getDB().getRecPtr(record + NEXT_OFFSET); } - public void setNext(int nextrec) throws CoreException { - getDB().putInt(record + NEXT_OFFSET, nextrec); + public void setNext(long nextrec) throws CoreException { + getDB().putRecPtr(record + NEXT_OFFSET, nextrec); } public BTree getIndex() throws CoreException { @@ -146,10 +146,10 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage getIndex().accept((IBTreeVisitor) visitor); } else { getIndex().accept(new IBTreeVisitor() { - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { PDOMNode node= getNode(record); if (node != null) { if (visitor.visit(node)) @@ -168,14 +168,14 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage getIndex().insert(child.getRecord()); } - public final PDOMBinding getBinding(int record) throws CoreException { + public final PDOMBinding getBinding(long record) throws CoreException { final PDOMNode node= getNode(record); if (node instanceof PDOMBinding) return (PDOMBinding) node; return null; } - public PDOMNode getNode(int record) throws CoreException { + public PDOMNode getNode(long record) throws CoreException { switch (PDOMNode.getNodeType(fDatabase, record)) { case POINTER_TYPE: return new PDOMPointerType(this, record); @@ -230,8 +230,8 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage public abstract PDOMBinding adaptBinding(IBinding binding) throws CoreException; public abstract PDOMBinding addBinding(IASTName name) throws CoreException; - final protected int getLocalToFileRec(PDOMNode parent, IBinding binding, PDOMBinding glob) throws CoreException { - int rec= 0; + final protected long getLocalToFileRec(PDOMNode parent, IBinding binding, PDOMBinding glob) throws CoreException { + long rec= 0; if (parent instanceof PDOMBinding) { rec= ((PDOMBinding) parent).getLocalToFileRec(); } @@ -334,7 +334,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage } } - public void deleteType(IType type, int ownerRec) throws CoreException { + public void deleteType(IType type, long ownerRec) throws CoreException { if (type instanceof PDOMNode) { PDOMNode node= (PDOMNode) type; // at this point only delete types that are actually owned by the requesting party. @@ -442,7 +442,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage } private CharArrayMap getBindingMap() { - final Integer key= getRecord(); + final Long key= getRecord(); final PDOM pdom = getPDOM(); @SuppressWarnings("unchecked") Reference> cached= (Reference>) pdom.getCachedResult(key); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java index 8c387de7de2..756e16c2f02 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java @@ -59,14 +59,14 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { private static final char[] UNINITIALIZED1= {}; private final PDOMLinkage fLinkage; - private final int fRecord; + private final long fRecord; private char[][] fParameterList= UNINITIALIZED; private char[] fExpansion= UNINITIALIZED1; private PDOMMacroContainer fContainer; private PDOMMacroDefinitionName fDefinition; - public PDOMMacro(PDOMLinkage linkage, int record) { + public PDOMMacro(PDOMLinkage linkage, long record) { fLinkage = linkage; fRecord = record; } @@ -80,14 +80,14 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { final char[][] params= binding.getParameterList(); final Database db= linkage.getDB(); - db.putInt(fRecord + EXPANSION, db.newString(binding.getExpansionImage()).getRecord()); + db.putRecPtr(fRecord + EXPANSION, db.newString(binding.getExpansionImage()).getRecord()); if (params != null) { StringBuilder buf= new StringBuilder(); for (char[] param : params) { buf.append(param); buf.append(','); } - db.putInt(fRecord + PARAMETERS, db.newString(buf.toString().toCharArray()).getRecord()); + db.putRecPtr(fRecord + PARAMETERS, db.newString(buf.toString().toCharArray()).getRecord()); } } @@ -104,8 +104,8 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { fContainer= container; final IASTFileLocation fileloc = name.getFileLocation(); - db.putInt(fRecord + CONTAINER, container.getRecord()); - db.putInt(fRecord + FILE, file.getRecord()); + db.putRecPtr(fRecord + CONTAINER, container.getRecord()); + db.putRecPtr(fRecord + FILE, file.getRecord()); db.putInt(fRecord + NAME_OFFSET, fileloc.getNodeOffset()); db.putShort(fRecord + NAME_LENGTH, (short) fileloc.getNodeLength()); @@ -116,7 +116,7 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { return fLinkage.getPDOM(); } - public int getRecord() { + public long getRecord() { return fRecord; } @@ -149,25 +149,25 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { public PDOMMacroContainer getContainer() throws CoreException { if (fContainer == null) { - fContainer= new PDOMMacroContainer(fLinkage, fLinkage.getDB().getInt(fRecord + CONTAINER)); + fContainer= new PDOMMacroContainer(fLinkage, fLinkage.getDB().getRecPtr(fRecord + CONTAINER)); } return fContainer; } private IString getExpansionInDB() throws CoreException { Database db = fLinkage.getDB(); - int rec = db.getInt(fRecord + EXPANSION); + long rec = db.getRecPtr(fRecord + EXPANSION); return rec == 0 ? null : db.getString(rec); } private IString getParamListInDB() throws CoreException { Database db = fLinkage.getDB(); - int rec = db.getInt(fRecord + PARAMETERS); + long rec = db.getRecPtr(fRecord + PARAMETERS); return rec == 0 ? null : db.getString(rec); } public PDOMMacro getNextMacro() throws CoreException { - int rec = fLinkage.getDB().getInt(fRecord + NEXT_IN_FILE); + long rec = fLinkage.getDB().getRecPtr(fRecord + NEXT_IN_FILE); return rec != 0 ? new PDOMMacro(fLinkage, rec) : null; } @@ -175,8 +175,8 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { setNextMacro(macro != null ? macro.getRecord() : 0); } - private void setNextMacro(int rec) throws CoreException { - fLinkage.getDB().putInt(fRecord + NEXT_IN_FILE, rec); + private void setNextMacro(long rec) throws CoreException { + fLinkage.getDB().putRecPtr(fRecord + NEXT_IN_FILE, rec); } private PDOMMacro getPrevInContainer() throws CoreException { @@ -196,12 +196,12 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { } private void setMacroField(int offset, PDOMMacro macro) throws CoreException { - int namerec = macro != null ? macro.getRecord() : 0; - fLinkage.getDB().putInt(fRecord + offset, namerec); + long namerec = macro != null ? macro.getRecord() : 0; + fLinkage.getDB().putRecPtr(fRecord + offset, namerec); } private PDOMMacro getMacroField(int offset) throws CoreException { - int namerec= fLinkage.getDB().getInt(fRecord + offset); + long namerec= fLinkage.getDB().getRecPtr(fRecord + offset); return namerec != 0 ? new PDOMMacro(fLinkage, namerec) : null; } @@ -232,7 +232,7 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { public boolean isMacroDefinition() throws CoreException { if (fExpansion == UNINITIALIZED1) { - return fLinkage.getDB().getInt(fRecord + EXPANSION) != 0; + return fLinkage.getDB().getRecPtr(fRecord + EXPANSION) != 0; } return fExpansion != null; } @@ -264,7 +264,7 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { } public PDOMFile getFile() throws CoreException { - int filerec = fLinkage.getDB().getInt(fRecord + FILE); + long filerec = fLinkage.getDB().getRecPtr(fRecord + FILE); return filerec != 0 ? new PDOMFile(fLinkage, filerec) : null; } @@ -408,7 +408,7 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { public void accept(IPDOMVisitor visitor) { } - public int getBindingID() { + public long getBindingID() { return fRecord; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroContainer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroContainer.java index d5cf2ce0708..00a21446f36 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroContainer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroContainer.java @@ -39,7 +39,7 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont super(linkage, linkage, name); } - PDOMMacroContainer(PDOMLinkage linkage, int record) { + PDOMMacroContainer(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -55,8 +55,8 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont public boolean isOrphaned() throws CoreException { Database db = getDB(); - return db.getInt(record + FIRST_DEF_OFFSET) == 0 - && db.getInt(record + FIRST_REF_OFFSET) == 0; + return db.getRecPtr(record + FIRST_DEF_OFFSET) == 0 + && db.getRecPtr(record + FIRST_REF_OFFSET) == 0; } public void addDefinition(PDOMMacro name) throws CoreException { @@ -78,23 +78,23 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont } public PDOMMacro getFirstDefinition() throws CoreException { - int namerec = getDB().getInt(record + FIRST_DEF_OFFSET); + long namerec = getDB().getRecPtr(record + FIRST_DEF_OFFSET); return namerec != 0 ? new PDOMMacro(getLinkage(), namerec) : null; } void setFirstDefinition(PDOMMacro macro) throws CoreException { - int namerec = macro != null ? macro.getRecord() : 0; - getDB().putInt(record + FIRST_DEF_OFFSET, namerec); + long namerec = macro != null ? macro.getRecord() : 0; + getDB().putRecPtr(record + FIRST_DEF_OFFSET, namerec); } public PDOMMacroReferenceName getFirstReference() throws CoreException { - int namerec = getDB().getInt(record + FIRST_REF_OFFSET); + long namerec = getDB().getRecPtr(record + FIRST_REF_OFFSET); return namerec != 0 ? new PDOMMacroReferenceName(getLinkage(), namerec) : null; } void setFirstReference(PDOMMacroReferenceName nextName) throws CoreException { - int namerec = nextName != null ? nextName.getRecord() : 0; - getDB().putInt(record + FIRST_REF_OFFSET, namerec); + long namerec = nextName != null ? nextName.getRecord() : 0; + getDB().putRecPtr(record + FIRST_REF_OFFSET, namerec); } public IIndexMacro[] getDefinitions() throws CoreException { @@ -134,7 +134,7 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont } public boolean hasDefinition() throws CoreException { - return getDB().getInt(record + FIRST_DEF_OFFSET) != 0; + return getDB().getRecPtr(record + FIRST_DEF_OFFSET) != 0; } public IIndexFile getLocalToFile() throws CoreException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroReferenceName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroReferenceName.java index 96fad1faa25..60f4b027f68 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroReferenceName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacroReferenceName.java @@ -30,7 +30,7 @@ import org.eclipse.core.runtime.IPath; */ public final class PDOMMacroReferenceName implements IIndexFragmentName, IASTFileLocation { private final PDOMLinkage linkage; - private final int record; + private final long record; private static final int FILE_REC_OFFSET = 0; private static final int FILE_NEXT_OFFSET = 4; @@ -48,8 +48,8 @@ public final class PDOMMacroReferenceName implements IIndexFragmentName, IASTFil Database db = linkage.getDB(); record = db.malloc(RECORD_SIZE); - db.putInt(record + CONTAINER_REC_OFFSET, container.getRecord()); - db.putInt(record + FILE_REC_OFFSET, file.getRecord()); + db.putRecPtr(record + CONTAINER_REC_OFFSET, container.getRecord()); + db.putRecPtr(record + FILE_REC_OFFSET, file.getRecord()); // Record our location in the file IASTFileLocation fileloc = name.getFileLocation(); @@ -58,35 +58,35 @@ public final class PDOMMacroReferenceName implements IIndexFragmentName, IASTFil container.addReference(this); } - public PDOMMacroReferenceName(PDOMLinkage linkage, int nameRecord) { + public PDOMMacroReferenceName(PDOMLinkage linkage, long nameRecord) { this.linkage = linkage; this.record = nameRecord; } - public int getRecord() { + public long getRecord() { return record; } - private int getRecField(int offset) throws CoreException { - return linkage.getDB().getInt(record + offset); + private long getRecField(int offset) throws CoreException { + return linkage.getDB().getRecPtr(record + offset); } - private void setRecField(int offset, int fieldrec) throws CoreException { - linkage.getDB().putInt(record + offset, fieldrec); + private void setRecField(int offset, long fieldrec) throws CoreException { + linkage.getDB().putRecPtr(record + offset, fieldrec); } public PDOMMacroContainer getContainer() throws CoreException { - int bindingrec = getRecField(CONTAINER_REC_OFFSET); + long bindingrec = getRecField(CONTAINER_REC_OFFSET); return new PDOMMacroContainer(linkage, bindingrec); } private PDOMMacroReferenceName getNameField(int offset) throws CoreException { - int namerec = getRecField(offset); + long namerec = getRecField(offset); return namerec != 0 ? new PDOMMacroReferenceName(linkage, namerec) : null; } private void setNameField(int offset, PDOMMacroReferenceName name) throws CoreException { - int namerec = name != null ? name.getRecord() : 0; + long namerec = name != null ? name.getRecord() : 0; setRecField(offset, namerec); } @@ -107,7 +107,7 @@ public final class PDOMMacroReferenceName implements IIndexFragmentName, IASTFil } public PDOMFile getFile() throws CoreException { - int filerec = linkage.getDB().getInt(record + FILE_REC_OFFSET); + long filerec = linkage.getDB().getRecPtr(record + FILE_REC_OFFSET); return filerec != 0 ? new PDOMFile(linkage, filerec) : null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java index 495e882d508..5d2a4518274 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java @@ -31,7 +31,7 @@ import org.eclipse.core.runtime.IPath; */ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { private final PDOMLinkage linkage; - private final int record; + private final long record; private static final int FILE_REC_OFFSET = 0; private static final int FILE_NEXT_OFFSET = 4; @@ -81,11 +81,11 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { break; } - db.putInt(record + BINDING_REC_OFFSET, binding.getRecord()); + db.putRecPtr(record + BINDING_REC_OFFSET, binding.getRecord()); - db.putInt(record + FILE_REC_OFFSET, file.getRecord()); + db.putRecPtr(record + FILE_REC_OFFSET, file.getRecord()); if (caller != null) { - db.putInt(record + CALLER_REC_OFFSET, caller.getRecord()); + db.putRecPtr(record + CALLER_REC_OFFSET, caller.getRecord()); } // Record our location in the file @@ -104,40 +104,40 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { return IS_REFERENCE; } - public PDOMName(PDOMLinkage linkage, int nameRecord) { + public PDOMName(PDOMLinkage linkage, long nameRecord) { this.linkage = linkage; this.record = nameRecord; } - public int getRecord() { + public long getRecord() { return record; } - private int getRecField(int offset) throws CoreException { - return linkage.getDB().getInt(record + offset); + private long getRecField(int offset) throws CoreException { + return linkage.getDB().getRecPtr(record + offset); } - private void setRecField(int offset, int fieldrec) throws CoreException { - linkage.getDB().putInt(record + offset, fieldrec); + private void setRecField(int offset, long fieldrec) throws CoreException { + linkage.getDB().putRecPtr(record + offset, fieldrec); } public PDOMBinding getBinding() throws CoreException { - int bindingrec = getRecField(BINDING_REC_OFFSET); + long bindingrec = getRecField(BINDING_REC_OFFSET); return linkage.getBinding(bindingrec); } public void setBinding(PDOMBinding binding) throws CoreException { - int bindingrec = binding != null ? binding.getRecord() : 0; + long bindingrec = binding != null ? binding.getRecord() : 0; setRecField(BINDING_REC_OFFSET, bindingrec); } private PDOMName getNameField(int offset) throws CoreException { - int namerec = getRecField(offset); + long namerec = getRecField(offset); return namerec != 0 ? new PDOMName(linkage, namerec) : null; } private void setNameField(int offset, PDOMName name) throws CoreException { - int namerec = name != null ? name.getRecord() : 0; + long namerec = name != null ? name.getRecord() : 0; setRecField(offset, namerec); } @@ -158,17 +158,17 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { } public PDOMFile getFile() throws CoreException { - int filerec = linkage.getDB().getInt(record + FILE_REC_OFFSET); + long filerec = linkage.getDB().getRecPtr(record + FILE_REC_OFFSET); return filerec != 0 ? new PDOMFile(linkage, filerec) : null; } public IIndexName getEnclosingDefinition() throws CoreException { - int namerec = getEnclosingDefinitionRecord(); + long namerec = getEnclosingDefinitionRecord(); return namerec != 0 ? new PDOMName(linkage, namerec) : null; } - int getEnclosingDefinitionRecord() throws CoreException { - return linkage.getDB().getInt(record + CALLER_REC_OFFSET); + long getEnclosingDefinitionRecord() throws CoreException { + return linkage.getDB().getRecPtr(record + CALLER_REC_OFFSET); } public PDOMName getNextInFile() throws CoreException { @@ -190,7 +190,7 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { public char[] getSimpleID() { try { Database db = linkage.getDB(); - int bindingRec = db.getInt(record + BINDING_REC_OFFSET); + long bindingRec = db.getRecPtr(record + BINDING_REC_OFFSET); PDOMBinding binding = linkage.getBinding(bindingRec); return binding != null ? binding.getNameCharArray() : null; } catch (CoreException e) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNamedNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNamedNode.java index 86c4991e229..62415d0358b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNamedNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNamedNode.java @@ -42,7 +42,7 @@ public abstract class PDOMNamedNode extends PDOMNode { private char[] fName; - public PDOMNamedNode(PDOMLinkage linkage, int record) { + public PDOMNamedNode(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -51,7 +51,7 @@ public abstract class PDOMNamedNode extends PDOMNode { fName= name; final Database db = linkage.getDB(); - db.putInt(record + NAME, name != null ? db.newString(name).getRecord() : 0); + db.putRecPtr(record + NAME, name != null ? db.newString(name).getRecord() : 0); } /** @@ -60,7 +60,7 @@ public abstract class PDOMNamedNode extends PDOMNode { protected PDOMNamedNode(Database db, char[] name) throws CoreException { super(db); fName= name; - db.putInt(record + NAME, name != null ? db.newString(name).getRecord() : 0); + db.putRecPtr(record + NAME, name != null ? db.newString(name).getRecord() : 0); } @Override @@ -70,8 +70,8 @@ public abstract class PDOMNamedNode extends PDOMNode { return getDBName(getDB(), record); } - public static IString getDBName(Database db, int record) throws CoreException { - int namerec = db.getInt(record + NAME); + public static IString getDBName(Database db, long record) throws CoreException { + long namerec = db.getRecPtr(record + NAME); return db.getString(namerec); } @@ -101,7 +101,7 @@ public abstract class PDOMNamedNode extends PDOMNode { if (!name.equals(nameCharArray)) { name.delete(); final Database db= getDB(); - db.putInt(record + NAME, db.newString(nameCharArray).getRecord()); + db.putRecPtr(record + NAME, db.newString(nameCharArray).getRecord()); } fName= nameCharArray; } @@ -110,7 +110,7 @@ public abstract class PDOMNamedNode extends PDOMNode { @Override public void delete(PDOMLinkage linkage) throws CoreException { final Database db = getDB(); - final int namerec= db.getInt(record + NAME); + final long namerec= db.getRecPtr(record + NAME); if (namerec != 0) { db.free(namerec); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNode.java index 98db8afb614..3e5fc950d23 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNode.java @@ -32,11 +32,11 @@ public abstract class PDOMNode implements IInternalPDOMNode { protected static final int RECORD_SIZE = 8; private final PDOMLinkage fLinkage; - protected final int record; + protected final long record; - private int cachedParentRecord; + private long cachedParentRecord; - protected PDOMNode(PDOMLinkage linkage, int record) { + protected PDOMNode(PDOMLinkage linkage, long record) { fLinkage = linkage; this.record = record; } @@ -52,14 +52,14 @@ public abstract class PDOMNode implements IInternalPDOMNode { this(db, null, 0); } - protected PDOMNode(Database db, PDOMLinkage linkage, int parentRec) throws CoreException { + protected PDOMNode(Database db, PDOMLinkage linkage, long parentRec) throws CoreException { this.fLinkage = linkage; record = db.malloc(getRecordSize()); db.putInt(record + TYPE, getNodeType()); cachedParentRecord= parentRec; - db.putInt(record + PARENT, parentRec); + db.putRecPtr(record + PARENT, parentRec); } protected Database getDB() { @@ -78,11 +78,11 @@ public abstract class PDOMNode implements IInternalPDOMNode { public abstract int getNodeType(); - public final int getRecord() { + public final long getRecord() { return record; } - public final int getBindingID() { + public final long getBindingID() { return record; } @@ -113,26 +113,26 @@ public abstract class PDOMNode implements IInternalPDOMNode { @Override public final int hashCode() { - return System.identityHashCode(getPDOM()) + 41*record; + return System.identityHashCode(getPDOM()) + (int)(41*record); } public void accept(IPDOMVisitor visitor) throws CoreException { // No children here. } - public static int getNodeType(Database db, int record) throws CoreException { + public static int getNodeType(Database db, long record) throws CoreException { return db.getInt(record + TYPE); } - public int getParentNodeRec() throws CoreException { + public long getParentNodeRec() throws CoreException { if (cachedParentRecord != 0) { return cachedParentRecord; } - return cachedParentRecord= getDB().getInt(record + PARENT); + return cachedParentRecord= getDB().getRecPtr(record + PARENT); } public PDOMNode getParentNode() throws CoreException { - int parentrec = getParentNodeRec(); + long parentrec = getParentNodeRec(); return parentrec != 0 ? getLinkage().getNode(parentrec) : null; } @@ -145,7 +145,7 @@ public abstract class PDOMNode implements IInternalPDOMNode { * @param offset Location of the byte. * @return a byte from the database. */ - protected byte getByte(int offset) { + protected byte getByte(long offset) { try { return getDB().getByte(offset); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMPointerType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMPointerType.java index a4a3c64821a..bee454e937f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMPointerType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMPointerType.java @@ -48,7 +48,7 @@ public class PDOMPointerType extends PDOMNode implements IPointerType, private byte flags= -1; private IType targetType; - public PDOMPointerType(PDOMLinkage linkage, int record) { + public PDOMPointerType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -59,7 +59,7 @@ public class PDOMPointerType extends PDOMNode implements IPointerType, try { // type - int typeRec = 0; + long typeRec = 0; byte flags = 0; if (type != null) { IType targetType= type.getType(); @@ -71,7 +71,7 @@ public class PDOMPointerType extends PDOMNode implements IPointerType, if (type.isVolatile()) flags |= VOLATILE; } - db.putInt(record + TYPE, typeRec); + db.putRecPtr(record + TYPE, typeRec); db.putByte(record + FLAGS, flags); } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); @@ -104,7 +104,7 @@ public class PDOMPointerType extends PDOMNode implements IPointerType, private IType readType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java index 4c96359d105..b4bd58a5155 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java @@ -47,7 +47,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua private byte flags= -1; private IType targetType; - public PDOMQualifierType(PDOMLinkage linkage, int record) { + public PDOMQualifierType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -62,7 +62,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua IType targetType = type.getType(); PDOMNode targetTypeNode = getLinkage().addType(this, targetType); if (targetTypeNode != null) { - db.putInt(record + TYPE, targetTypeNode.getRecord()); + db.putRecPtr(record + TYPE, targetTypeNode.getRecord()); } // flags byte flags = 0; @@ -98,7 +98,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua private IType readType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMValue.java index e6da5ee943f..b52bbb35f77 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMValue.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMValue.java @@ -26,14 +26,14 @@ public class PDOMValue { * Stores a value and returns the offset of where it was stored. * @throws CoreException */ - public static int store(Database db, PDOMLinkage linkage, IValue val) throws CoreException { + public static long store(Database db, PDOMLinkage linkage, IValue val) throws CoreException { if (val == null) return 0; final IBinding[] unknown= val.getUnknownBindings(); - int[] unknownRecs= {}; + long[] unknownRecs= {}; if (unknown.length != 0) { - unknownRecs= new int[unknown.length]; + unknownRecs= new long[unknown.length]; for (int i = 0; i < unknown.length; i++) { PDOMNode node= linkage.addUnknownValue(unknown[i]); if (node == null) { @@ -44,15 +44,15 @@ public class PDOMValue { } final short len= (short) Math.min(unknown.length, (Database.MAX_MALLOC_SIZE-6)/4); - final int block= db.malloc(6+4*len); - final int repRec= db.newString(val.getInternalExpression()).getRecord(); + final long block= db.malloc(6+4*len); + final long repRec= db.newString(val.getInternalExpression()).getRecord(); db.putShort(block, len); - db.putInt(block+2, repRec); + db.putRecPtr(block+2, repRec); - int p= block+6; + long p= block+6; for (int i = 0; i < len; i++) { - db.putInt(p, unknownRecs[i]); + db.putRecPtr(p, unknownRecs[i]); p+= 4; } return block; @@ -62,21 +62,21 @@ public class PDOMValue { * Restores a value from the given record * @throws CoreException */ - public static IValue restore(Database db, PDOMLinkage linkage, int valRec) throws CoreException { + public static IValue restore(Database db, PDOMLinkage linkage, long valRec) throws CoreException { if (valRec == 0) return null; final int len= db.getShort(valRec); - final int repRec = db.getInt(valRec+2); + final long repRec = db.getRecPtr(valRec+2); final char[] rep= db.getString(repRec).getChars(); if (len == 0) return Value.fromInternalRepresentation(rep, ICPPUnknownBinding.EMPTY_UNKNOWN_BINDING_ARRAY); ICPPUnknownBinding[] unknown= new ICPPUnknownBinding[len]; - int p= valRec+6; + long p= valRec+6; for (int i = 0; i < unknown.length; i++) { - int rec= db.getInt(p); + long rec= db.getRecPtr(p); PDOMNode node= linkage.getNode(rec); if (node instanceof ICPPUnknownBinding) { unknown[i]= (ICPPUnknownBinding) node; @@ -92,10 +92,10 @@ public class PDOMValue { /** * Deletes a value stored at the given record. */ - public static void delete(Database db, int valueRec) throws CoreException { + public static void delete(Database db, long valueRec) throws CoreException { if (valueRec == 0) return; - final int repRec = db.getInt(valueRec+2); + final long repRec = db.getRecPtr(valueRec+2); db.getString(repRec).delete(); db.free(valueRec); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java index f852a8d88eb..eceaa4a1249 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java @@ -45,7 +45,7 @@ class PDOMCBasicType extends PDOMNode implements ICBasicType, IIndexType { public static final int IS_IMAGINARY = 0x20; public static final int IS_COMPLEX = 0x40; - public PDOMCBasicType(PDOMLinkage linkage, int record) { + public PDOMCBasicType(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java index 9918633f030..c29c993bbda 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java @@ -44,7 +44,7 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType { super(linkage, parent, enumeration.getNameCharArray()); } - public PDOMCEnumeration(PDOMLinkage linkage, int record) { + public PDOMCEnumeration(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -77,14 +77,14 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType { } private PDOMCEnumerator getFirstEnumerator() throws CoreException { - int value = getDB().getInt(record + FIRST_ENUMERATOR); + long value = getDB().getRecPtr(record + FIRST_ENUMERATOR); return value != 0 ? new PDOMCEnumerator(getLinkage(), value) : null; } public void addEnumerator(PDOMCEnumerator enumerator) throws CoreException { PDOMCEnumerator first = getFirstEnumerator(); enumerator.setNextEnumerator(first); - getDB().putInt(record + FIRST_ENUMERATOR, enumerator.getRecord()); + getDB().putRecPtr(record + FIRST_ENUMERATOR, enumerator.getRecord()); } public boolean isSameType(IType type) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java index 5206011f68a..68a33392c04 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java @@ -41,12 +41,12 @@ class PDOMCEnumerator extends PDOMBinding implements IEnumerator { super(linkage, parent, enumerator.getNameCharArray()); final Database db = getDB(); - db.putInt(record + ENUMERATION, enumeration.getRecord()); + db.putRecPtr(record + ENUMERATION, enumeration.getRecord()); storeValue(db, enumerator); enumeration.addEnumerator(this); } - public PDOMCEnumerator(PDOMLinkage linkage, int record) { + public PDOMCEnumerator(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -76,18 +76,18 @@ class PDOMCEnumerator extends PDOMBinding implements IEnumerator { public PDOMCEnumerator getNextEnumerator() throws CoreException { - int value = getDB().getInt(record + NEXT_ENUMERATOR); + long value = getDB().getRecPtr(record + NEXT_ENUMERATOR); return value != 0 ? new PDOMCEnumerator(getLinkage(), value) : null; } public void setNextEnumerator(PDOMCEnumerator enumerator) throws CoreException { - int value = enumerator != null ? enumerator.getRecord() : 0; - getDB().putInt(record + NEXT_ENUMERATOR, value); + long value = enumerator != null ? enumerator.getRecord() : 0; + getDB().putRecPtr(record + NEXT_ENUMERATOR, value); } public IType getType() throws DOMException { try { - return new PDOMCEnumeration(getLinkage(), getDB().getInt(record + ENUMERATION)); + return new PDOMCEnumeration(getLinkage(), getDB().getRecPtr(record + ENUMERATION)); } catch (CoreException e) { CCorePlugin.log(e); return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java index 2a2dcd77f02..44511a16da7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java @@ -31,7 +31,7 @@ class PDOMCField extends PDOMCVariable implements IField { super(linkage, (PDOMNode) parent, field); } - public PDOMCField(PDOMLinkage linkage, int record) { + public PDOMCField(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java index e747de0e14e..19adb6cbbe9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java @@ -63,7 +63,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction { @SuppressWarnings("hiding") public static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 13; - public PDOMCFunction(PDOMLinkage linkage, int record) { + public PDOMCFunction(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -115,34 +115,34 @@ class PDOMCFunction extends PDOMBinding implements IFunction { } private void setType(PDOMLinkage linkage, IFunctionType ft) throws CoreException { - int rec= 0; + long rec= 0; if (ft != null) { PDOMNode typeNode = linkage.addType(this, ft); if (typeNode != null) { rec= typeNode.getRecord(); } } - getDB().putInt(record + FUNCTION_TYPE, rec); + getDB().putRecPtr(record + FUNCTION_TYPE, rec); } private void setParameters(IParameter[] params) throws CoreException { getDB().putInt(record + NUM_PARAMS, params.length); - getDB().putInt(record + FIRST_PARAM, 0); + getDB().putRecPtr(record + FIRST_PARAM, 0); for (int i = 0; i < params.length; ++i) { setFirstParameter(new PDOMCParameter(getLinkage(), this, params[i])); } } public PDOMCParameter getFirstParameter() throws CoreException { - int rec = getDB().getInt(record + FIRST_PARAM); + long rec = getDB().getRecPtr(record + FIRST_PARAM); return rec != 0 ? new PDOMCParameter(getLinkage(), rec) : null; } public void setFirstParameter(PDOMCParameter param) throws CoreException { if (param != null) param.setNextParameter(getFirstParameter()); - int rec = param != null ? param.getRecord() : 0; - getDB().putInt(record + FIRST_PARAM, rec); + long rec = param != null ? param.getRecord() : 0; + getDB().putRecPtr(record + FIRST_PARAM, rec); } @@ -165,7 +165,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction { * both the IType and IBinding interfaces. */ try { - int offset= getDB().getInt(record + FUNCTION_TYPE); + long offset= getDB().getRecPtr(record + FUNCTION_TYPE); return offset==0 ? null : new PDOMCFunctionType(getLinkage(), offset); } catch(CoreException ce) { CCorePlugin.log(ce); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java index 8f720c243b1..90ab3494e5d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java @@ -54,7 +54,7 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction private IType[] parameterTypes; - public PDOMCFunctionType(PDOMLinkage linkage, int record) { + public PDOMCFunctionType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -177,7 +177,7 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction public IType getReturnType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + RETURN_TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + RETURN_TYPE)); if (node instanceof IType) { return (IType) node; } @@ -190,7 +190,7 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction public void setReturnType(IType type) throws CoreException { PDOMNode typeNode = getLinkage().addType(this, type); if (typeNode != null) { - getDB().putInt(record + RETURN_TYPE, typeNode.getRecord()); + getDB().putRecPtr(record + RETURN_TYPE, typeNode.getRecord()); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java index 625026c5a75..20146951192 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java @@ -47,7 +47,7 @@ import org.eclipse.core.runtime.CoreException; */ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { - public PDOMCLinkage(PDOM pdom, int record) { + public PDOMCLinkage(PDOM pdom, long record) { super(pdom, record); } @@ -85,7 +85,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { if (parent == null) return null; - int[] localToFileHolder= {0}; + long[] localToFileHolder= {0}; pdomBinding = adaptBinding(parent, binding, localToFileHolder); if (pdomBinding == null) { pdomBinding = createBinding(parent, binding, localToFileHolder[0]); @@ -104,7 +104,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { return pdomBinding; } - private PDOMBinding createBinding(PDOMNode parent, IBinding binding, int localToFile) throws CoreException { + private PDOMBinding createBinding(PDOMNode parent, IBinding binding, long localToFile) throws CoreException { PDOMBinding pdomBinding= null; if (binding instanceof IField) { // must be before IVariable @@ -230,7 +230,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { return adaptBinding(null, inputBinding, FILE_LOCAL_REC_DUMMY); } - private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, int[] localToFileHolder) throws CoreException { + private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] localToFileHolder) throws CoreException { if (inputBinding instanceof CompositeIndexBinding) { inputBinding= ((CompositeIndexBinding) inputBinding).getRawBinding(); } @@ -256,7 +256,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { return result; } - private final PDOMBinding doAdaptBinding(PDOMNode parent, final IBinding binding, int[] localToFileHolder) throws CoreException { + private final PDOMBinding doAdaptBinding(PDOMNode parent, final IBinding binding, long[] localToFileHolder) throws CoreException { if (parent == null) { parent= getAdaptedParent(binding); } @@ -276,7 +276,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { final int[] bindingTypes = new int[] {getBindingType(binding)}; final char[] nameChars = binding.getNameCharArray(); PDOMBinding nonLocal= FindBinding.findBinding(getIndex(), this, nameChars, bindingTypes, 0); - int localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); + long localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); if (localToFileRec == 0) return nonLocal; localToFileHolder[0]= localToFileRec; @@ -286,7 +286,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { final int[] bindingTypes = new int[] {getBindingType(binding)}; final char[] nameChars = binding.getNameCharArray(); PDOMBinding nonLocal= FindBinding.findBinding(parent, this, nameChars, bindingTypes, 0); - int localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); + long localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); if (localToFileRec == 0) return nonLocal; localToFileHolder[0]= localToFileRec; @@ -296,7 +296,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { } @Override - public PDOMNode getNode(int record) throws CoreException { + public PDOMNode getNode(long record) throws CoreException { if (record == 0) return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkageFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkageFactory.java index 67d599bd168..18ecc5d7e71 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkageFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkageFactory.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.CoreException; */ public class PDOMCLinkageFactory implements IPDOMLinkageFactory { - public PDOMLinkage getLinkage(PDOM pdom, int record) { + public PDOMLinkage getLinkage(PDOM pdom, long record) { return new PDOMCLinkage(pdom, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java index be01aadf459..fe9c074efbe 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java @@ -48,7 +48,7 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding { assert RECORD_SIZE <= 22; // 23 would yield a 32-byte block } - public PDOMCParameter(PDOMLinkage linkage, int record) { + public PDOMCParameter(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -58,13 +58,13 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding { Database db = getDB(); - db.putInt(record + NEXT_PARAM, 0); + db.putRecPtr(record + NEXT_PARAM, 0); try { if(!(param instanceof IProblemBinding)) { IType type = param.getType(); if (type != null) { PDOMNode typeNode = getLinkage().addType(this, type); - db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); + db.putRecPtr(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); } byte flags = encodeFlags(param); db.putByte(record + FLAGS, flags); @@ -85,12 +85,12 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding { } public void setNextParameter(PDOMCParameter nextParam) throws CoreException { - int rec = nextParam != null ? nextParam.getRecord() : 0; - getDB().putInt(record + NEXT_PARAM, rec); + long rec = nextParam != null ? nextParam.getRecord() : 0; + getDB().putRecPtr(record + NEXT_PARAM, rec); } public PDOMCParameter getNextParameter() throws CoreException { - int rec = getDB().getInt(record + NEXT_PARAM); + long rec = getDB().getRecPtr(record + NEXT_PARAM); return rec != 0 ? new PDOMCParameter(getLinkage(), rec) : null; } @@ -102,7 +102,7 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding { public IType getType() { try { PDOMLinkage linkage = getLinkage(); - PDOMNode node = linkage.getNode(getDB().getInt(record + TYPE)); + PDOMNode node = linkage.getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java index fc3e91034c9..66bb7e54981 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java @@ -63,7 +63,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom // linked list is initialized by malloc zeroing allocated storage } - public PDOMCStructure(PDOMLinkage linkage, int record) { + public PDOMCStructure(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java index 5f748cc780f..7b7f204b86e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java @@ -50,7 +50,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd } } - public PDOMCTypedef(PDOMLinkage linkage, int record) { + public PDOMCTypedef(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -77,7 +77,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd linkage.deleteType((IType) typeNode, record); typeNode= null; } - getDB().putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); + getDB().putRecPtr(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); } private boolean introducesRecursion(IType type, char[] tdname) throws DOMException { @@ -122,7 +122,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd public IType getType() { try { - int typeRec = getDB().getInt(record + TYPE); + long typeRec = getDB().getRecPtr(record + TYPE); return (IType)getLinkage().getNode(typeRec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java index f836dd3dbe6..7181c86b232 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java @@ -75,8 +75,8 @@ class PDOMCVariable extends PDOMBinding implements IVariable { private void setValue(final Database db, IVariable variable) throws CoreException { IValue val= variable.getInitialValue(); - int valrec= PDOMValue.store(db, getLinkage(), val); - db.putInt(record + VALUE_OFFSET, valrec); + long valrec= PDOMValue.store(db, getLinkage(), val); + db.putRecPtr(record + VALUE_OFFSET, valrec); } @Override @@ -85,7 +85,7 @@ class PDOMCVariable extends PDOMBinding implements IVariable { final Database db = getDB(); IVariable var= (IVariable) newBinding; IType mytype= getType(); - int valueRec= db.getInt(record + VALUE_OFFSET); + long valueRec= db.getRecPtr(record + VALUE_OFFSET); try { IType newType= var.getType(); setType(linkage, newType); @@ -103,10 +103,10 @@ class PDOMCVariable extends PDOMBinding implements IVariable { private void setType(final PDOMLinkage linkage, final IType type) throws CoreException { final PDOMNode typeNode = linkage.addType(this, type); - getDB().putInt(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); + getDB().putRecPtr(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); } - public PDOMCVariable(PDOMLinkage linkage, int record) { + public PDOMCVariable(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -122,7 +122,7 @@ class PDOMCVariable extends PDOMBinding implements IVariable { public IType getType() { try { - int typeRec = getDB().getInt(record + TYPE_OFFSET); + long typeRec = getDB().getRecPtr(record + TYPE_OFFSET); return (IType)getLinkage().getNode(typeRec); } catch (CoreException e) { CCorePlugin.log(e); @@ -133,7 +133,7 @@ class PDOMCVariable extends PDOMBinding implements IVariable { public IValue getInitialValue() { try { final Database db = getDB(); - int valRec = db.getInt(record + VALUE_OFFSET); + long valRec = db.getRecPtr(record + VALUE_OFFSET); return PDOMValue.restore(db, getLinkage(), valRec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java index 37eaab6b732..d21c232c538 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java @@ -35,7 +35,7 @@ public class CPPFindBinding extends FindBinding { super(linkage); } @Override - public int compare(int record1, int record2) throws CoreException { + public int compare(long record1, long record2) throws CoreException { int cmp = super.compare(record1, record2); if (cmp == 0) { PDOMBinding binding1 = linkage.getBinding(record1); @@ -53,14 +53,14 @@ public class CPPFindBinding extends FindBinding { public static class CPPFindBindingVisitor extends FindBinding.DefaultFindBindingVisitor { private final int fConstant; private final int fSigHash; - public CPPFindBindingVisitor(PDOMLinkage linkage, char[] name, int constant, int hash, int localToFile) { + public CPPFindBindingVisitor(PDOMLinkage linkage, char[] name, int constant, int hash, long localToFile) { super(linkage, name, new int[] {constant}, localToFile); fConstant= constant; fSigHash= hash; } @Override - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { int cmp= super.compare(record); if (cmp == 0) { int c1 = PDOMNode.getNodeType(fLinkage.getDB(), record); @@ -78,7 +78,7 @@ public class CPPFindBinding extends FindBinding { } @Override - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { fResult= fLinkage.getBinding(record); return false; } @@ -96,14 +96,14 @@ public class CPPFindBinding extends FindBinding { } public static PDOMBinding findBinding(BTree btree, final PDOMLinkage linkage, final char[] name, - final int c2, final int ty2, int localToFileRec) throws CoreException { + final int c2, final int ty2, long localToFileRec) throws CoreException { CPPFindBindingVisitor visitor= new CPPFindBindingVisitor(linkage, name, c2, ty2, localToFileRec); btree.accept(visitor); return visitor.getResult(); } public static PDOMBinding findBinding(PDOMNode node, PDOMLinkage linkage, char[] name, int constant, - int sigHash, int localToFileRec) throws CoreException { + int sigHash, long localToFileRec) throws CoreException { CPPFindBindingVisitor visitor= new CPPFindBindingVisitor(linkage, name, constant, sigHash, localToFileRec); try { @@ -114,7 +114,7 @@ public class CPPFindBinding extends FindBinding { } public static PDOMBinding findBinding(BTree btree, PDOMLinkage linkage, IBinding binding, - int localToFileRec) throws CoreException { + long localToFileRec) throws CoreException { Integer hash= 0; try { hash = IndexCPPSignatureUtil.getSignatureHash(binding); @@ -129,7 +129,7 @@ public class CPPFindBinding extends FindBinding { } public static PDOMBinding findBinding(PDOMNode node, PDOMLinkage linkage, IBinding binding, - int localToFileRec) throws CoreException { + long localToFileRec) throws CoreException { Integer hash = null; try { hash = IndexCPPSignatureUtil.getSignatureHash(binding); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java index 9716d98b765..91bdeb05db5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java @@ -30,12 +30,12 @@ public class PDOMCPPArgumentList { * Stores the given template arguments in the database. * @return the record by which the arguments can be referenced. */ - public static int putArguments(PDOMNode parent, ICPPTemplateArgument[] templateArguments) throws CoreException { + public static long putArguments(PDOMNode parent, ICPPTemplateArgument[] templateArguments) throws CoreException { final PDOMLinkage linkage= parent.getLinkage(); final Database db= linkage.getDB(); final short len= (short) Math.min(templateArguments.length, (Database.MAX_MALLOC_SIZE-2)/8); - final int block= db.malloc(2+8*len); - int p= block; + final long block= db.malloc(2+8*len); + long p= block; db.putShort(p, len); p+=2; for (int i=0; i= 0 && len <= (Database.MAX_MALLOC_SIZE-2)/8); - int p= record+2; + long p= record+2; for (int i=0; i> map= getBindingMap(ct); for (List list : map.values()) { for (PDOMBinding node : list) { @@ -187,7 +187,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { } public static CharArrayMap> getBindingMap(IPDOMCPPClassType ct) throws CoreException { - final Integer key= ct.getRecord() + PDOMCPPLinkage.CACHE_MEMBERS; + final Long key= ct.getRecord() + PDOMCPPLinkage.CACHE_MEMBERS; final PDOM pdom = ct.getPDOM(); @SuppressWarnings("unchecked") Reference>> cached= (Reference>>) pdom.getCachedResult(key); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java index b7ea2603a8d..05eec997dbe 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java @@ -72,7 +72,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements super(linkage, parent, (ICPPSpecialization) classType, specialized); } - public PDOMCPPClassSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPClassSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -93,7 +93,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements public IBinding specializeMember(IBinding original) { if (specializationMap == null) { - final Integer key= record+PDOMCPPLinkage.CACHE_INSTANCE_SCOPE; + final Long key= record+PDOMCPPLinkage.CACHE_INSTANCE_SCOPE; Object cached= getPDOM().getCachedResult(key); if (cached != null) { specializationMap= (ObjectMap) cached; @@ -145,13 +145,13 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } public PDOMCPPBase getFirstBase() throws CoreException { - int rec = getDB().getInt(record + FIRSTBASE); + long rec = getDB().getRecPtr(record + FIRSTBASE); return rec != 0 ? new PDOMCPPBase(getLinkage(), rec) : null; } private void setFirstBase(PDOMCPPBase base) throws CoreException { - int rec = base != null ? base.getRecord() : 0; - getDB().putInt(record + FIRSTBASE, rec); + long rec = base != null ? base.getRecord() : 0; + getDB().putRecPtr(record + FIRSTBASE, rec); } public void addBase(PDOMCPPBase base) throws CoreException { @@ -163,7 +163,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements public void removeBase(PDOMName pdomName) throws CoreException { PDOMCPPBase base= getFirstBase(); PDOMCPPBase predecessor= null; - int nameRec= pdomName.getRecord(); + long nameRec= pdomName.getRecord(); while (base != null) { PDOMName name = base.getBaseClassSpecifierName(); if (name != null && name.getRecord() == nameRec) { @@ -191,7 +191,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } // this is an explicit specialization - Integer key= record + PDOMCPPLinkage.CACHE_BASES; + Long key= record + PDOMCPPLinkage.CACHE_BASES; ICPPBase[] bases= (ICPPBase[]) getPDOM().getCachedResult(key); if (bases != null) return bases; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java index 4799d04b1a4..45e64de554d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java @@ -66,13 +66,13 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType final Database db = getDB(); final ICPPTemplateParameter[] origParams= template.getTemplateParameters(); final IPDOMCPPTemplateParameter[] params = PDOMTemplateParameterArray.createPDOMTemplateParameters(linkage, this, origParams); - int rec= PDOMTemplateParameterArray.putArray(db, params); - db.putInt(record + PARAMETERS, rec); + long rec= PDOMTemplateParameterArray.putArray(db, params); + db.putRecPtr(record + PARAMETERS, rec); db.putShort(record + RELEVANT_PARAMETERS, (short) params.length); linkage.new ConfigureTemplateParameters(origParams, params); } - public PDOMCPPClassTemplate(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPClassTemplate(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -90,7 +90,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType if (params == null) { try { final Database db = getDB(); - int rec= db.getInt(record + PARAMETERS); + long rec= db.getRecPtr(record + PARAMETERS); int count= Math.max(0, db.getShort(record + RELEVANT_PARAMETERS)); if (rec == 0 || count == 0) { params= ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY; @@ -127,7 +127,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType private void updateTemplateParameters(PDOMLinkage linkage, ICPPTemplateParameter[] newParams) throws CoreException, DOMException { final Database db = getDB(); - int rec= db.getInt(record + PARAMETERS); + long rec= db.getRecPtr(record + PARAMETERS); IPDOMCPPTemplateParameter[] allParams; if (rec == 0) { allParams= IPDOMCPPTemplateParameter.EMPTY_ARRAY; @@ -184,7 +184,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType if (rec != 0) db.free(rec); rec= PDOMTemplateParameterArray.putArray(db, newAllParams); - db.putInt(record + PARAMETERS, rec); + db.putRecPtr(record + PARAMETERS, rec); } db.putShort(record + RELEVANT_PARAMETERS, (short) newParamLength); } @@ -199,14 +199,14 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType } private PDOMCPPClassTemplatePartialSpecialization getFirstPartial() throws CoreException { - int value = getDB().getInt(record + FIRST_PARTIAL); + long value = getDB().getRecPtr(record + FIRST_PARTIAL); return value != 0 ? new PDOMCPPClassTemplatePartialSpecialization(getLinkage(), value) : null; } public void addPartial(PDOMCPPClassTemplatePartialSpecialization partial) throws CoreException { PDOMCPPClassTemplatePartialSpecialization first = getFirstPartial(); partial.setNextPartial(first); - getDB().putInt(record + FIRST_PARTIAL, partial.getRecord()); + getDB().putRecPtr(record + FIRST_PARTIAL, partial.getRecord()); } public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java index 047038786a3..2a635f17675 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java @@ -57,7 +57,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate ICPPClassTemplatePartialSpecialization partial, PDOMCPPClassTemplate primary) throws CoreException, DOMException { super(linkage, parent, partial); - getDB().putInt(record + PRIMARY, primary.getRecord()); + getDB().putRecPtr(record + PRIMARY, primary.getRecord()); primary.addPartial(this); try { @@ -70,7 +70,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate } public PDOMCPPClassTemplatePartialSpecialization(PDOMLinkage linkage, - int bindingRecord) { + long bindingRecord) { super(linkage, bindingRecord); } @@ -89,18 +89,18 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate } public PDOMCPPClassTemplatePartialSpecialization getNextPartial() throws CoreException { - int value = getDB().getInt(record + NEXT_PARTIAL); + long value = getDB().getRecPtr(record + NEXT_PARTIAL); return value != 0 ? new PDOMCPPClassTemplatePartialSpecialization(getLinkage(), value) : null; } public void setNextPartial(PDOMCPPClassTemplatePartialSpecialization partial) throws CoreException { - int value = partial != null ? partial.getRecord() : 0; - getDB().putInt(record + NEXT_PARTIAL, value); + long value = partial != null ? partial.getRecord() : 0; + getDB().putRecPtr(record + NEXT_PARTIAL, value); } public ICPPClassTemplate getPrimaryClassTemplate() { try { - return new PDOMCPPClassTemplate(getLinkage(), getDB().getInt(record + PRIMARY)); + return new PDOMCPPClassTemplate(getLinkage(), getDB().getRecPtr(record + PRIMARY)); } catch (CoreException e) { CCorePlugin.log(e); return null; @@ -113,9 +113,9 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException { final Database db = getPDOM().getDB(); - int oldRec = db.getInt(record+ARGUMENTS); - int rec= PDOMCPPArgumentList.putArguments(this, templateArguments); - db.putInt(record+ARGUMENTS, rec); + long oldRec = db.getRecPtr(record+ARGUMENTS); + long rec= PDOMCPPArgumentList.putArguments(this, templateArguments); + db.putRecPtr(record+ARGUMENTS, rec); if (oldRec != 0) { PDOMCPPArgumentList.clearArguments(this, oldRec); } @@ -123,7 +123,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate public ICPPTemplateArgument[] getTemplateArguments() { try { - final int rec= getPDOM().getDB().getInt(record+ARGUMENTS); + final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); return PDOMCPPArgumentList.getArguments(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecializationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecializationSpecialization.java index b61de53c353..b27794abba0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecializationSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecializationSpecialization.java @@ -46,14 +46,14 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla PDOMCPPClassTemplateSpecialization primary) throws CoreException { super(linkage, parent, partial, specialized); - getDB().putInt(record + PRIMARY_TEMPLATE, primary.getRecord()); + getDB().putRecPtr(record + PRIMARY_TEMPLATE, primary.getRecord()); primary.addPartial(this); linkage.new ConfigurePartialSpecialization(this, partial); } - public PDOMCPPClassTemplatePartialSpecializationSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPClassTemplatePartialSpecializationSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -73,13 +73,13 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla } public PDOMCPPClassTemplatePartialSpecializationSpecialization getNextPartial() throws CoreException { - int value = getDB().getInt(record + NEXT_PARTIAL); + long value = getDB().getRecPtr(record + NEXT_PARTIAL); return value != 0 ? new PDOMCPPClassTemplatePartialSpecializationSpecialization(getLinkage(), value) : null; } public void setNextPartial(PDOMCPPClassTemplatePartialSpecializationSpecialization partial) throws CoreException { - int value = partial != null ? partial.getRecord() : 0; - getDB().putInt(record + NEXT_PARTIAL, value); + long value = partial != null ? partial.getRecord() : 0; + getDB().putRecPtr(record + NEXT_PARTIAL, value); } @Override @@ -135,9 +135,9 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException { final Database db = getPDOM().getDB(); - int oldRec = db.getInt(record+ARGUMENTS); - int rec= PDOMCPPArgumentList.putArguments(this, templateArguments); - db.putInt(record+ARGUMENTS, rec); + long oldRec = db.getRecPtr(record+ARGUMENTS); + long rec= PDOMCPPArgumentList.putArguments(this, templateArguments); + db.putRecPtr(record+ARGUMENTS, rec); if (oldRec != 0) { PDOMCPPArgumentList.clearArguments(this, oldRec); } @@ -145,7 +145,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla public ICPPTemplateArgument[] getTemplateArguments() { try { - final int rec= getPDOM().getDB().getInt(record+ARGUMENTS); + final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); return PDOMCPPArgumentList.getArguments(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java index 5f4a38a7055..da551c09498 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java @@ -54,7 +54,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization super(linkage, parent, template, specialized); } - public PDOMCPPClassTemplateSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPClassTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -162,14 +162,14 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization } private PDOMCPPClassTemplatePartialSpecializationSpecialization getFirstPartial() throws CoreException { - int value = getDB().getInt(record + FIRST_PARTIAL); + long value = getDB().getRecPtr(record + FIRST_PARTIAL); return value != 0 ? new PDOMCPPClassTemplatePartialSpecializationSpecialization(getLinkage(), value) : null; } public void addPartial(PDOMCPPClassTemplatePartialSpecializationSpecialization pspecspec) throws CoreException { PDOMCPPClassTemplatePartialSpecializationSpecialization first = getFirstPartial(); pspecspec.setNextPartial(first); - getDB().putInt(record + FIRST_PARTIAL, pspecspec.getRecord()); + getDB().putRecPtr(record + FIRST_PARTIAL, pspecspec.getRecord()); } public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index 83652a91718..d2402aaf044 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -72,7 +72,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO // linked list is initialized by storage being zero'd by malloc } - public PDOMCPPClassType(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPClassType(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -139,13 +139,13 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } private PDOMCPPBase getFirstBase() throws CoreException { - int rec = getDB().getInt(record + FIRSTBASE); + long rec = getDB().getRecPtr(record + FIRSTBASE); return rec != 0 ? new PDOMCPPBase(getLinkage(), rec) : null; } private void setFirstBase(PDOMCPPBase base) throws CoreException { - int rec = base != null ? base.getRecord() : 0; - getDB().putInt(record + FIRSTBASE, rec); + long rec = base != null ? base.getRecord() : 0; + getDB().putRecPtr(record + FIRSTBASE, rec); } public void addBase(PDOMCPPBase base) throws CoreException { @@ -160,7 +160,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO PDOMCPPBase base= getFirstBase(); PDOMCPPBase predecessor= null; - int nameRec= pdomName.getRecord(); + long nameRec= pdomName.getRecord(); while (base != null) { PDOMName name = base.getBaseClassSpecifierName(); if (name != null && name.getRecord() == nameRec) { @@ -187,19 +187,19 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } private PDOMCPPFriend getFirstFriend() throws CoreException { - int rec = getDB().getInt(record + FIRSTFRIEND); + long rec = getDB().getRecPtr(record + FIRSTFRIEND); return rec != 0 ? new PDOMCPPFriend(getLinkage(), rec) : null; } private void setFirstFriend(PDOMCPPFriend friend) throws CoreException { - int rec = friend != null ? friend.getRecord() : 0; - getDB().putInt(record + FIRSTFRIEND, rec); + long rec = friend != null ? friend.getRecord() : 0; + getDB().putRecPtr(record + FIRSTFRIEND, rec); } public void removeFriend(PDOMName pdomName) throws CoreException { PDOMCPPFriend friend = getFirstFriend(); PDOMCPPFriend predecessor= null; - int nameRec= pdomName.getRecord(); + long nameRec= pdomName.getRecord(); while (friend != null) { PDOMName name = friend.getSpecifierName(); if (name != null && name.getRecord() == nameRec) { @@ -277,7 +277,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } public ICPPBase[] getBases() throws DOMException { - Integer key= record + PDOMCPPLinkage.CACHE_BASES; + Long key= record + PDOMCPPLinkage.CACHE_BASES; ICPPBase[] bases= (ICPPBase[]) getPDOM().getCachedResult(key); if (bases != null) return bases; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java index 21f6b15f767..170ff494a46 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java @@ -25,7 +25,7 @@ class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor { super(linkage, parent, method); } - public PDOMCPPConstructor(PDOMLinkage linkage, int record) { + public PDOMCPPConstructor(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java index bebd7b214eb..b3af609e159 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java @@ -37,7 +37,7 @@ public class PDOMCPPConstructorInstance extends PDOMCPPMethodInstance implements super(linkage, parent, method, instantiated); } - public PDOMCPPConstructorInstance(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPConstructorInstance(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java index 17388c8a777..3f9a10905fc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java @@ -35,7 +35,7 @@ class PDOMCPPConstructorSpecialization extends super(linkage, parent, constructor, specialized); } - public PDOMCPPConstructorSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPConstructorSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java index 4e38e93a8dd..9642d8909e0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java @@ -29,7 +29,7 @@ class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements super(linkage, parent, method); } - public PDOMCPPConstructorTemplate(PDOMLinkage linkage, int record) { + public PDOMCPPConstructorTemplate(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java index 551821f5884..e787307f4ab 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java @@ -36,7 +36,7 @@ class PDOMCPPConstructorTemplateSpecialization extends super(linkage, parent, constructor, specialized); } - public PDOMCPPConstructorTemplateSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPConstructorTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java index d0d9c3e3f29..14b1992f095 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java @@ -63,11 +63,11 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP throws CoreException { super(linkage, parent, classType, instantiated); - final int argListRec= PDOMCPPArgumentList.putArguments(this, classType.getTemplateArguments()); - getDB().putInt(record+ARGUMENTS, argListRec); + final long argListRec= PDOMCPPArgumentList.putArguments(this, classType.getTemplateArguments()); + getDB().putRecPtr(record+ARGUMENTS, argListRec); } - public PDOMCPPDeferredClassInstance(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPDeferredClassInstance(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -189,7 +189,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP public ICPPTemplateArgument[] getTemplateArguments() { try { - final int rec= getPDOM().getDB().getInt(record+ARGUMENTS); + final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); return PDOMCPPArgumentList.getArguments(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java index b31e6c3075f..43daf76a7e5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java @@ -45,7 +45,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, IIndexT super(linkage, parent, enumeration.getNameCharArray()); } - public PDOMCPPEnumeration(PDOMLinkage linkage, int record) { + public PDOMCPPEnumeration(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -86,14 +86,14 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, IIndexT } private PDOMCPPEnumerator getFirstEnumerator() throws CoreException { - int value = getDB().getInt(record + FIRST_ENUMERATOR); + long value = getDB().getRecPtr(record + FIRST_ENUMERATOR); return value != 0 ? new PDOMCPPEnumerator(getLinkage(), value) : null; } public void addEnumerator(PDOMCPPEnumerator enumerator) throws CoreException { PDOMCPPEnumerator first = getFirstEnumerator(); enumerator.setNextEnumerator(first); - getDB().putInt(record + FIRST_ENUMERATOR, enumerator.getRecord()); + getDB().putRecPtr(record + FIRST_ENUMERATOR, enumerator.getRecord()); } public boolean isSameType(IType type) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java index 08ecd1ad3cf..2c4faec0a1a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java @@ -43,12 +43,12 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator { super(linkage, parent, enumerator.getNameCharArray()); final Database db = getDB(); - db.putInt(record + ENUMERATION, enumeration.getRecord()); + db.putRecPtr(record + ENUMERATION, enumeration.getRecord()); storeValue(db, enumerator); enumeration.addEnumerator(this); } - public PDOMCPPEnumerator(PDOMLinkage linkage, int record) { + public PDOMCPPEnumerator(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -77,18 +77,18 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator { } public PDOMCPPEnumerator getNextEnumerator() throws CoreException { - int value = getDB().getInt(record + NEXT_ENUMERATOR); + long value = getDB().getRecPtr(record + NEXT_ENUMERATOR); return value != 0 ? new PDOMCPPEnumerator(getLinkage(), value) : null; } public void setNextEnumerator(PDOMCPPEnumerator enumerator) throws CoreException { - int value = enumerator != null ? enumerator.getRecord() : 0; - getDB().putInt(record + NEXT_ENUMERATOR, value); + long value = enumerator != null ? enumerator.getRecord() : 0; + getDB().putRecPtr(record + NEXT_ENUMERATOR, value); } public IType getType() throws DOMException { try { - return new PDOMCPPEnumeration(getLinkage(), getDB().getInt(record + ENUMERATION)); + return new PDOMCPPEnumeration(getLinkage(), getDB().getRecPtr(record + ENUMERATION)); } catch (CoreException e) { CCorePlugin.log(e); return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java index e84bc82fd54..3bc3a5b46f2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java @@ -31,7 +31,7 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField { super(linkage, parent, field); } - public PDOMCPPField(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPField(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java index 14e76f9f5a0..c3f0b22a47a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java @@ -58,17 +58,17 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements IType type = field.getType(); PDOMNode typeNode = linkage.addType(this, type); if (typeNode != null) { - db.putInt(record + TYPE, typeNode.getRecord()); + db.putRecPtr(record + TYPE, typeNode.getRecord()); } IValue val= field.getInitialValue(); - int rec= PDOMValue.store(db, linkage, val); - db.putInt(record + VALUE_OFFSET, rec); + long rec= PDOMValue.store(db, linkage, val); + db.putRecPtr(record + VALUE_OFFSET, rec); } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); } } - public PDOMCPPFieldSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPFieldSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -92,7 +92,7 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements public IType getType() throws DOMException { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); if (node instanceof IType) { return (IType) node; } @@ -105,7 +105,7 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements public IValue getInitialValue() { try { final Database db = getDB(); - int valRec = db.getInt(record + VALUE_OFFSET); + long valRec = db.getRecPtr(record + VALUE_OFFSET); return PDOMValue.restore(db, getLinkage(), valRec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFriend.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFriend.java index 95e770e4ff3..3c67421d4ee 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFriend.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFriend.java @@ -26,15 +26,15 @@ class PDOMCPPFriend extends PDOMNode { @SuppressWarnings("hiding") protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 8; - public PDOMCPPFriend(PDOMLinkage linkage, int record) { + public PDOMCPPFriend(PDOMLinkage linkage, long record) { super(linkage, record); } public PDOMCPPFriend(PDOMLinkage linkage, PDOMName friendSpec) throws CoreException { super(linkage, null); - int friendrec = friendSpec != null ? friendSpec.getRecord() : 0; - linkage.getDB().putInt(record + FRIEND_SPECIFIER, friendrec); + long friendrec = friendSpec != null ? friendSpec.getRecord() : 0; + linkage.getDB().putRecPtr(record + FRIEND_SPECIFIER, friendrec); } @Override @@ -48,7 +48,7 @@ class PDOMCPPFriend extends PDOMNode { } public PDOMName getSpecifierName() throws CoreException { - int rec = getDB().getInt(record + FRIEND_SPECIFIER); + long rec = getDB().getRecPtr(record + FRIEND_SPECIFIER); if (rec != 0) return new PDOMName(getLinkage(), rec); return null; } @@ -67,12 +67,12 @@ class PDOMCPPFriend extends PDOMNode { } public void setNextFriend(PDOMCPPFriend nextFriend) throws CoreException { - int rec = nextFriend != null ? nextFriend.getRecord() : 0; - getDB().putInt(record + NEXT_FRIEND, rec); + long rec = nextFriend != null ? nextFriend.getRecord() : 0; + getDB().putRecPtr(record + NEXT_FRIEND, rec); } public PDOMCPPFriend getNextFriend() throws CoreException { - int rec = getDB().getInt(record + NEXT_FRIEND); + long rec = getDB().getRecPtr(record + NEXT_FRIEND); return rec != 0 ? new PDOMCPPFriend(getLinkage(), rec) : null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java index 939971457b7..8850265569f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java @@ -134,7 +134,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl db.putByte(record + ANNOTATION, newAnnotation); annotation= newAnnotation; - int oldRec = db.getInt(record+EXCEPTION_SPEC); + long oldRec = db.getRecPtr(record+EXCEPTION_SPEC); storeExceptionSpec(db, func); if (oldRec != 0) { PDOMCPPTypeList.clearTypes(this, oldRec); @@ -143,7 +143,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl } private void storeExceptionSpec(final Database db, ICPPFunction binding) throws CoreException { - int typelist= 0; + long typelist= 0; try { if (binding instanceof ICPPMethod && ((ICPPMethod) binding).isImplicit()) { // don't store the exception specification, computed it on demand. @@ -153,23 +153,23 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl } catch (DOMException e) { // ignore problems in the exception specification. } - db.putInt(record + EXCEPTION_SPEC, typelist); + db.putRecPtr(record + EXCEPTION_SPEC, typelist); } private void setParameters(PDOMCPPFunctionType pft, IParameter[] params) throws CoreException { final Database db= getDB(); db.putInt(record + NUM_PARAMS, params.length); - db.putInt(record + FIRST_PARAM, 0); + db.putRecPtr(record + FIRST_PARAM, 0); IType[] paramTypes= pft.getParameterTypes(); for (int i= 0; i < params.length; ++i) { - int ptRecord= i < paramTypes.length && paramTypes[i] != null ? ((PDOMNode) paramTypes[i]).getRecord() : 0; + long ptRecord= i < paramTypes.length && paramTypes[i] != null ? ((PDOMNode) paramTypes[i]).getRecord() : 0; setFirstParameter(new PDOMCPPParameter(getLinkage(), this, params[i], ptRecord)); } } private PDOMCPPFunctionType setType(ICPPFunctionType ft) throws CoreException { PDOMCPPFunctionType pft = (PDOMCPPFunctionType) getLinkage().addType(this, ft); - getDB().putInt(record + FUNCTION_TYPE, pft.getRecord()); + getDB().putRecPtr(record + FUNCTION_TYPE, pft.getRecord()); getPDOM().putCachedResult(record, pft, true); return pft; } @@ -178,11 +178,11 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl return getDB().getInt(record + SIGNATURE_HASH); } - public static int getSignatureHash(PDOMLinkage linkage, int record) throws CoreException { + public static int getSignatureHash(PDOMLinkage linkage, long record) throws CoreException { return linkage.getDB().getInt(record + SIGNATURE_HASH); } - public PDOMCPPFunction(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPFunction(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -197,15 +197,15 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl } private PDOMCPPParameter getFirstParameter() throws CoreException { - int rec = getDB().getInt(record + FIRST_PARAM); + long rec = getDB().getRecPtr(record + FIRST_PARAM); return rec != 0 ? new PDOMCPPParameter(getLinkage(), rec) : null; } private void setFirstParameter(PDOMCPPParameter param) throws CoreException { if (param != null) param.setNextParameter(getFirstParameter()); - int rec = param != null ? param.getRecord() : 0; - getDB().putInt(record + FIRST_PARAM, rec); + long rec = param != null ? param.getRecord() : 0; + getDB().putRecPtr(record + FIRST_PARAM, rec); } public boolean isInline() throws DOMException { @@ -258,7 +258,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl private final ICPPFunctionType readFunctionType() { try { - int offset= getDB().getInt(record + FUNCTION_TYPE); + long offset= getDB().getRecPtr(record + FUNCTION_TYPE); return offset==0 ? null : new PDOMCPPFunctionType(getLinkage(), offset); } catch(CoreException ce) { CCorePlugin.log(ce); @@ -317,7 +317,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl public IType[] getExceptionSpecification() throws DOMException { try { - final int rec = getPDOM().getDB().getInt(record+EXCEPTION_SPEC); + final long rec = getPDOM().getDB().getRecPtr(record+EXCEPTION_SPEC); return PDOMCPPTypeList.getTypes(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java index 6df93b96d6c..0bc0af0f677 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java @@ -44,19 +44,19 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I super(linkage, parent, function, orig); final ICPPTemplateInstance asInstance= (ICPPTemplateInstance) function; - final int argListRec= PDOMCPPArgumentList.putArguments(this, asInstance.getTemplateArguments()); + final long argListRec= PDOMCPPArgumentList.putArguments(this, asInstance.getTemplateArguments()); final Database db = getDB(); - db.putInt(record+ARGUMENTS, argListRec); + db.putRecPtr(record+ARGUMENTS, argListRec); try { - int exceptSpecRec = PDOMCPPTypeList.putTypes(this, function.getExceptionSpecification()); - db.putInt(record+EXCEPTION_SPEC, exceptSpecRec); + long exceptSpecRec = PDOMCPPTypeList.putTypes(this, function.getExceptionSpecification()); + db.putRecPtr(record+EXCEPTION_SPEC, exceptSpecRec); } catch (DOMException e) { // ignore problems in the exception specification } } - public PDOMCPPFunctionInstance(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPFunctionInstance(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -77,7 +77,7 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I public ICPPTemplateArgument[] getTemplateArguments() { try { - final int rec= getPDOM().getDB().getInt(record+ARGUMENTS); + final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); return PDOMCPPArgumentList.getArguments(this, rec); } catch (CoreException e) { CCorePlugin.log(e); @@ -88,7 +88,7 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I @Override public IType[] getExceptionSpecification() throws DOMException { try { - final int rec = getPDOM().getDB().getInt(record+EXCEPTION_SPEC); + final long rec = getPDOM().getDB().getRecPtr(record+EXCEPTION_SPEC); return PDOMCPPTypeList.getTypes(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java index 5c45f6c3806..23a3780a20a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java @@ -80,7 +80,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP if (ft != null) { PDOMNode typeNode = getLinkage().addType(this, ft); if (typeNode != null) { - db.putInt(record + FUNCTION_TYPE, typeNode.getRecord()); + db.putRecPtr(record + FUNCTION_TYPE, typeNode.getRecord()); } } @@ -95,7 +95,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP final int length= Math.min(sParams.length, params.length); db.putInt(record + NUM_PARAMS, length); for (int i=0; i postProcesses = new LinkedList(); - public PDOMCPPLinkage(PDOM pdom, int record) { + public PDOMCPPLinkage(PDOM pdom, long record) { super(pdom, record); } @@ -247,7 +247,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { if (parent == null) return null; - int fileLocalRec[]= {0}; + long fileLocalRec[]= {0}; pdomBinding = adaptBinding(parent, binding, fileLocalRec); if (pdomBinding != null) { getPDOM().putCachedResult(inputBinding, pdomBinding); @@ -295,7 +295,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { return false; } - PDOMBinding createBinding(PDOMNode parent, IBinding binding, int fileLocalRec) throws CoreException, DOMException { + PDOMBinding createBinding(PDOMNode parent, IBinding binding, long fileLocalRec) throws CoreException, DOMException { PDOMBinding pdomBinding= null; // template parameters are created directly by their owners. @@ -425,7 +425,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { private void addImplicitMethods(PDOMBinding type, ICPPClassType binding) throws CoreException { try { - final int fileLocalRec= type.getLocalToFileRec(); + final long fileLocalRec= type.getLocalToFileRec(); IScope scope = binding.getCompositeScope(); if (scope instanceof ICPPClassScope) { ICPPMethod[] implicit= ((ICPPClassScope) scope).getImplicitMethods(); @@ -553,7 +553,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { return adaptBinding(null, inputBinding, FILE_LOCAL_REC_DUMMY); } - private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, int[] fileLocalRecHolder) throws CoreException { + private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] fileLocalRecHolder) throws CoreException { if (cannotAdapt(inputBinding)) { return null; } @@ -579,7 +579,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { /** * Find the equivalent binding, or binding place holder within this PDOM */ - private final PDOMBinding doAdaptBinding(PDOMNode parent, IBinding binding, int[] fileLocalRecHolder) throws CoreException { + private final PDOMBinding doAdaptBinding(PDOMNode parent, IBinding binding, long[] fileLocalRecHolder) throws CoreException { if (parent == null) { parent= adaptOrAddParent(false, binding); } @@ -597,7 +597,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { if (parent == this) { PDOMBinding glob= CPPFindBinding.findBinding(getIndex(), this, binding, 0); - final int loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; @@ -606,7 +606,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { if (parent instanceof PDOMCPPNamespace) { final BTree btree = ((PDOMCPPNamespace) parent).getIndex(); PDOMBinding glob= CPPFindBinding.findBinding(btree, this, binding, 0); - final int loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; @@ -618,7 +618,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { } if (parent instanceof IPDOMMemberOwner) { PDOMBinding glob= CPPFindBinding.findBinding(parent, this, binding, 0); - final int loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; @@ -731,7 +731,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { } @Override - public PDOMNode getNode(int record) throws CoreException { + public PDOMNode getNode(long record) throws CoreException { if (record == 0) return null; @@ -891,7 +891,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { } } if (doit) { - int rec= file.getLastUsingDirectiveRec(); + long rec= file.getLastUsingDirectiveRec(); PDOMCPPUsingDirective ud= new PDOMCPPUsingDirective(this, rec, containerNS, pdomName.getBinding(), pdomName.getFileLocation().getNodeOffset()); file.setFirstUsingDirectiveRec(ud.getRecord()); @@ -931,7 +931,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { */ @Override public ICPPUsingDirective[] getUsingDirectives(PDOMFile file) throws CoreException { - int rec= file.getLastUsingDirectiveRec(); + long rec= file.getLastUsingDirectiveRec(); if (rec == 0) { return ICPPUsingDirective.EMPTY_ARRAY; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkageFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkageFactory.java index 25dcad8bfa3..3422ac8f41b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkageFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkageFactory.java @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.CoreException; */ public class PDOMCPPLinkageFactory implements IPDOMLinkageFactory { - public PDOMLinkage getLinkage(PDOM pdom, int record) { + public PDOMLinkage getLinkage(PDOM pdom, long record) { return new PDOMCPPLinkage(pdom, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java index 569c7d66999..040003f33f8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -74,7 +74,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { } } - public PDOMCPPMethod(PDOMLinkage linkage, int record) { + public PDOMCPPMethod(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java index af38e923fdb..4daded16b7c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java @@ -37,7 +37,7 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho super(linkage, parent, method, instantiated); } - public PDOMCPPMethodInstance(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPMethodInstance(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java index d985da59983..cb681e6b373 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java @@ -65,7 +65,7 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization } } - public PDOMCPPMethodSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPMethodSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java index f9f4a1d6ae7..21a270fbdb3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java @@ -66,7 +66,7 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho } } - public PDOMCPPMethodTemplate(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPMethodTemplate(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java index 8701685e261..c7529e96e90 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java @@ -34,7 +34,7 @@ class PDOMCPPMethodTemplateSpecialization extends super(linkage, parent, (ICPPFunctionTemplate) method, specialized); } - public PDOMCPPMethodTemplateSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPMethodTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java index e6252e3caa3..8920a8ac323 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java @@ -58,7 +58,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding super(linkage, parent, namespace.getNameCharArray()); } - public PDOMCPPNamespace(PDOMLinkage linkage, int record) throws CoreException { + public PDOMCPPNamespace(PDOMLinkage linkage, long record) throws CoreException { super(linkage, record); } @@ -86,10 +86,10 @@ class PDOMCPPNamespace extends PDOMCPPBinding getIndex().accept((IBTreeVisitor) visitor); } else { getIndex().accept(new IBTreeVisitor() { - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { PDOMBinding binding = getLinkage().getBinding(record); if (binding != null) { if (visitor.visit(binding)) @@ -188,10 +188,10 @@ class PDOMCPPNamespace extends PDOMCPPBinding final List preresult = new ArrayList(); try { getIndex().accept(new IBTreeVisitor() { - public int compare(int record) throws CoreException { + public int compare(long record) throws CoreException { return 0; } - public boolean visit(int record) throws CoreException { + public boolean visit(long record) throws CoreException { preresult.add(getLinkage().getNode(record)); return true; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java index dcc7558d592..579165f8370 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java @@ -40,7 +40,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias setTargetBinding(parent.getLinkage(), alias.getBinding()); } - public PDOMCPPNamespaceAlias(PDOMLinkage linkage, int record) { + public PDOMCPPNamespaceAlias(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -59,7 +59,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias private void setTargetBinding(PDOMLinkage linkage, IBinding target) throws CoreException { PDOMBinding namespace = getLinkage().adaptBinding(target); - getDB().putInt(record + NAMESPACE_BINDING, + getDB().putRecPtr(record + NAMESPACE_BINDING, namespace != null ? namespace.getRecord() : 0); } @@ -98,7 +98,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias public IBinding getBinding() { try { - return (IBinding) getLinkage().getNode(getPDOM().getDB().getInt(record + NAMESPACE_BINDING)); + return (IBinding) getLinkage().getNode(getPDOM().getDB().getRecPtr(record + NAMESPACE_BINDING)); } catch(CoreException ce) { CCorePlugin.log(ce); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java index 981e5011c1a..1819529198e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java @@ -73,7 +73,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind private static final byte FLAG_DEFAULT_VALUE = 0x1; - public PDOMCPPParameter(PDOMLinkage linkage, int record) { + public PDOMCPPParameter(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -83,7 +83,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind Database db = getDB(); - db.putInt(record + NEXT_PARAM, 0); + db.putRecPtr(record + NEXT_PARAM, 0); byte flags= encodeFlags(param); db.putByte(record + FLAGS, flags); @@ -92,7 +92,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind type= param.getType(); if (type != null) { PDOMNode typeNode = getLinkage().addType(this, type); - db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); + db.putRecPtr(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); } byte annotations = PDOMCPPAnnotation.encodeAnnotation(param); db.putByte(record + ANNOTATIONS, annotations); @@ -101,17 +101,17 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind } } - public PDOMCPPParameter(PDOMLinkage linkage, PDOMNode parent, IParameter param, int typeRecord) + public PDOMCPPParameter(PDOMLinkage linkage, PDOMNode parent, IParameter param, long typeRecord) throws CoreException { super(linkage, parent, param.getNameCharArray()); Database db = getDB(); - db.putInt(record + NEXT_PARAM, 0); + db.putRecPtr(record + NEXT_PARAM, 0); byte flags= encodeFlags(param); db.putByte(record + FLAGS, flags); - db.putInt(record + TYPE, typeRecord); + db.putRecPtr(record + TYPE, typeRecord); try { byte annotations = PDOMCPPAnnotation.encodeAnnotation(param); @@ -142,12 +142,12 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind } public void setNextParameter(PDOMCPPParameter nextParam) throws CoreException { - int rec = nextParam != null ? nextParam.getRecord() : 0; - getDB().putInt(record + NEXT_PARAM, rec); + long rec = nextParam != null ? nextParam.getRecord() : 0; + getDB().putRecPtr(record + NEXT_PARAM, rec); } public PDOMCPPParameter getNextParameter() throws CoreException { - int rec = getDB().getInt(record + NEXT_PARAM); + long rec = getDB().getRecPtr(record + NEXT_PARAM); return rec != 0 ? new PDOMCPPParameter(getLinkage(), rec) : null; } @@ -170,7 +170,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind public IType getType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java index 1e528dac7f1..b166462e572 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java @@ -46,12 +46,12 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC @SuppressWarnings("hiding") protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 8; - public PDOMCPPParameterSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPParameter param, PDOMCPPParameter specialized, int typeRecord) + public PDOMCPPParameterSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPParameter param, PDOMCPPParameter specialized, long typeRecord) throws CoreException { super(linkage, parent, (ICPPSpecialization) param, specialized); Database db = getDB(); - db.putInt(record + NEXT_PARAM, 0); - db.putInt(record + TYPE, typeRecord); + db.putRecPtr(record + NEXT_PARAM, 0); + db.putRecPtr(record + TYPE, typeRecord); } public PDOMCPPParameterSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPParameter param, PDOMCPPParameter specialized, IType type) @@ -60,21 +60,21 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC Database db = getDB(); - db.putInt(record + NEXT_PARAM, 0); + db.putRecPtr(record + NEXT_PARAM, 0); try { if (type == null) type= param.getType(); if (type != null) { PDOMNode typeNode = getLinkage().addType(this, type); - db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); + db.putRecPtr(record + TYPE, typeNode != null ? typeNode.getRecord() : 0); } } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); } } - public PDOMCPPParameterSpecialization(PDOMLinkage linkage, int record) { + public PDOMCPPParameterSpecialization(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -89,18 +89,18 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC } public void setNextParameter(PDOMCPPParameterSpecialization nextParam) throws CoreException { - int rec = nextParam != null ? nextParam.getRecord() : 0; - getDB().putInt(record + NEXT_PARAM, rec); + long rec = nextParam != null ? nextParam.getRecord() : 0; + getDB().putRecPtr(record + NEXT_PARAM, rec); } public PDOMCPPParameterSpecialization getNextParameter() throws CoreException { - int rec = getDB().getInt(record + NEXT_PARAM); + long rec = getDB().getRecPtr(record + NEXT_PARAM); return rec != 0 ? new PDOMCPPParameterSpecialization(getLinkage(), rec) : null; } public IType getType() throws DOMException { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPPointerToMemberType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPPointerToMemberType.java index 598df8c37ab..ac6d753e995 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPPointerToMemberType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPPointerToMemberType.java @@ -32,7 +32,7 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT @SuppressWarnings("hiding") private static final int RECORD_SIZE= TYPE + 4; - public PDOMCPPPointerToMemberType(PDOMLinkage linkage, int record) { + public PDOMCPPPointerToMemberType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -42,13 +42,13 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT // type IType ct = type.getMemberOfClass(); - int typeRec = 0; + long typeRec = 0; if (ct != null) { PDOMNode targetTypeNode = getLinkage().addType(this, ct); if (targetTypeNode != null) typeRec = targetTypeNode.getRecord(); } - db.putInt(record + TYPE, typeRec); + db.putRecPtr(record + TYPE, typeRec); } @Override @@ -63,7 +63,7 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT public IType getMemberOfClass() { try { - int rec = getDB().getInt(record + TYPE); + long rec = getDB().getRecPtr(record + TYPE); return (IType) getLinkage().getNode(rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPReferenceType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPReferenceType.java index 7650ac3dddf..bb747dbedf4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPReferenceType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPReferenceType.java @@ -37,7 +37,7 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC private IType targetType; - public PDOMCPPReferenceType(PDOMLinkage linkage, int record) { + public PDOMCPPReferenceType(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -48,14 +48,14 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC try { // type - int typeRec = 0; + long typeRec = 0; if (type != null) { IType targetType = type.getType(); PDOMNode targetTypeNode = getLinkage().addType(this, targetType); if (targetTypeNode != null) typeRec = targetTypeNode.getRecord(); } - db.putInt(record + TYPE, typeRec); + db.putRecPtr(record + TYPE, typeRec); } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); } @@ -80,7 +80,7 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC private IType readType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPSpecialization.java index 56017203959..5fb1db1f5df 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPSpecialization.java @@ -47,12 +47,12 @@ abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements ICPPSpeci public PDOMCPPSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPSpecialization spec, IPDOMBinding specialized) throws CoreException { super(linkage, parent, spec.getNameCharArray()); - getDB().putInt(record + SPECIALIZED, specialized.getRecord()); + getDB().putRecPtr(record + SPECIALIZED, specialized.getRecord()); // specializations that are not instances have the same map as their owner. if (this instanceof ICPPTemplateInstance) { - int rec= PDOMCPPTemplateParameterMap.putMap(this, spec.getTemplateParameterMap()); - getDB().putInt(record + ARGMAP, rec); + long rec= PDOMCPPTemplateParameterMap.putMap(this, spec.getTemplateParameterMap()); + getDB().putRecPtr(record + ARGMAP, rec); } try { Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(spec); @@ -61,14 +61,14 @@ abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements ICPPSpeci } } - public PDOMCPPSpecialization(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPSpecialization(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } public IBinding getSpecializedBinding() { if (fSpecializedCache == null) { try { - int specializedRec = getDB().getInt(record + SPECIALIZED); + long specializedRec = getDB().getRecPtr(record + SPECIALIZED); fSpecializedCache= (IPDOMBinding) getLinkage().getNode(specializedRec); } catch (CoreException e) { CCorePlugin.log(e); @@ -86,7 +86,7 @@ abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements ICPPSpeci if (fArgMap == null) { try { if (this instanceof ICPPTemplateInstance) { - fArgMap= PDOMCPPTemplateParameterMap.getMap(this, getDB().getInt(record + ARGMAP)); + fArgMap= PDOMCPPTemplateParameterMap.getMap(this, getDB().getRecPtr(record + ARGMAP)); } else { // specializations that are no instances have the same argmap as their owner. IBinding owner= getOwner(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java index 1bb4b621af4..1bc14f763ad 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java @@ -57,7 +57,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem db.putInt(record + PARAMETERID, param.getParameterID()); } - public PDOMCPPTemplateNonTypeParameter(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPTemplateNonTypeParameter(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -74,7 +74,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem public ICPPTemplateArgument getDefaultValue() { try { final Database db = getDB(); - int rec= db.getInt(record + DEFAULTVAL); + long rec= db.getRecPtr(record + DEFAULTVAL); IValue val= PDOMValue.restore(db, getLinkage(), rec); if (val == null) return null; @@ -92,7 +92,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem updateName(newBinding.getNameCharArray()); final Database db = getDB(); IType mytype= getType(); - int valueRec= db.getInt(record + DEFAULTVAL); + long valueRec= db.getRecPtr(record + DEFAULTVAL); try { IType newType= ntp.getType(); setType(linkage, newType); @@ -114,7 +114,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem ((PDOMNode) type).delete(linkage); } Database db= getDB(); - int valueRec= db.getInt(record + DEFAULTVAL); + long valueRec= db.getRecPtr(record + DEFAULTVAL); PDOMValue.delete(db, valueRec); } @@ -147,7 +147,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem private void setType(final PDOMLinkage linkage, IType newType) throws CoreException, DOMException { PDOMNode typeNode = linkage.addType(this, newType); - getDB().putInt(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); + getDB().putRecPtr(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); } public void configure(ICPPTemplateParameter param) { @@ -170,8 +170,8 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem if (val != null) { IValue sval= val.getNonTypeValue(); if (sval != null) { - int valueRec= PDOMValue.store(db, getLinkage(), sval); - db.putInt(record + DEFAULTVAL, valueRec); + long valueRec= PDOMValue.store(db, getLinkage(), sval); + db.putRecPtr(record + DEFAULTVAL, valueRec); return true; } } @@ -180,7 +180,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem public IType getType() { try { - int typeRec = getDB().getInt(record + TYPE_OFFSET); + long typeRec = getDB().getRecPtr(record + TYPE_OFFSET); return (IType)getLinkage().getNode(typeRec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateParameterMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateParameterMap.java index dcbbc3a95a4..6fdff0fd0a5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateParameterMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateParameterMap.java @@ -32,32 +32,32 @@ public class PDOMCPPTemplateParameterMap { * Stores the given template parameter map in the database. * @return the record by which the arguments can be referenced. */ - public static int putMap(PDOMNode parent, ICPPTemplateParameterMap map) throws CoreException { + public static long putMap(PDOMNode parent, ICPPTemplateParameterMap map) throws CoreException { final PDOMLinkage linkage= parent.getLinkage(); final Database db= linkage.getDB(); Integer[] keys= map.getAllParameterPositions(); final short len= (short) Math.min(keys.length, (Database.MAX_MALLOC_SIZE-2)/12); - final int block= db.malloc(2+12*len); - int p= block; + final long block= db.malloc(2+12*len); + long p= block; db.putShort(p, len); p+=2; for (int i=0; i= 0 && len <= (Database.MAX_MALLOC_SIZE-2)/NODE_SIZE); - int p= record+2; + long p= record+2; for (int i=0; i 0) { if (type instanceof ITypedef) { @@ -127,7 +127,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer, public IType getType() { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java index 1eb10688ac0..a4628d68f4a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java @@ -54,7 +54,7 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization // We protect against infinite recursion using a counter inside typedef. PDOMNode typeNode = parent.getLinkage().addType(this, type); if (typeNode != null) - getDB().putInt(record + TYPE, typeNode.getRecord()); + getDB().putRecPtr(record + TYPE, typeNode.getRecord()); } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); } finally { @@ -64,7 +64,7 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization } } - public PDOMCPPTypedefSpecialization(PDOMLinkage linkage, int record) { + public PDOMCPPTypedefSpecialization(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -80,7 +80,7 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization public IType getType() throws DOMException { try { - PDOMNode node = getLinkage().getNode(getDB().getInt(record + TYPE)); + PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); return node instanceof IType ? (IType)node : null; } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java index 4067180f05b..8fb6a0baa87 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java @@ -41,11 +41,11 @@ class PDOMCPPUnknownClassInstance extends PDOMCPPUnknownClassType implements ICP throws CoreException { super(linkage, parent, classInstance); - int rec= PDOMCPPArgumentList.putArguments(this, classInstance.getArguments()); - getDB().putInt(record + ARGUMENTS, rec); + long rec= PDOMCPPArgumentList.putArguments(this, classInstance.getArguments()); + getDB().putRecPtr(record + ARGUMENTS, rec); } - public PDOMCPPUnknownClassInstance(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPUnknownClassInstance(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } @@ -62,7 +62,7 @@ class PDOMCPPUnknownClassInstance extends PDOMCPPUnknownClassType implements ICP public ICPPTemplateArgument[] getArguments() { if (arguments == null) { try { - final int rec= getPDOM().getDB().getInt(record+ARGUMENTS); + final long rec= getPDOM().getDB().getRecPtr(record+ARGUMENTS); arguments= PDOMCPPArgumentList.getArguments(this, rec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java index 4280f087a72..3716de37bc2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java @@ -65,7 +65,7 @@ class PDOMCPPUnknownClassType extends PDOMCPPBinding implements ICPPClassScope, // linked list is initialized by storage being zero'd by malloc } - public PDOMCPPUnknownClassType(PDOMLinkage linkage, int bindingRecord) { + public PDOMCPPUnknownClassType(PDOMLinkage linkage, long bindingRecord) { super(linkage, bindingRecord); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java index b93cea14267..d02e328b181 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDeclaration.java @@ -44,17 +44,17 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara throws CoreException { super(linkage, parent, using.getNameCharArray()); IBinding[] delegates= using.getDelegates(); - int nextRecord = 0; + long nextRecord = 0; for (int i = delegates.length; --i >= 0;) { PDOMCPPUsingDeclaration simpleUsing = i > 0 ? new PDOMCPPUsingDeclaration(linkage, parent, getNameCharArray()) : this; simpleUsing.setTargetBinding(parent.getLinkage(), delegates[i]); - getDB().putInt(record + NEXT_DELEGATE, nextRecord); + getDB().putRecPtr(record + NEXT_DELEGATE, nextRecord); nextRecord = simpleUsing.getRecord(); } } - public PDOMCPPUsingDeclaration(PDOMLinkage linkage, int record) { + public PDOMCPPUsingDeclaration(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -64,7 +64,7 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara private void setTargetBinding(PDOMLinkage linkage, IBinding delegate) throws CoreException { PDOMBinding target = getLinkage().adaptBinding(delegate); - getDB().putInt(record + TARGET_BINDING, target != null ? target.getRecord() : 0); + getDB().putRecPtr(record + TARGET_BINDING, target != null ? target.getRecord() : 0); } @Override @@ -98,14 +98,14 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara } private PDOMCPPUsingDeclaration getNext() throws CoreException { - int nextRecord = getDB().getInt(record + NEXT_DELEGATE); + long nextRecord = getDB().getRecPtr(record + NEXT_DELEGATE); return nextRecord != 0 ? new PDOMCPPUsingDeclaration(getLinkage(), nextRecord) : null; } private IBinding getBinding() { try { return (IBinding) getLinkage().getNode( - getPDOM().getDB().getInt(record + TARGET_BINDING)); + getPDOM().getDB().getRecPtr(record + TARGET_BINDING)); } catch (CoreException e) { CCorePlugin.log(e); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java index 722501f6c11..844b75a7d9e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java @@ -39,24 +39,24 @@ public class PDOMCPPUsingDirective implements ICPPUsingDirective, IPDOMNode { private static final int RECORD_SIZE = 16; private final PDOMCPPLinkage fLinkage; - private final int fRecord; + private final long fRecord; - PDOMCPPUsingDirective(PDOMCPPLinkage pdom, int record) { + PDOMCPPUsingDirective(PDOMCPPLinkage pdom, long record) { fLinkage= pdom; fRecord= record; } - public PDOMCPPUsingDirective(PDOMCPPLinkage linkage, int prevRecInFile, PDOMCPPNamespace containerNS, + public PDOMCPPUsingDirective(PDOMCPPLinkage linkage, long prevRecInFile, PDOMCPPNamespace containerNS, PDOMBinding nominated, int fileOffset) throws CoreException { final Database db= linkage.getDB(); - final int containerRec= containerNS == null ? 0 : containerNS.getRecord(); - final int nominatedRec= nominated.getRecord(); + final long containerRec= containerNS == null ? 0 : containerNS.getRecord(); + final long nominatedRec= nominated.getRecord(); fLinkage= linkage; fRecord= db.malloc(RECORD_SIZE); - db.putInt(fRecord + CONTAINER_NAMESPACE, containerRec); - db.putInt(fRecord + NOMINATED_NAMESPACE, nominatedRec); - db.putInt(fRecord + PREV_DIRECTIVE_OF_FILE, prevRecInFile); + db.putRecPtr(fRecord + CONTAINER_NAMESPACE, containerRec); + db.putRecPtr(fRecord + NOMINATED_NAMESPACE, nominatedRec); + db.putRecPtr(fRecord + PREV_DIRECTIVE_OF_FILE, prevRecInFile); db.putInt(fRecord + FILE_OFFSET, fileOffset); } @@ -65,7 +65,7 @@ public class PDOMCPPUsingDirective implements ICPPUsingDirective, IPDOMNode { */ public ICPPNamespaceScope getNominatedScope() { try { - int rec = fLinkage.getDB().getInt(fRecord + NOMINATED_NAMESPACE); + long rec = fLinkage.getDB().getRecPtr(fRecord + NOMINATED_NAMESPACE); PDOMNode node= fLinkage.getNode(rec); if (node instanceof ICPPNamespace) { return ((ICPPNamespace) node).getNamespaceScope(); @@ -83,7 +83,7 @@ public class PDOMCPPUsingDirective implements ICPPUsingDirective, IPDOMNode { */ public IScope getContainingScope() { try { - int rec = fLinkage.getDB().getInt(fRecord + CONTAINER_NAMESPACE); + long rec = fLinkage.getDB().getRecPtr(fRecord + CONTAINER_NAMESPACE); if (rec != 0) { PDOMNode node= fLinkage.getNode(rec); if (node instanceof PDOMCPPNamespace) { @@ -108,13 +108,13 @@ public class PDOMCPPUsingDirective implements ICPPUsingDirective, IPDOMNode { } } - public int getRecord() { + public long getRecord() { return fRecord; } - public int getPreviousRec() throws CoreException { + public long getPreviousRec() throws CoreException { final Database db= fLinkage.getDB(); - return db.getInt(fRecord + PREV_DIRECTIVE_OF_FILE); + return db.getRecPtr(fRecord + PREV_DIRECTIVE_OF_FILE); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java index 2d4a8614df5..35722029c3a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java @@ -77,8 +77,8 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { private void setValue(Database db, IVariable variable) throws CoreException { IValue val= variable.getInitialValue(); - int valueRec= PDOMValue.store(db, getLinkage(), val); - db.putInt(record + VALUE_OFFSET, valueRec); + long valueRec= PDOMValue.store(db, getLinkage(), val); + db.putRecPtr(record + VALUE_OFFSET, valueRec); } @Override @@ -87,7 +87,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { final Database db = getDB(); IVariable var= (IVariable) newBinding; IType mytype= getType(); - int valueRec= db.getInt(record + VALUE_OFFSET); + long valueRec= db.getRecPtr(record + VALUE_OFFSET); try { IType newType= var.getType(); setType(linkage, newType); @@ -106,14 +106,14 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { private void setType(final PDOMLinkage linkage, IType newType) throws CoreException, DOMException { PDOMNode typeNode = linkage.addType(this, newType); - getDB().putInt(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); + getDB().putRecPtr(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0); } protected byte encodeFlags(IVariable variable) throws DOMException { return PDOMCPPAnnotation.encodeAnnotation(variable); } - public PDOMCPPVariable(PDOMLinkage linkage, int record) { + public PDOMCPPVariable(PDOMLinkage linkage, long record) { super(linkage, record); } @@ -134,7 +134,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { public IType getType() { try { - int typeRec = getDB().getInt(record + TYPE_OFFSET); + long typeRec = getDB().getRecPtr(record + TYPE_OFFSET); return (IType)getLinkage().getNode(typeRec); } catch (CoreException e) { CCorePlugin.log(e); @@ -145,7 +145,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { public IValue getInitialValue() { try { final Database db = getDB(); - int valRec = db.getInt(record + VALUE_OFFSET); + long valRec = db.getRecPtr(record + VALUE_OFFSET); return PDOMValue.restore(db, getLinkage(), valRec); } catch (CoreException e) { CCorePlugin.log(e); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMGPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMGPPBasicType.java index 2351f580465..3be106d6d81 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMGPPBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMGPPBasicType.java @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.CoreException; class PDOMGPPBasicType extends PDOMCPPBasicType implements IGPPBasicType { - public PDOMGPPBasicType(PDOMLinkage linkage, int record) { + public PDOMGPPBasicType(PDOMLinkage linkage, long record) { super(linkage, record); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMInstanceCache.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMInstanceCache.java index 20e0c895d96..bdcb774342e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMInstanceCache.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMInstanceCache.java @@ -29,8 +29,8 @@ public class PDOMInstanceCache { public static PDOMInstanceCache getCache(PDOMBinding binding) { final PDOM pdom= binding.getPDOM(); - final int record= binding.getRecord(); - final Integer key = record+PDOMCPPLinkage.CACHE_INSTANCES; + final long record= binding.getRecord(); + final Long key = record+PDOMCPPLinkage.CACHE_INSTANCES; Object cache= pdom.getCachedResult(key); if (cache instanceof PDOMInstanceCache) { return (PDOMInstanceCache) cache; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMTemplateParameterArray.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMTemplateParameterArray.java index 64dd3fe6a2f..3a609fee5da 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMTemplateParameterArray.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMTemplateParameterArray.java @@ -29,15 +29,15 @@ public class PDOMTemplateParameterArray { * Stores the given template arguments in the database. * @return the record by which the arguments can be referenced. */ - public static int putArray(final Database db, IPDOMCPPTemplateParameter[] params) throws CoreException { + public static long putArray(final Database db, IPDOMCPPTemplateParameter[] params) throws CoreException { final short len= (short) Math.min(params.length, (Database.MAX_MALLOC_SIZE-2)/8); - final int block= db.malloc(2+8*len); - int p= block; + final long block= db.malloc(2+8*len); + long p= block; db.putShort(p, len); p+=2; for (int i=0; i