You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/04/18 06:52:57 UTC
cvs commit: xml-xalan/c/src/XSLT StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp XalanSourceTreeDocumentAllocator.cpp XalanSourceTreeDocumentAllocator.hpp
dbertoni 02/04/17 21:52:57
Modified: c/src/XSLT StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
XalanSourceTreeDocumentAllocator.cpp
XalanSourceTreeDocumentAllocator.hpp
Log:
New constructor for choosing node allocator block sizes.
Revision Changes Path
1.88 +9 -1 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- StylesheetExecutionContextDefault.cpp 16 Apr 2002 05:45:50 -0000 1.87
+++ StylesheetExecutionContextDefault.cpp 18 Apr 2002 04:52:57 -0000 1.88
@@ -960,7 +960,15 @@
assert(m_xsltProcessor != 0);
XalanSourceTreeDocument* const theDocument = m_usePerInstanceDocumentFactory == true ?
- m_documentAllocator.create() :
+ m_documentAllocator.create(
+ eDefaultAttributeAllocatorBlockSize,
+ eDefaultAttributeNSAllocatorBlockSize,
+ eDefaultCommentAllocatorBlockSize,
+ eDefaultElementAllocatorBlockSize,
+ eDefaultElementNSAllocatorBlockSize,
+ eDefaultPIAllocatorBlockSize,
+ eDefaultTextAllocatorBlockSize,
+ eDefaultTextIWSAllocatorBlockSize) :
getSourceTreeFactory();
assert(theDocument != 0);
1.77 +9 -1 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- StylesheetExecutionContextDefault.hpp 16 Apr 2002 05:45:50 -0000 1.76
+++ StylesheetExecutionContextDefault.hpp 18 Apr 2002 04:52:57 -0000 1.77
@@ -1046,7 +1046,15 @@
eXResultTreeFragAllocatorBlockSize = 10,
eResultTreeFragAllocatorBlockSize = 10,
eDocumentAllocatorBlockSize = 10,
- eDocumentFragmentAllocatorBlockSize = 10 };
+ eDocumentFragmentAllocatorBlockSize = 10,
+ eDefaultAttributeAllocatorBlockSize = 10,
+ eDefaultAttributeNSAllocatorBlockSize = 10,
+ eDefaultCommentAllocatorBlockSize = 10,
+ eDefaultElementAllocatorBlockSize = 10,
+ eDefaultElementNSAllocatorBlockSize = 10,
+ eDefaultPIAllocatorBlockSize = 10,
+ eDefaultTextAllocatorBlockSize = 20,
+ eDefaultTextIWSAllocatorBlockSize = 20 };
ElementRecursionStackType m_elementRecursionStack;
1.2 +34 -1 xml-xalan/c/src/XSLT/XalanSourceTreeDocumentAllocator.cpp
Index: XalanSourceTreeDocumentAllocator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanSourceTreeDocumentAllocator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanSourceTreeDocumentAllocator.cpp 16 Apr 2002 05:14:28 -0000 1.1
+++ XalanSourceTreeDocumentAllocator.cpp 18 Apr 2002 04:52:57 -0000 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -95,6 +95,39 @@
theValuesStringPoolBlockSize,
theValuesStringPoolBucketCount,
theValuesStringPoolBucketSize);
+
+ m_allocator.commitAllocation(theBlock);
+
+ return theResult;
+}
+
+
+
+XalanSourceTreeDocumentAllocator::data_type*
+XalanSourceTreeDocumentAllocator::create(
+ size_type theAttributeBlockSize,
+ size_type theAttributeNSBlockSize,
+ size_type theCommentBlockSize,
+ size_type theElementBlockSize,
+ size_type theElementNSBlockSize,
+ size_type thePIBlockSize,
+ size_type theTextBlockSize,
+ size_type theTextIWSBlockSize,
+ bool fPoolAllText)
+{
+ data_type* const theBlock = m_allocator.allocateBlock();
+ assert(theBlock != 0);
+
+ data_type* const theResult = new(theBlock) data_type(
+ theAttributeBlockSize,
+ theAttributeNSBlockSize,
+ theCommentBlockSize,
+ theElementBlockSize,
+ theElementNSBlockSize,
+ thePIBlockSize,
+ theTextBlockSize,
+ theTextIWSBlockSize,
+ fPoolAllText);
m_allocator.commitAllocation(theBlock);
1.2 +46 -6 xml-xalan/c/src/XSLT/XalanSourceTreeDocumentAllocator.hpp
Index: XalanSourceTreeDocumentAllocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanSourceTreeDocumentAllocator.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanSourceTreeDocumentAllocator.hpp 16 Apr 2002 05:14:28 -0000 1.1
+++ XalanSourceTreeDocumentAllocator.hpp 18 Apr 2002 04:52:57 -0000 1.2
@@ -79,10 +79,18 @@
typedef XalanSourceTreeDocument data_type;
- typedef ReusableArenaAllocator<data_type> ArenaAllocatorType;
- typedef ArenaAllocatorType::size_type size_type;
+ typedef ReusableArenaAllocator<data_type> ArenaAllocatorType;
+ typedef ArenaAllocatorType::size_type size_type;
- enum { eDefaultNamesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBlockSize,
+ enum { eDefaultAttributeAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeAllocatorBlockSize,
+ eDefaultAttributeNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeNSAllocatorBlockSize,
+ eDefaultCommentAllocatorBlockSize = XalanSourceTreeDocument::eDefaultCommentAllocatorBlockSize,
+ eDefaultElementAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementAllocatorBlockSize,
+ eDefaultElementNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementNSAllocatorBlockSize,
+ eDefaultPIAllocatorBlockSize = XalanSourceTreeDocument::eDefaultPIAllocatorBlockSize,
+ eDefaultTextAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextAllocatorBlockSize,
+ eDefaultTextIWSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextIWSAllocatorBlockSize,
+ eDefaultNamesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBlockSize,
eDefaultNamesStringPoolBucketCount = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketCount,
eDefaultNamesStringPoolBucketSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketSize,
eDefaultValuesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultValuesStringPoolBlockSize,
@@ -101,11 +109,17 @@
XalanSourceTreeDocumentAllocator(size_type theBlockCount);
~XalanSourceTreeDocumentAllocator();
-
+
/**
- * Create a ResultTreeFrag object.
+ * Create a XalanSourceTreeDocument object.
*
- * @param theValue The constructor parameter
+ * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
+ * @param theNamesStringPoolBlockSize The block size for allocating strings in the name pool
+ * @param theNamesStringPoolBucketCount The number of buckets for allocating strings in the name pool
+ * @param theNamesStringPoolBucketSize The bucket size for allocating strings in the name pool
+ * @param theValuesStringPoolBlockSize The block size for allocating strings in the values pool
+ * @param theValuesStringPoolBucketCount The number of buckets for allocating strings in the values pool
+ * @param theValuesStringPoolBucketSize The bucket size for allocating strings in the values pool
*
* @return pointer to a node
*/
@@ -118,6 +132,32 @@
block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
+
+ /**
+ * Create a XalanSourceTreeDocument object.
+ *
+ * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
+ * @param theAttributeBlockSize The block size for allocating attribute nodes
+ * @param theAttributeNSBlockSize The block size for allocating attribute NS nodes
+ * @param theCommentBlockSize The block size for allocating comment nodes
+ * @param theElementBlockSize The block size for allocating element nodes
+ * @param theElementNSBlockSize The block size for allocating element nodes
+ * @param theTextBlockSize The block size for allocating text nodes,
+ * @param theTextIWSBlockSize The block size for allocating text IWS nodes,
+ *
+ * @return pointer to a node
+ */
+ data_type*
+ create(
+ size_type theAttributeBlockSize,
+ size_type theAttributeNSBlockSize,
+ size_type theCommentBlockSize,
+ size_type theElementBlockSize,
+ size_type theElementNSBlockSize,
+ size_type thePIBlockSize,
+ size_type theTextBlockSize,
+ size_type theTextIWSBlockSize,
+ bool fPoolAllText = true);
/**
* Delete a XalanSourceTreeDocument object from allocator.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org