8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 07:23:04 +01:00

next step preparing to allocate auto objects memory from appropriate pool

This commit is contained in:
alexpeshkoff 2004-08-16 12:28:43 +00:00
parent 46fc37a888
commit 31039a254e
52 changed files with 488 additions and 413 deletions

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: alice.cpp,v 1.68 2004-07-03 02:32:32 brodsom Exp $
// $Id: alice.cpp,v 1.69 2004-08-16 12:28:13 alexpeshkoff Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -205,7 +205,7 @@ int common_main(int argc,
tdgbl->output_proc = output_proc;
tdgbl->output_data = output_data;
tdgbl->ALICE_permanent_pool = NULL;
tdgbl->ALICE_default_pool = NULL;
tdgbl->setDefaultPool(0);
try {

View File

@ -168,13 +168,24 @@ extern AliceGlobals* gdgbl;
class AliceGlobals : public thdd
{
private:
AliceMemoryPool* ALICE_default_pool;
public:
AliceGlobals(AliceMemoryPool* p) : pools(0, (AliceMemoryPool*)0,
pool_vec_t::allocator_type(*p)) {}
void setDefaultPool(AliceMemoryPool* p)
{
thdd::setPool(p);
ALICE_default_pool = p;
}
AliceMemoryPool* getDefaultPool()
{
return ALICE_default_pool;
}
user_action ALICE_data;
AliceMemoryPool* ALICE_permanent_pool;
AliceMemoryPool* ALICE_default_pool;
ISC_STATUS_ARRAY status_vector;
typedef std::vector<AliceMemoryPool*, Firebird::allocator<AliceMemoryPool*> > pool_vec_t;
pool_vec_t pools;

View File

@ -27,7 +27,7 @@
*
*____________________________________________________________
*
* $Id: alice_meta.epp,v 1.39 2004-07-02 10:02:46 brodsom Exp $
* $Id: alice_meta.epp,v 1.40 2004-08-16 12:28:13 alexpeshkoff Exp $
*/
#include "firebird.h"
@ -250,7 +250,7 @@ static alice_str* alloc_string(const TEXT** ptr)
const TEXT* p = *ptr;
USHORT length = (USHORT) *p++;
alice_str* string = FB_NEW_RPT(*tdgbl->ALICE_default_pool, length + 1) alice_str;
alice_str* string = FB_NEW_RPT(*tdgbl->getDefaultPool(), length + 1) alice_str;
TEXT* q = (TEXT *) string->str_data;
while (length--) {
@ -354,10 +354,10 @@ static TDR get_description(ISC_QUAD* blob_id)
id = gds__vax_integer(reinterpret_cast<const UCHAR*>(p), id_length);
p += id_length;
if (!trans) {
trans = ptr = FB_NEW(*tdgbl->ALICE_default_pool) tdr;
trans = ptr = FB_NEW(*tdgbl->getDefaultPool()) tdr;
}
else {
ptr->tdr_next = FB_NEW(*tdgbl->ALICE_default_pool) tdr;
ptr->tdr_next = FB_NEW(*tdgbl->getDefaultPool()) tdr;
ptr = ptr->tdr_next;
}
ptr->tdr_host_site = host_site;
@ -422,7 +422,7 @@ static void parse_fullpath(TDR trans)
if (*q) {
trans->tdr_filename = q + 1;
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->ALICE_default_pool, q - p + 1) alice_str;
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->getDefaultPool(), q - p + 1) alice_str;
strncpy((char*) trans->tdr_remote_site->str_data, (char*) p, q - p);
trans->tdr_remote_site->str_data[q - p] = '\0';
}
@ -453,7 +453,7 @@ static void parse_fullpath(TDR trans)
++p;
if (length) {
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->ALICE_default_pool, length + 1) alice_str;
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->getDefaultPool(), length + 1) alice_str;
TEXT* q = (TEXT *) trans->tdr_remote_site->str_data;
while (length--)
*q++ = *p++;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: all.cpp,v 1.26 2004-07-03 00:13:09 brodsom Exp $
// $Id: all.cpp,v 1.27 2004-08-16 12:28:13 alexpeshkoff Exp $
//
#include "firebird.h"
@ -52,7 +52,7 @@ void ALLA_fini(void)
}
tdgbl->pools.clear();
tdgbl->ALICE_default_pool = 0;
tdgbl->setDefaultPool(0);
tdgbl->ALICE_permanent_pool = 0;
}
@ -71,7 +71,7 @@ void ALLA_init(void)
#else
// TMN: John, what pool to use here?
tdgbl->ALICE_permanent_pool = AliceMemoryPool::createPool();
tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool;
tdgbl->setDefaultPool(tdgbl->ALICE_permanent_pool);
#endif
}

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: tdr.cpp,v 1.39 2004-07-02 10:02:46 brodsom Exp $
// $Id: tdr.cpp,v 1.40 2004-08-16 12:28:13 alexpeshkoff Exp $
//
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
//
@ -837,7 +837,7 @@ static void reattach_database(TDR trans)
if (TDR_attach_database(status_vector, trans,
reinterpret_cast<char*>(p)))
{
alice_str* string = FB_NEW_RPT(*tdgbl->ALICE_default_pool,
alice_str* string = FB_NEW_RPT(*tdgbl->getDefaultPool(),
strlen(reinterpret_cast<const char*>(p)) + 1) alice_str;
strcpy(reinterpret_cast<char*>(string->str_data),
reinterpret_cast<const char*>(p));

View File

@ -105,7 +105,7 @@ void ALLD_init()
DSQL_permanent_pool = DsqlMemoryPool::createPool();
pools = FB_NEW(*DSQL_permanent_pool) Firebird::vector<DsqlMemoryPool*>
(10, *DSQL_permanent_pool, dsql_type_vec);
tdsql->tsql_default = DSQL_permanent_pool;
tdsql->setDefaultPool(DSQL_permanent_pool);
}
}
@ -113,7 +113,7 @@ void ALLD_init()
void DsqlMemoryPool::ALLD_push(BLK object, dsql_lls** stack)
{
tsql* tdsql = DSQL_get_thread_data();
DsqlMemoryPool* pool = tdsql->tsql_default;
DsqlMemoryPool* pool = tdsql->getDefaultPool();
dsql_lls* node = pool->lls_cache.newBlock();
node->lls_object = object;

View File

@ -20,7 +20,7 @@
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* $Id: ddl.cpp,v 1.107 2004-07-01 00:46:10 skidder Exp $
* $Id: ddl.cpp,v 1.108 2004-08-16 12:28:24 alexpeshkoff Exp $
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
*
@ -2288,7 +2288,7 @@ static void define_procedure( dsql_req* request, NOD_TYPE op)
// fill req_procedure to allow procedure to self reference
const size_t nExtra = strlen(procedure_name->str_data);
dsql_prc* procedure = FB_NEW_RPT(*tdsql->tsql_default, nExtra) dsql_prc;
dsql_prc* procedure = FB_NEW_RPT(*tdsql->getDefaultPool(), nExtra) dsql_prc;
procedure->prc_name = procedure->prc_data;
procedure->prc_owner =
procedure->prc_data + procedure_name->str_length + 1;
@ -2915,7 +2915,7 @@ static void define_trigger( dsql_req* request, dsql_nod* node)
isc_random, isc_arg_string,
trigger_name->str_data, 0);
}
relation_node = FB_NEW_RPT(*tdsql->tsql_default, e_rln_count) dsql_nod;
relation_node = FB_NEW_RPT(*tdsql->getDefaultPool(), e_rln_count) dsql_nod;
node->nod_arg[e_trg_table] = relation_node;
relation_node->nod_type = nod_relation_name;
relation_node->nod_count = e_rln_count;
@ -3852,8 +3852,8 @@ static void define_view_trigger( dsql_req* request, dsql_nod* node, dsql_nod* rs
context = request->req_context->object();
if (context->ctx_alias) {
sav_context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default);
sav_context = FB_NEW(*tdsql->getDefaultPool())
dsql_ctx(*tdsql->getDefaultPool());
*sav_context = *context;
}
}
@ -5777,7 +5777,7 @@ static void save_field(dsql_req* request, const TEXT* field_name)
return;
}
dsql_fld* field = FB_NEW_RPT(*tdsql->tsql_default, strlen(field_name) + 1) dsql_fld;
dsql_fld* field = FB_NEW_RPT(*tdsql->getDefaultPool(), strlen(field_name) + 1) dsql_fld;
strcpy(field->fld_name, field_name);
field->fld_next = relation->rel_fields;
relation->rel_fields = field;
@ -5817,7 +5817,7 @@ static void save_relation( dsql_req* request, const dsql_str* relation_name)
}
else
{
relation = FB_NEW_RPT(*tdsql->tsql_default, relation_name->str_length) dsql_rel;
relation = FB_NEW_RPT(*tdsql->getDefaultPool(), relation_name->str_length) dsql_rel;
relation->rel_name = relation->rel_data;
relation->rel_owner =
relation->rel_data + relation_name->str_length + 1;

View File

@ -444,7 +444,7 @@ GDS_DSQL_ALLOCATE_CPP( ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
@ -452,11 +452,11 @@ GDS_DSQL_ALLOCATE_CPP( ISC_STATUS* user_status,
dsql_dbb* database = init(db_handle);
tdsql->tsql_default = DsqlMemoryPool::createPool();
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
// allocate the request block
dsql_req* request = FB_NEW(*tdsql->tsql_default) dsql_req(*tdsql->tsql_default);
dsql_req* request = FB_NEW(*tdsql->getDefaultPool()) dsql_req(*tdsql->getDefaultPool());
request->req_dbb = database;
*req_handle = request;
@ -518,13 +518,13 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
sing_status = 0;
dsql_req* request = *req_handle;
tdsql->tsql_default = &request->req_pool;
tdsql->setDefaultPool(&request->req_pool);
if ((SSHORT) in_msg_type == -1) {
request->req_type = REQ_EMBED_SELECT;
@ -659,16 +659,16 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
dsql_dbb* database = init(db_handle);
tdsql->tsql_default = DsqlMemoryPool::createPool();
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
// allocate the request block, then prepare the request
dsql_req* request = FB_NEW(*tdsql->tsql_default)
dsql_req(*tdsql->tsql_default);
dsql_req* request = FB_NEW(*tdsql->getDefaultPool())
dsql_req(*tdsql->getDefaultPool());
request->req_dbb = database;
request->req_trans = *trans_handle;
@ -966,12 +966,12 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
dsql_req* request = *req_handle;
tdsql->tsql_default = &request->req_pool;
tdsql->setDefaultPool(&request->req_pool);
// if the cursor isn't open, we've got a problem
@ -1186,12 +1186,12 @@ ISC_STATUS GDS_DSQL_FREE_CPP(ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
request = *req_handle;
tdsql->tsql_default = &request->req_pool;
tdsql->setDefaultPool(&request->req_pool);
if (option & DSQL_drop) {
// Release everything associate with the request.
@ -1252,12 +1252,12 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
dsql_req* request = *req_handle;
tdsql->tsql_default = &request->req_pool;
tdsql->setDefaultPool(&request->req_pool);
// if the cursor isn't open, we've got a problem
@ -1340,7 +1340,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
@ -1376,9 +1376,9 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
/* Because that's the client's allocated statement handle and we
don't want to trash the context in it -- 2001-Oct-27 Ann Harrison */
tdsql->tsql_default = DsqlMemoryPool::createPool();
dsql_req* request = FB_NEW(*tdsql->tsql_default)
dsql_req(*tdsql->tsql_default);
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
dsql_req* request = FB_NEW(*tdsql->getDefaultPool())
dsql_req(*tdsql->getDefaultPool());
request->req_dbb = database;
request->req_trans = *trans_handle;
@ -1440,9 +1440,9 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
// Now that we know that the new request exists, zap the old one.
tdsql->tsql_default = &old_request->req_pool;
tdsql->setDefaultPool(&old_request->req_pool);
release_request(old_request, true);
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
/* The request was sucessfully prepared, and the old request was
* successfully zapped, so set the client's handle to the new request */
@ -1502,12 +1502,12 @@ ISC_STATUS GDS_DSQL_SET_CURSOR_CPP( ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
dsql_req* request = *req_handle;
tdsql->tsql_default = &request->req_pool;
tdsql->setDefaultPool(&request->req_pool);
TEXT cursor[132];
@ -1612,7 +1612,7 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
try
{
tdsql->tsql_status = user_status;
tdsql->tsql_default = NULL;
tdsql->setDefaultPool(0);
init(0);
memset(buffer, 0, sizeof(buffer));
@ -4666,8 +4666,8 @@ static dsql_req* prepare(
// allocate the send and receive messages
request->req_send = FB_NEW(*tdsql->tsql_default) dsql_msg;
dsql_msg* message = FB_NEW(*tdsql->tsql_default) dsql_msg;
request->req_send = FB_NEW(*tdsql->getDefaultPool()) dsql_msg;
dsql_msg* message = FB_NEW(*tdsql->getDefaultPool()) dsql_msg;
request->req_receive = message;
message->msg_number = 1;
@ -4676,7 +4676,7 @@ static dsql_req* prepare(
/* allocate a message in which to send scrolling information
outside of the normal send/receive protocol */
request->req_async = message = FB_NEW(*tdsql->tsql_default) dsql_msg;
request->req_async = message = FB_NEW(*tdsql->getDefaultPool()) dsql_msg;
message->msg_number = 2;
}
#endif
@ -4737,7 +4737,7 @@ static dsql_req* prepare(
{
// Allocate persistent blr string from request's pool.
request->req_blr_string = FB_NEW_RPT(*tdsql->tsql_default, 980) dsql_str;
request->req_blr_string = FB_NEW_RPT(*tdsql->getDefaultPool(), 980) dsql_str;
}
else {
/* Allocate transient blr string from permanent pool so
@ -4914,10 +4914,10 @@ static void release_request(dsql_req* request, bool top_level)
for (dsql_req* child = request->req_offspring; child; child = child->req_sibling) {
child->req_flags |= REQ_orphan;
child->req_parent = NULL;
DsqlMemoryPool *save_default = tdsql->tsql_default;
tdsql->tsql_default = &child->req_pool;
DsqlMemoryPool *save_default = tdsql->getDefaultPool();
tdsql->setDefaultPool(&child->req_pool);
release_request(child, false);
tdsql->tsql_default = save_default;
tdsql->setDefaultPool(save_default);
}
// For top level requests that are linked to a parent, unlink it

View File

@ -617,10 +617,21 @@ public:
class tsql : public thdd
{
public:
private:
DsqlMemoryPool* tsql_default;
public:
ISC_STATUS* tsql_status;
ISC_STATUS* tsql_user_status;
void setDefaultPool(DsqlMemoryPool* p)
{
thdd::setPool(p);
tsql_default = p;
}
DsqlMemoryPool* getDefaultPool()
{
return tsql_default;
}
};
inline tsql* DSQL_get_thread_data() {

View File

@ -594,7 +594,7 @@ void GEN_port( dsql_req* request, dsql_msg* message)
// Allocate buffer for message
// CVC: again, final possibility of having overflow! Should be < 64K
const USHORT new_len = message->msg_length + DOUBLE_ALIGN - 1;
dsql_str* buffer = FB_NEW_RPT(*tdsql->tsql_default, new_len) dsql_str;
dsql_str* buffer = FB_NEW_RPT(*tdsql->getDefaultPool(), new_len) dsql_str;
message->msg_buffer =
(UCHAR *) FB_ALIGN((U_IPTR) buffer->str_data, DOUBLE_ALIGN);

View File

@ -88,7 +88,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
{
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default,
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(),
(numeric_flag == CONSTANT_TIMESTAMP ||
numeric_flag == CONSTANT_SINT64) ? 2 : 1) dsql_nod;
node->nod_type = nod_constant;
@ -235,7 +235,7 @@ dsql_nod* MAKE_str_constant(dsql_str* constant, SSHORT character_set)
{
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), 1) dsql_nod;
node->nod_type = nod_constant;
DEV_BLKCHK(constant, dsql_type_str);
@ -1565,7 +1565,7 @@ dsql_nod* MAKE_node(NOD_TYPE type, int count)
{
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), count) dsql_nod;
node->nod_type = type;
node->nod_count = count;
@ -1604,7 +1604,7 @@ dsql_par* MAKE_parameter(dsql_msg* message, bool sqlda_flag, bool null_flag,
tsql* tdsql = DSQL_get_thread_data();
dsql_par* parameter = FB_NEW(*tdsql->tsql_default) dsql_par;
dsql_par* parameter = FB_NEW(*tdsql->getDefaultPool()) dsql_par;
parameter->par_message = message;
parameter->par_next = message->msg_parameters;
if (parameter->par_next != 0)
@ -1682,7 +1682,7 @@ dsql_sym* MAKE_symbol(dsql_dbb* database,
tsql* tdsql = DSQL_get_thread_data();
dsql_sym* symbol = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_sym;
dsql_sym* symbol = FB_NEW_RPT(*tdsql->getDefaultPool(), length) dsql_sym;
symbol->sym_type = type;
symbol->sym_object = (BLK) object;
symbol->sym_dbb = database;
@ -1716,7 +1716,7 @@ dsql_str* MAKE_tagged_string(const char* strvar, size_t length, const char* char
{
tsql* tdsql = DSQL_get_thread_data();
dsql_str* string = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_str;
dsql_str* string = FB_NEW_RPT(*tdsql->getDefaultPool(), length) dsql_str;
string->str_charset = charset;
string->str_length = length;
memcpy(string->str_data, strvar, length);
@ -1770,7 +1770,7 @@ dsql_nod* MAKE_variable(dsql_fld* field,
tsql* tdsql = DSQL_get_thread_data();
dsql_var* variable = FB_NEW_RPT(*tdsql->tsql_default, strlen(name)) dsql_var;
dsql_var* variable = FB_NEW_RPT(*tdsql->getDefaultPool(), strlen(name)) dsql_var;
dsql_nod* node = MAKE_node(nod_variable, e_var_count);
node->nod_arg[e_var_variable] = (dsql_nod*) variable;
variable->var_msg_number = msg_number;

View File

@ -1450,7 +1450,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
}
else if (!DDL_ids(request)) {
relation =
FB_NEW_RPT(*tdsql->tsql_default,
FB_NEW_RPT(*tdsql->getDefaultPool(),
name->str_length + strlen(X.RDB$OWNER_NAME)) dsql_rel;
relation->rel_flags |= REL_new_relation;
}
@ -1509,7 +1509,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
// Allocate from default or permanent pool as appropriate
if (relation->rel_flags & REL_new_relation)
*ptr = field = FB_NEW_RPT(*tdsql->tsql_default,
*ptr = field = FB_NEW_RPT(*tdsql->getDefaultPool(),
strlen(RFR.RDB$FIELD_NAME)) dsql_fld;
else
*ptr = field = FB_NEW_RPT(*dbb->dbb_pool,
@ -1563,7 +1563,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
// Allocate from default or permanent pool as appropriate
if (relation->rel_flags & REL_new_relation)
*ptr = field = FB_NEW_RPT(*tdsql->tsql_default,
*ptr = field = FB_NEW_RPT(*tdsql->getDefaultPool(),
strlen(RFR.RDB$FIELD_NAME)) dsql_fld;
else
*ptr = field = FB_NEW_RPT(*dbb->dbb_pool,

View File

@ -7178,13 +7178,13 @@ static dsql_fld* make_field (dsql_nod* field_name)
if (field_name == NULL)
{
dsql_fld* field =
FB_NEW_RPT(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
FB_NEW_RPT(*tdsql->getDefaultPool(), sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
return field;
}
const dsql_str* string = (dsql_str*) field_name->nod_arg[1];
dsql_fld* field =
FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
FB_NEW_RPT(*tdsql->getDefaultPool(), strlen ((SCHAR*) string->str_data)) dsql_fld;
strcpy (field->fld_name, (TEXT*) string->str_data);
return field;
@ -7205,7 +7205,7 @@ static dsql_fil* make_file()
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil;
dsql_fil* temp_file = FB_NEW(*tdsql->getDefaultPool()) dsql_fil;
return temp_file;
}
@ -7233,7 +7233,7 @@ static dsql_nod* make_list (dsql_nod* node)
USHORT l = stack.getCount();
dsql_nod* old = node;
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
node = FB_NEW_RPT(*tdsql->getDefaultPool(), l) dsql_nod;
node->nod_count = l;
node->nod_type = nod_list;
node->nod_flags = old->nod_flags;
@ -7261,7 +7261,7 @@ static dsql_nod* make_parameter (void)
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), 1) dsql_nod;
node->nod_type = nod_parameter;
node->nod_line = (USHORT) lex.lines_bk;
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
@ -7289,7 +7289,7 @@ static dsql_nod* make_node (NOD_TYPE type,
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), count) dsql_nod;
node->nod_type = type;
node->nod_line = (USHORT) lex.lines_bk;
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
@ -7322,7 +7322,7 @@ static dsql_nod* make_flag_node (NOD_TYPE type,
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), count) dsql_nod;
node->nod_type = type;
node->nod_flags = flag;
node->nod_line = (USHORT) lex.lines_bk;

View File

@ -4328,13 +4328,13 @@ static dsql_fld* make_field (dsql_nod* field_name)
if (field_name == NULL)
{
dsql_fld* field =
FB_NEW_RPT(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
FB_NEW_RPT(*tdsql->getDefaultPool(), sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
return field;
}
const dsql_str* string = (dsql_str*) field_name->nod_arg[1];
dsql_fld* field =
FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
FB_NEW_RPT(*tdsql->getDefaultPool(), strlen ((SCHAR*) string->str_data)) dsql_fld;
strcpy (field->fld_name, (TEXT*) string->str_data);
return field;
@ -4355,7 +4355,7 @@ static dsql_fil* make_file()
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil;
dsql_fil* temp_file = FB_NEW(*tdsql->getDefaultPool()) dsql_fil;
return temp_file;
}
@ -4383,7 +4383,7 @@ static dsql_nod* make_list (dsql_nod* node)
USHORT l = stack.getCount();
dsql_nod* old = node;
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
node = FB_NEW_RPT(*tdsql->getDefaultPool(), l) dsql_nod;
node->nod_count = l;
node->nod_type = nod_list;
node->nod_flags = old->nod_flags;
@ -4411,7 +4411,7 @@ static dsql_nod* make_parameter (void)
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), 1) dsql_nod;
node->nod_type = nod_parameter;
node->nod_line = (USHORT) lex.lines_bk;
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
@ -4439,7 +4439,7 @@ static dsql_nod* make_node (NOD_TYPE type,
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), count) dsql_nod;
node->nod_type = type;
node->nod_line = (USHORT) lex.lines_bk;
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
@ -4472,7 +4472,7 @@ static dsql_nod* make_flag_node (NOD_TYPE type,
**************************************/
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), count) dsql_nod;
node->nod_type = type;
node->nod_flags = flag;
node->nod_line = (USHORT) lex.lines_bk;

View File

@ -361,8 +361,8 @@ dsql_ctx* PASS1_make_context(dsql_req* request, dsql_nod* relation_node)
}
// Set up context block.
dsql_ctx* context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default);
dsql_ctx* context = FB_NEW(*tdsql->getDefaultPool())
dsql_ctx(*tdsql->getDefaultPool());
context->ctx_relation = relation;
context->ctx_procedure = procedure;
context->ctx_request = request;
@ -466,7 +466,7 @@ dsql_ctx* PASS1_make_context(dsql_req* request, dsql_nod* relation_node)
if (count)
{
// Initialize this stack variable, and make it look like a node
std::auto_ptr<dsql_nod> desc_node(FB_NEW_RPT(*tdsql->tsql_default, 0) dsql_nod);
std::auto_ptr<dsql_nod> desc_node(FB_NEW_RPT(*tdsql->getDefaultPool(), 0) dsql_nod);
dsql_nod* const* input = context->ctx_proc_inputs->nod_arg;
for (dsql_fld* field = procedure->prc_inputs;
@ -2991,11 +2991,11 @@ static void pass1_blob( dsql_req* request, dsql_nod* input)
request->req_type = (input->nod_type == nod_get_segment) ?
REQ_GET_SEGMENT : REQ_PUT_SEGMENT;
dsql_blb* blob = FB_NEW(*tdsql->tsql_default) dsql_blb;
dsql_blb* blob = FB_NEW(*tdsql->getDefaultPool()) dsql_blb;
request->req_blob = blob;
blob->blb_field = field;
blob->blb_open_in_msg = request->req_send;
blob->blb_open_out_msg = FB_NEW(*tdsql->tsql_default) dsql_msg;
blob->blb_open_out_msg = FB_NEW(*tdsql->getDefaultPool()) dsql_msg;
blob->blb_segment_msg = request->req_receive;
// Create a parameter for the blob segment
@ -3137,7 +3137,7 @@ static dsql_nod* pass1_collate( dsql_req* request, dsql_nod* sub1,
tsql* tdsql = DSQL_get_thread_data();
dsql_nod* node = MAKE_node(nod_cast, e_cast_count);
dsql_fld* field = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_fld;
dsql_fld* field = FB_NEW_RPT(*tdsql->getDefaultPool(), 1) dsql_fld;
field->fld_name[0] = 0;
node->nod_arg[e_cast_target] = (dsql_nod*) field;
node->nod_arg[e_cast_source] = sub1;
@ -4852,7 +4852,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, tsql* tdsql,
DEV_BLKCHK(field, dsql_type_fld);
// Copy fieldname to a new string.
dsql_str* alias = FB_NEW_RPT(*tdsql->tsql_default, strlen(field->fld_name)) dsql_str;
dsql_str* alias = FB_NEW_RPT(*tdsql->getDefaultPool(), strlen(field->fld_name)) dsql_str;
strcpy(alias->str_data, field->fld_name);
alias->str_length = strlen(field->fld_name);
@ -4870,7 +4870,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, tsql* tdsql,
{
// Copy aliasname to a new string.
const dsql_str* alias_alias = (dsql_str*) select_item->nod_arg[e_alias_alias];
dsql_str* alias = FB_NEW_RPT(*tdsql->tsql_default, strlen(alias_alias->str_data)) dsql_str;
dsql_str* alias = FB_NEW_RPT(*tdsql->getDefaultPool(), strlen(alias_alias->str_data)) dsql_str;
strcpy(alias->str_data, alias_alias->str_data);
alias->str_length = strlen(alias_alias->str_data);
@ -5081,8 +5081,8 @@ static dsql_nod* pass1_alias_list(dsql_req* request, dsql_nod* alias_list)
// make up a dummy context to hold the resultant relation.
tsql* tdsql = DSQL_get_thread_data();
dsql_ctx* new_context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default);
dsql_ctx* new_context = FB_NEW(*tdsql->getDefaultPool())
dsql_ctx(*tdsql->getDefaultPool());
new_context->ctx_context = context->ctx_context;
new_context->ctx_relation = relation;
@ -5095,7 +5095,7 @@ static dsql_nod* pass1_alias_list(dsql_req* request, dsql_nod* alias_list)
alias_length += static_cast < USHORT > (((dsql_str*) *arg)->str_length);
}
dsql_str* alias = FB_NEW_RPT(*tdsql->tsql_default, alias_length) dsql_str;
dsql_str* alias = FB_NEW_RPT(*tdsql->getDefaultPool(), alias_length) dsql_str;
alias->str_length = alias_length;
TEXT* p = new_context->ctx_alias = (TEXT*) alias->str_data;
@ -5207,7 +5207,7 @@ static dsql_str* pass1_alias_concat(const dsql_str* input1, const dsql_str* inpu
if (input2) {
length += input2->str_length;
}
dsql_str* output = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_str;
dsql_str* output = FB_NEW_RPT(*tdsql->getDefaultPool(), length) dsql_str;
output->str_length = length;
TEXT* ptr = output->str_data;
if (input1) {
@ -5434,8 +5434,8 @@ static dsql_nod* pass1_rse( dsql_req* request, dsql_nod* input, dsql_nod* order,
isc_arg_gds, isc_random, isc_arg_string, "WITH LOCK", 0);
}
parent_context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default);
parent_context = FB_NEW(*tdsql->getDefaultPool())
dsql_ctx(*tdsql->getDefaultPool());
parent_context->ctx_context = request->req_context_number++;
parent_context->ctx_scope_level = request->req_scope_level;
aggregate = MAKE_node(nod_aggregate, e_agg_count);
@ -6067,8 +6067,8 @@ static dsql_nod* pass1_union( dsql_req* request, dsql_nod* input,
} // end scope block
// generate a context for the union itself.
dsql_ctx* union_context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default);
dsql_ctx* union_context = FB_NEW(*tdsql->getDefaultPool())
dsql_ctx(*tdsql->getDefaultPool());
union_context->ctx_context = request->req_context_number++;
// generate the list of fields to select.
@ -6142,7 +6142,7 @@ static dsql_nod* pass1_union( dsql_req* request, dsql_nod* input,
dsql_nod* map_node = MAKE_node(nod_map, e_map_count);
*ptr = map_node;
map_node->nod_arg[e_map_context] = (dsql_nod*) union_context;
dsql_map* map = FB_NEW(*tdsql->tsql_default) dsql_map;
dsql_map* map = FB_NEW(*tdsql->getDefaultPool()) dsql_map;
map_node->nod_arg[e_map_map] = (dsql_nod*) map;
// set up the dsql_map* between the sub-rses and the union context.
@ -6289,7 +6289,7 @@ static void pass1_union_auto_cast(dsql_nod* input, const dsc& desc,
else {
tsql* tdsql = DSQL_get_thread_data();
cast_node = MAKE_node(nod_cast, e_cast_count);
dsql_fld* afield = FB_NEW_RPT(*tdsql->tsql_default, 0) dsql_fld;
dsql_fld* afield = FB_NEW_RPT(*tdsql->getDefaultPool(), 0) dsql_fld;
cast_node->nod_arg[e_cast_target] = (dsql_nod*) afield;
// We want to leave the ALIAS node on his place, because a UNION
// uses the select_items from the first sub-rse to determine the
@ -6307,7 +6307,7 @@ static void pass1_union_auto_cast(dsql_nod* input, const dsc& desc,
// Create new node for alias and copy fieldname
alias_node = MAKE_node(nod_alias, e_alias_count);
// Copy fieldname to a new string.
dsql_str* str_alias = FB_NEW_RPT(*tdsql->tsql_default,
dsql_str* str_alias = FB_NEW_RPT(*tdsql->getDefaultPool(),
strlen(sub_field->fld_name)) dsql_str;
strcpy(str_alias->str_data, sub_field->fld_name);
str_alias->str_length = strlen(sub_field->fld_name);
@ -6646,7 +6646,7 @@ static dsql_nod* post_map( dsql_nod* node, dsql_ctx* context)
break;
if (!map) {
map = FB_NEW(*tdsql->tsql_default) dsql_map;
map = FB_NEW(*tdsql->getDefaultPool()) dsql_map;
map->map_position = (USHORT) count;
map->map_next = context->ctx_map;
context->ctx_map = map;

View File

@ -30,7 +30,7 @@
* John Bellardo <bellardo@cs.ucsd.edu>
*
*
* $Id: firebird.h,v 1.28 2004-07-30 22:38:02 skidder Exp $
* $Id: firebird.h,v 1.29 2004-08-16 12:28:43 alexpeshkoff Exp $
*
*/
@ -115,11 +115,10 @@
#endif
#if defined(WIN_NT) && defined(SUPERSERVER) && !defined(EMBEDDED)
#include <windows.h>
// Comment this definition to build without priority scheduler
// OR:
// Uncomment this definition to build with priority scheduler
//#define THREAD_PSCHED
#define THREAD_PSCHED
#endif
#endif /* INCLUDE_Firebird_H */

View File

@ -187,7 +187,8 @@ void ALL_init(void)
thread_db* tdbb = JRD_get_thread_data();
Database* dbb = tdbb->tdbb_database;
JrdMemoryPool* pool = tdbb->tdbb_default = dbb->dbb_permanent;
JrdMemoryPool* pool = dbb->dbb_permanent;
tdbb->setDefaultPool(pool);
// dbb->dbb_permanent->setExtendSize(PERM_EXTEND_SIZE);
dbb->dbb_pools[0] = pool;
dbb->dbb_bufferpool = JrdMemoryPool::createPool();

View File

@ -33,7 +33,7 @@
*
*/
/*
$Id: blb.cpp,v 1.84 2004-08-03 16:04:17 skidder Exp $
$Id: blb.cpp,v 1.85 2004-08-16 12:28:16 alexpeshkoff Exp $
*/
#include "firebird.h"
@ -661,7 +661,7 @@ SLONG BLB_get_slice(thread_db* tdbb,
SET_TDBB(tdbb);
Database* database = GET_DBB();
tdbb->tdbb_default = transaction->tra_pool;
tdbb->setDefaultPool(transaction->tra_pool);
/* Checkout slice description language */
SLONG variables[64];
@ -1429,7 +1429,7 @@ void BLB_put_slice( thread_db* tdbb,
*
**************************************/
SET_TDBB(tdbb);
tdbb->tdbb_default = transaction->tra_pool;
tdbb->setDefaultPool(transaction->tra_pool);
/* Do initial parse of slice description to get relation and field identification */
sdl_info info;

View File

@ -372,7 +372,7 @@ static ISC_STATUS open_blob(
/* utilize a temporary control block just to pass the three
necessary internal parameters to the filter */
BlobControl temp(*tdbb->tdbb_default); // !!!!!!!!!!
BlobControl temp;
temp.ctl_internal[0] = dbb;
temp.ctl_internal[1] = tra_handle;
temp.ctl_internal[2] = NULL;

View File

@ -68,6 +68,8 @@ public:
public:
BlobControl(MemoryPool& p)
: ctl_exception_message(p) { }
BlobControl()
: ctl_exception_message() { }
};

View File

@ -240,7 +240,7 @@ USHORT BTR_all(thread_db* tdbb,
}
delete *csb_idx;
*csb_idx = FB_NEW_RPT(*tdbb->tdbb_default, root->irt_count) IndexDescAlloc();
*csb_idx = FB_NEW_RPT(*tdbb->getDefaultPool(), root->irt_count) IndexDescAlloc();
index_desc* buffer = (*csb_idx)->items;
USHORT count = 0;
for (USHORT i = 0; i < root->irt_count; i++) {
@ -1612,7 +1612,7 @@ void BTR_selectivity(thread_db* tdbb, const jrd_rel* relation, USHORT id,
const ULONG segments = root->irt_rpt[id].irt_keys;
// SSHORT count, stuff_count, pos, i;
Firebird::HalfStaticArray<ULONG, 4> duplicatesList(*tdbb->tdbb_default);
Firebird::HalfStaticArray<ULONG, 4> duplicatesList(*tdbb->getDefaultPool());
duplicatesList.grow(segments);
memset(duplicatesList.begin(), 0, segments * sizeof(ULONG));
@ -2282,7 +2282,7 @@ static USHORT compress_root(thread_db* tdbb, index_root_page* page)
CHECK_DBB(dbb);
UCHAR* const temp =
(UCHAR*)tdbb->tdbb_default->allocate((SLONG) dbb->dbb_page_size, 0
(UCHAR*)tdbb->getDefaultPool()->allocate((SLONG) dbb->dbb_page_size, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
@ -2307,7 +2307,7 @@ static USHORT compress_root(thread_db* tdbb, index_root_page* page)
}
}
const USHORT l = p - temp;
tdbb->tdbb_default->deallocate(temp);
tdbb->getDefaultPool()->deallocate(temp);
return l;
}
@ -2374,7 +2374,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer)
USHORT newNextLength = 0;
USHORT length = MAX(removingNode.length + removingNode.prefix,
nextNode.length + nextNode.prefix);
UCHAR* tempData = FB_NEW(*tdbb->tdbb_default) UCHAR[length];
UCHAR* tempData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[length];
length = 0;
if (nextNode.prefix > removingNode.prefix) {
// The next node uses data from the node that is going to
@ -2419,8 +2419,8 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer)
// Only update offsets pointing after the deleted node and
// remove jump nodes pointing to the deleted node or node
// next to the deleted one.
jumpNodeList* jumpNodes = FB_NEW(*tdbb->tdbb_default)
jumpNodeList(*tdbb->tdbb_default);
jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool())
jumpNodeList(*tdbb->getDefaultPool());
IndexJumpInfo jumpInfo;
pointer = BTreeNode::getPointerFirstNode(page, &jumpInfo);
@ -2444,7 +2444,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer)
if (jumpNode.offset > offsetDeletePoint) {
newJumpNode.offset -= delta;
}
newJumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[newJumpNode.length];
newJumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newJumpNode.length];
memcpy(newJumpNode.data, delJumpNode.data, addLength);
memcpy(newJumpNode.data + addLength, jumpNode.data, jumpNode.length);
}
@ -2455,7 +2455,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer)
if (jumpNode.offset > offsetDeletePoint) {
newJumpNode.offset -= delta;
}
newJumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[newJumpNode.length];
newJumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newJumpNode.length];
memcpy(newJumpNode.data, jumpNode.data, newJumpNode.length);
}
jumpNodes->add(newJumpNode);
@ -2670,13 +2670,13 @@ static SLONG fast_load(thread_db* tdbb,
bool useJumpInfo = (dbb->dbb_ods_version >= ODS_VERSION11);
typedef Firebird::vector<jumpNodeList*> jumpNodeListContainer;
jumpNodeListContainer* jumpNodes = FB_NEW(*tdbb->tdbb_default)
jumpNodeListContainer(*tdbb->tdbb_default);
jumpNodes->push_back(FB_NEW(*tdbb->tdbb_default) jumpNodeList(*tdbb->tdbb_default));
jumpNodeListContainer* jumpNodes = FB_NEW(*tdbb->getDefaultPool())
jumpNodeListContainer(*tdbb->getDefaultPool());
jumpNodes->push_back(FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool()));
keyList* jumpKeys = FB_NEW(*tdbb->tdbb_default) keyList(*tdbb->tdbb_default);
jumpKeys->push_back(FB_NEW(*tdbb->tdbb_default) dynKey);
(*jumpKeys)[0]->keyData = FB_NEW(*tdbb->tdbb_default) UCHAR[key_length];
keyList* jumpKeys = FB_NEW(*tdbb->getDefaultPool()) keyList(*tdbb->getDefaultPool());
jumpKeys->push_back(FB_NEW(*tdbb->getDefaultPool()) dynKey);
(*jumpKeys)[0]->keyData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[key_length];
IndexJumpInfo jumpInfo;
jumpInfo.jumpAreaSize = 0;
@ -2762,7 +2762,7 @@ static SLONG fast_load(thread_db* tdbb,
ULONG duplicates = 0;
const ULONG segments = idx->idx_count;
// SSHORT segment, stuff_count, pos, i;
Firebird::HalfStaticArray<ULONG, 4> duplicatesList(*tdbb->tdbb_default);
Firebird::HalfStaticArray<ULONG, 4> duplicatesList(*tdbb->getDefaultPool());
duplicatesList.grow(segments);
memset(duplicatesList.begin(), 0, segments * sizeof(ULONG));
@ -3030,7 +3030,7 @@ static SLONG fast_load(thread_db* tdbb,
jumpKey->keyLength, key->key_data, newNode.prefix);
jumpNode.length = newNode.prefix - jumpNode.prefix;
jumpNode.offset = (newNode.nodePointer - (UCHAR*)bucket);
jumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[jumpNode.length];
jumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[jumpNode.length];
memcpy(jumpNode.data, key->key_data + jumpNode.prefix, jumpNode.length);
// Push node on end in list
leafJumpNodes->add(jumpNode);
@ -3090,12 +3090,12 @@ static SLONG fast_load(thread_db* tdbb,
key->key_length = 0;
// Initialize jumpNodes variables for new level
jumpNodes->push_back(FB_NEW(*tdbb->tdbb_default)
jumpNodeList(*tdbb->tdbb_default));
jumpKeys->push_back(FB_NEW(*tdbb->tdbb_default) dynKey);
jumpNodes->push_back(FB_NEW(*tdbb->getDefaultPool())
jumpNodeList(*tdbb->getDefaultPool()));
jumpKeys->push_back(FB_NEW(*tdbb->getDefaultPool()) dynKey);
(*jumpKeys)[level]->keyLength = 0;
(*jumpKeys)[level]->keyData =
FB_NEW(*tdbb->tdbb_default) UCHAR[key_length];
FB_NEW(*tdbb->getDefaultPool()) UCHAR[key_length];
totalJumpSize[level] = 0;
newAreaPointers[level] = levelPointer + jumpInfo.jumpAreaSize;
}
@ -3247,7 +3247,7 @@ static SLONG fast_load(thread_db* tdbb,
pageJumpKey->keyLength, temp_key.key_data, levelNode[level].prefix);
jumpNode.length = levelNode[level].prefix - jumpNode.prefix;
jumpNode.offset = (levelNode[level].nodePointer - (UCHAR*)bucket);
jumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[jumpNode.length];
jumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[jumpNode.length];
memcpy(jumpNode.data, temp_key.key_data + jumpNode.prefix,
jumpNode.length);
// Push node on end in list
@ -4501,7 +4501,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
newBucket->btr_length += l;
// Generate new jump nodes.
jumpNodeList* jumpNodes = FB_NEW(*tdbb->tdbb_default) jumpNodeList(*tdbb->tdbb_default);
jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool());
USHORT jumpersNewSize = 0;
// Update jump information on scratch page, so generate_jump_nodes
// can deal with it.
@ -4805,7 +4805,7 @@ static void generate_jump_nodes(thread_db* tdbb, btree_page* page,
currentData, node.prefix);
jumpNode.length = node.prefix - jumpNode.prefix;
if (jumpNode.length) {
jumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[jumpNode.length];
jumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[jumpNode.length];
const UCHAR* const q = currentData + jumpNode.prefix;
memcpy(jumpNode.data, q, jumpNode.length);
}
@ -4858,7 +4858,7 @@ static void generate_jump_nodes(thread_db* tdbb, btree_page* page,
currentData, node->btn_prefix);
jumpNode.length = node->btn_prefix - jumpNode.prefix;
if (jumpNode.length) {
jumpNode.data = FB_NEW(*tdbb->tdbb_default) UCHAR[jumpNode.length];
jumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[jumpNode.length];
const UCHAR* const q = currentData + jumpNode.prefix;
memcpy(jumpNode.data, q, jumpNode.length);
}
@ -5020,7 +5020,7 @@ static SLONG insert_node(thread_db* tdbb,
// Update the values for the next node after our new node.
// First, store needed data for beforeInsertNode into tempData.
UCHAR* tempData = FB_NEW(*tdbb->tdbb_default) UCHAR[newLength];
UCHAR* tempData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newLength];
{ // scope
const UCHAR* p = beforeInsertNode.data + newPrefix - beforeInsertNode.prefix;
memcpy(tempData, p, newLength);
@ -5083,7 +5083,7 @@ static SLONG insert_node(thread_db* tdbb,
USHORT newPrefixTotalBySplit = 0;
USHORT splitJumpNodeIndex = 0;
IndexJumpInfo jumpInfo;
jumpNodeList* jumpNodes = FB_NEW(*tdbb->tdbb_default) jumpNodeList(*tdbb->tdbb_default);
jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool());
USHORT ensureEndInsert = 0;
if (endOfPage) {
@ -5269,7 +5269,7 @@ static SLONG insert_node(thread_db* tdbb,
for (i = 0; i < jumpNodes->getCount(); i++, index++) {
if (index > splitJumpNodeIndex) {
const USHORT length = walkJumpNode[i].prefix + walkJumpNode[i].length;
UCHAR* newData = FB_NEW(*tdbb->tdbb_default) UCHAR[length];
UCHAR* newData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[length];
memcpy(newData, new_key->key_data, walkJumpNode[i].prefix);
memcpy(newData + walkJumpNode[i].prefix, walkJumpNode[i].data,
walkJumpNode[i].length);

View File

@ -1962,8 +1962,8 @@ void CCH_prefetch(thread_db* tdbb, SLONG * pages, SSHORT count)
/* Switch default pool to permanent pool for setting bits in
prefetch bitmap. */
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = dbb->dbb_bufferpool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(dbb->dbb_bufferpool);
/* The global prefetch bitmap is the key to the I/O coalescense
mechanism which dovetails all thread prefetch requests to
@ -1992,7 +1992,7 @@ void CCH_prefetch(thread_db* tdbb, SLONG * pages, SSHORT count)
prefetch_epilogue(&prefetch, tdbb->tdbb_status_vector);
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
#endif
}
@ -3086,7 +3086,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
ISC_STATUS_ARRAY status_vector;
/* Dummy attachment needed for lock owner identification. */
tdbb->tdbb_database = dbb;
tdbb->tdbb_default = dbb->dbb_bufferpool;
tdbb->setDefaultPool(dbb->dbb_bufferpool);
tdbb->tdbb_status_vector = status_vector;
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) Attachment();
@ -3258,7 +3258,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
/* Dummy attachment needed for lock owner identification. */
tdbb->tdbb_database = dbb;
tdbb->tdbb_default = dbb->dbb_bufferpool;
tdbb->setDefaultPool(dbb->dbb_bufferpool);
tdbb->tdbb_status_vector = status_vector;
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) Attachment(dbb);
@ -3779,8 +3779,8 @@ static void expand_buffers(thread_db* tdbb, ULONG number)
/* Allocate and initialize buffers control block */
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = dbb->dbb_bufferpool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(dbb->dbb_bufferpool);
old = dbb->dbb_bcb;
const bcb_repeat* const old_end = old->bcb_rpt + old->bcb_count;
@ -3870,7 +3870,7 @@ static void expand_buffers(thread_db* tdbb, ULONG number)
dbb->dbb_bcb = new_block;
delete old;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}

View File

@ -553,11 +553,11 @@ jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, USHORT internal_flag)
SET_TDBB(tdbb);
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
// 26.09.2002 Nickolay Samofatov: default memory pool will become statement pool
// and will be freed by CMP_release
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
tdbb->tdbb_default = new_pool;
tdbb->setDefaultPool(new_pool);
try {
@ -571,12 +571,12 @@ jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, USHORT internal_flag)
CMP_verify_access(tdbb, request);
delete csb;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
catch (const std::exception& ex) {
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
if (request) {
CMP_release(tdbb, request);
}
@ -2016,9 +2016,9 @@ jrd_req* CMP_make_request(thread_db* tdbb, CompilerScratch* csb)
// count of hold the impure areas.
const SLONG n = (csb->csb_impure - REQ_SIZE + REQ_TAIL - 1) / REQ_TAIL;
request = FB_NEW_RPT(*tdbb->tdbb_default, n) jrd_req(tdbb->tdbb_default);
request = FB_NEW_RPT(*tdbb->getDefaultPool(), n) jrd_req(tdbb->getDefaultPool());
request->req_count = csb->csb_n_stream;
request->req_pool = tdbb->tdbb_default;
request->req_pool = tdbb->getDefaultPool();
request->req_impure_size = csb->csb_impure;
request->req_top_node = csb->csb_node;
request->req_access = csb->csb_access;
@ -2164,9 +2164,9 @@ void CMP_post_access(thread_db* tdbb,
}
AccessItem access(
stringDup(*(tdbb->tdbb_default), security_name),
stringDup(*(tdbb->getDefaultPool()), security_name),
view_id,
stringDup(*(tdbb->tdbb_default), name),
stringDup(*(tdbb->getDefaultPool()), name),
type_name,
mask
);
@ -2468,7 +2468,7 @@ static UCHAR* alloc_map(thread_db* tdbb, CompilerScratch* csb, USHORT stream)
SET_TDBB(tdbb);
str* string = FB_NEW_RPT(*tdbb->tdbb_default, MAP_LENGTH) str;
str* string = FB_NEW_RPT(*tdbb->getDefaultPool(), MAP_LENGTH) str;
string->str_length = MAP_LENGTH;
csb->csb_rpt[stream].csb_map = (UCHAR *) string->str_data;
fb_assert(stream <= MAX_STREAMS); // CVC: MAX_UCHAR maybe?
@ -5096,7 +5096,7 @@ static jrd_nod* pass2(thread_db* tdbb, CompilerScratch* csb, jrd_nod* const node
RecordSelExpr* top_rse = static_cast<RecordSelExpr*>(aux_rse_node);
if (!top_rse->rse_invariants)
top_rse->rse_invariants =
FB_NEW(*tdbb->tdbb_default) VarInvariantArray(*tdbb->tdbb_default);
FB_NEW(*tdbb->getDefaultPool()) VarInvariantArray(*tdbb->getDefaultPool());
top_rse->rse_invariants->add(node->nod_impure);
}
}
@ -5678,7 +5678,7 @@ static void process_map(thread_db* tdbb, CompilerScratch* csb, jrd_nod* map,
Format* format = *input_format;
if (!format) {
format = *input_format = Format::newFormat(*tdbb->tdbb_default, map->nod_count);
format = *input_format = Format::newFormat(*tdbb->getDefaultPool(), map->nod_count);
format->fmt_count = map->nod_count;
}

View File

@ -750,7 +750,7 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
UCHAR* dbuf = 0;
if (arg2->dsc_length+1 > BUFFER_LARGE)
{
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * (arg2->dsc_length+1)) str();
temp_str = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(UCHAR) * (arg2->dsc_length+1)) str();
dbuf = temp_str->str_data;
}
else
@ -870,7 +870,7 @@ USHORT CVT2_make_string2(const dsc* desc,
cs2, from_buf, from_len, err);
UCHAR* tempptr = (UCHAR *) temp;
if (needed_len > length) {
*ptr = FB_NEW_RPT(*tdbb->tdbb_default, needed_len) str();
*ptr = FB_NEW_RPT(*tdbb->getDefaultPool(), needed_len) str();
(*ptr)->str_length = needed_len;
tempptr = (*ptr)->str_data;
length = needed_len;

View File

@ -430,7 +430,7 @@ static TEXT_PTR thread_db[] = {
"THREAD DATA BLOCK",
FLD(thread_db*, "Status vec: %x", tdbb_status_vector),
FLD(thread_db*, "Default: %x", tdbb_default),
FLD(thread_db*, "Default: %x", getDefaultPool()),
0
};
static TEXT_PTR Service[] = { "SERVICE MANAGER BLOCK", 0};

View File

@ -474,7 +474,7 @@ void DFW_perform_work(jrd_tra* transaction)
return;
}
tdbb->tdbb_default = transaction->tra_pool;
tdbb->setDefaultPool(transaction->tra_pool);
/* Loop for as long as any of the deferred work routines says that it has
more to do. A deferred work routine should be able to deal with any
@ -1583,7 +1583,7 @@ static bool create_index( thread_db* tdbb,
}
if (IDX.RDB$INDEX_ID && IDX.RDB$STATISTICS < 0.0)
{
SelectivityList selectivity(*tdbb->tdbb_default);
SelectivityList selectivity(*tdbb->getDefaultPool());
const USHORT id = IDX.RDB$INDEX_ID - 1;
IDX_statistics(tdbb, relation, id, selectivity);
DFW_update_index(work->dfw_name, id, selectivity);
@ -1773,7 +1773,7 @@ static bool create_index( thread_db* tdbb,
}
fb_assert(work->dfw_id == dbb->dbb_max_idx);
SelectivityList selectivity(*tdbb->tdbb_default);
SelectivityList selectivity(*tdbb->getDefaultPool());
IDX_create_index(tdbb, relation, &idx, work->dfw_name,
&work->dfw_id, transaction, selectivity);
fb_assert(work->dfw_id == idx.idx_id);
@ -1885,7 +1885,7 @@ static bool create_relation(thread_db* tdbb,
/* Take a relation lock on rel id -1 before actually
generating a relation id. */
work->dfw_lock = lock = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(SLONG)) Lock;
work->dfw_lock = lock = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(SLONG)) Lock;
lock->lck_dbb = dbb;
lock->lck_length = sizeof(SLONG);
lock->lck_key.lck_long = -1;
@ -3244,22 +3244,22 @@ static void get_procedure_dependencies(DeferredWork* work)
if (procedure && !blob_id.isEmpty())
{
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
/* Nickolay Samofatov: allocate statement memory pool... */
tdbb->tdbb_default = JrdMemoryPool::createPool();
tdbb->setDefaultPool(JrdMemoryPool::createPool());
jrd_req* request;
MET_get_dependencies(tdbb, NULL, NULL, NULL, &blob_id, &request,
NULL, work->dfw_name, obj_procedure);
if (request)
CMP_release(tdbb, request);
else
JrdMemoryPool::deletePool(tdbb->tdbb_default);
JrdMemoryPool::deletePool(tdbb->getDefaultPool());
#ifdef DEV_BUILD
MET_verify_cache(tdbb);
#endif
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
}
@ -3302,18 +3302,18 @@ static void get_trigger_dependencies( DeferredWork* work)
if (relation && !blob_id.isEmpty())
{
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
/* Nickolay Samofatov: allocate statement memory pool... */
tdbb->tdbb_default = JrdMemoryPool::createPool();
tdbb->setDefaultPool(JrdMemoryPool::createPool());
jrd_req* request;
MET_get_dependencies(tdbb, relation, NULL, NULL, &blob_id,
&request, NULL, work->dfw_name, obj_trigger);
if (request)
CMP_release(tdbb, request);
else
JrdMemoryPool::deletePool(tdbb->tdbb_default);
JrdMemoryPool::deletePool(tdbb->getDefaultPool());
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
}
@ -3685,7 +3685,7 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work,
/* Make a temporary field block */
TemporaryField* tfb = FB_NEW(*tdbb->tdbb_default) TemporaryField;
TemporaryField* tfb = FB_NEW(*tdbb->getDefaultPool()) TemporaryField;
tfb->tfb_next = stack;
stack = tfb;
@ -3730,7 +3730,7 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work,
if (external_flag)
{
tfb = FB_NEW(*tdbb->tdbb_default) TemporaryField;
tfb = FB_NEW(*tdbb->getDefaultPool()) TemporaryField;
tfb->tfb_next = external;
external = tfb;
fb_assert(FLD.RDB$EXTERNAL_TYPE <= MAX_UCHAR);

View File

@ -126,9 +126,9 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
// Create a pool for DYN to operate in. It will be released when
// the routine exits.
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
JrdMemoryPool* tempPool = JrdMemoryPool::createPool();
tdbb->tdbb_default = tempPool;
tdbb->setDefaultPool(tempPool);
try {
@ -183,12 +183,12 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
#endif
#endif
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
JrdMemoryPool::deletePool(tempPool);
ERR_punt();
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
JrdMemoryPool::deletePool(tempPool);
}

View File

@ -413,7 +413,7 @@ void DYN_define_constraint(Global* gbl,
}
unique_count++;
field_list.add(stringDup(*tdbb->tdbb_default, IDS.RDB$FIELD_NAME));
field_list.add(stringDup(*tdbb->getDefaultPool(), IDS.RDB$FIELD_NAME));
END_FOR;
if (!DYN_REQUEST(drq_c_unq_nam)) {
DYN_REQUEST(drq_c_unq_nam) = request;
@ -1731,7 +1731,7 @@ void DYN_define_index(Global* gbl,
case isc_dyn_fld_name:
{
TEXT* str = DYN_dup_string(*tdbb->tdbb_default,
TEXT* str = DYN_dup_string(*tdbb->getDefaultPool(),
reinterpret_cast<const TEXT**>(ptr),
true, MAX_SQL_IDENTIFIER_SIZE);
seg_list.push(str);
@ -1841,7 +1841,7 @@ void DYN_define_index(Global* gbl,
break;
case isc_dyn_idx_ref_column:
field_list.add(DYN_dup_string(*tdbb->tdbb_default,
field_list.add(DYN_dup_string(*tdbb->getDefaultPool(),
reinterpret_cast<const TEXT**>(ptr),
true, MAX_SQL_IDENTIFIER_SIZE));
referred_cols++;

View File

@ -1468,7 +1468,7 @@ files = NULL;
ERASE FIL;
/****
file = FB_NEW_RPT(*tdbb->tdbb_default, sizeof (FIL.RDB$FILE_NAME) - 1) str();
file = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof (FIL.RDB$FILE_NAME) - 1) str();
strcpy (file->str_data, FIL.RDB$FILE_NAME);
LLS_PUSH (file, &files);
****/

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.99 2004-08-02 19:49:12 dimitr Exp $
* $Id: evl.cpp,v 1.100 2004-08-16 12:28:18 alexpeshkoff Exp $
*/
/*
@ -1922,7 +1922,7 @@ void EVL_make_value(thread_db* tdbb, const dsc* desc, impure_value* value)
}
if (!string) {
string = value->vlu_string = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
string = value->vlu_string = FB_NEW_RPT(*tdbb->getDefaultPool(), length) str();
string->str_length = length;
}
@ -1974,11 +1974,11 @@ bool EVL_mb_matches(thread_db* tdbb,
USHORT len1 = obj.to_wc(NULL, 0, p1, l1, &err_code, &err_pos);
USHORT len2 = obj.to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->getDefaultPool(), len1) str();
pp1 = (UCS2_CHAR *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->getDefaultPool(), len2) str();
pp2 = (UCS2_CHAR *) buf2->str_data;
}
@ -2033,7 +2033,7 @@ bool EVL_mb_sleuth_check(thread_db* tdbb,
USHORT len1 = obj.to_wc(NULL, 0, search, search_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->getDefaultPool(), len1) str();
pp1 = (UCS2_CHAR *) buf1->str_data;
}
@ -2087,11 +2087,11 @@ USHORT EVL_mb_sleuth_merge(thread_db* tdbb,
USHORT len1 = obj.to_wc(NULL, 0, match, match_bytes, &err_code, &err_pos);
USHORT len2 = obj.to_wc(NULL, 0, control, control_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->getDefaultPool(), len1) str();
pp1 = (UCS2_CHAR *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->getDefaultPool(), len2) str();
pp2 = (UCS2_CHAR *) buf2->str_data;
}
@ -3078,7 +3078,7 @@ static dsc* cast(thread_db* tdbb, const dsc* value, const jrd_nod* node, impure_
}
if (!string) {
string = impure->vlu_string = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
string = impure->vlu_string = FB_NEW_RPT(*tdbb->getDefaultPool(), length) str();
string->str_length = length;
}
@ -4897,7 +4897,7 @@ static dsc* substring(
else
{
const USHORT bufflen = MAX(BUFFER_LARGE, length);
str* temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * bufflen) str();
str* temp_str = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(UCHAR) * bufflen) str();
UCHAR *buffer = temp_str->str_data;
USHORT datalen = 0;

View File

@ -967,8 +967,8 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
if (request->req_flags & req_active) {
if (request->req_fors.getCount()) {
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = request->req_pool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(request->req_pool);
jrd_req* old_request = tdbb->tdbb_request;
tdbb->tdbb_request = request;
jrd_tra* old_transaction = tdbb->tdbb_transaction;
@ -981,7 +981,7 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
if (*ptr)
RSE_close(tdbb, *ptr);
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_request = old_request;
tdbb->tdbb_transaction = old_transaction;
}
@ -1130,7 +1130,7 @@ static jrd_nod* erase(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
if (!node->nod_arg[e_erase_statement])
break;
const Format* format = MET_current(tdbb, rpb->rpb_relation);
Record* record = VIO_record(tdbb, rpb, format, tdbb->tdbb_default);
Record* record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool());
rpb->rpb_address = record->rec_data;
rpb->rpb_length = format->fmt_length;
rpb->rpb_format_number = format->fmt_version;
@ -1169,7 +1169,7 @@ static jrd_nod* erase(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
rpb,
NULL,
transaction,
reinterpret_cast<blk*>(tdbb->tdbb_default),
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
false)))
{
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
@ -1436,15 +1436,15 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
const Format* format = (Format*) procedure->prc_output_msg->nod_arg[e_msg_format];
out_msg_length = format->fmt_length;
temp_buffer =
FB_NEW_RPT(*tdbb->tdbb_default, out_msg_length + DOUBLE_ALIGN - 1) str();
FB_NEW_RPT(*tdbb->getDefaultPool(), out_msg_length + DOUBLE_ALIGN - 1) str();
out_msg =
(SCHAR *) FB_ALIGN((U_IPTR) temp_buffer->str_data, DOUBLE_ALIGN);
}
/* Save the old pool */
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = proc_request->req_pool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(proc_request->req_pool);
/* Catch errors so we can unwind cleanly */
@ -1477,7 +1477,7 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
} // try
catch (const std::exception&) {
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_request = request;
EXE_unwind(tdbb, proc_request);
proc_request->req_attachment = NULL;
@ -1487,7 +1487,7 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
throw;
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
EXE_unwind(tdbb, proc_request);
tdbb->tdbb_request = request;
@ -1836,8 +1836,8 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
// Save the old pool and request to restore on exit
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = request->req_pool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(request->req_pool);
jrd_req* old_request = tdbb->tdbb_request;
tdbb->tdbb_request = request;
@ -1907,7 +1907,7 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
&& !variable->vlu_string)
{
variable->vlu_string =
FB_NEW_RPT(*tdbb->tdbb_default,
FB_NEW_RPT(*tdbb->getDefaultPool(),
variable->vlu_desc.dsc_length) str();
variable->vlu_string->str_length =
variable->vlu_desc.dsc_length;
@ -2331,7 +2331,7 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
On recursive calling we will loose the actual old
request for that invocation of looper. Avoid this. */
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_request = old_request;
fb_assert(request->req_caller == old_request);
request->req_caller = NULL;
@ -2362,7 +2362,7 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
terminating the processing. */
catch_disabled = false;
tdbb->tdbb_default = request->req_pool;
tdbb->setDefaultPool(request->req_pool);
tdbb->tdbb_request = request;
fb_assert(request->req_caller == NULL);
request->req_caller = old_request;
@ -2840,7 +2840,7 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
}
request->req_next = node;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_transaction = (tdbb->tdbb_request = old_request) ?
old_request->req_transaction : NULL;
fb_assert(request->req_caller == old_request);
@ -2933,7 +2933,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
org_rpb,
NULL,
transaction,
reinterpret_cast<blk*>(tdbb->tdbb_default),
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
false)))
{
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
@ -3113,7 +3113,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
original record to the new record. */
const Format* new_format = MET_current(tdbb, new_rpb->rpb_relation);
Record* new_record = VIO_record(tdbb, new_rpb, new_format, tdbb->tdbb_default);
Record* new_record = VIO_record(tdbb, new_rpb, new_format, tdbb->getDefaultPool());
new_rpb->rpb_address = new_record->rec_data;
new_rpb->rpb_length = new_format->fmt_length;
new_rpb->rpb_format_number = new_format->fmt_version;
@ -3122,7 +3122,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
Record* org_record = org_rpb->rpb_record;
if (!org_record) {
org_record =
VIO_record(tdbb, org_rpb, new_format, tdbb->tdbb_default);
VIO_record(tdbb, org_rpb, new_format, tdbb->getDefaultPool());
org_format = org_record->rec_format;
org_rpb->rpb_address = org_record->rec_data;
org_rpb->rpb_length = org_format->fmt_length;
@ -3981,7 +3981,7 @@ static jrd_nod* store(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
to "missing." */
const Format* format = MET_current(tdbb, relation);
record = VIO_record(tdbb, rpb, format, tdbb->tdbb_default);
record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool());
rpb->rpb_address = record->rec_data;
rpb->rpb_length = format->fmt_length;

View File

@ -401,7 +401,7 @@ if (opt->opt_count)
*/
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default,0) RecordSource;
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(),0) RecordSource;
rsb->rsb_type = rsb_ext_sequential;
const SSHORT size = sizeof(irsb);

View File

@ -30,7 +30,7 @@
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839.
*/
/*
$Id: fun.epp,v 1.62 2004-08-01 07:00:59 robocop Exp $
$Id: fun.epp,v 1.63 2004-08-16 12:28:19 alexpeshkoff Exp $
*/
#include "firebird.h"
@ -147,7 +147,7 @@ void FUN_evaluate(UserFunction* function, jrd_nod* node, impure_value* value)
// a number of data blocks with aligned length
temp_string =
FB_NEW_RPT(*tdbb->tdbb_default,
FB_NEW_RPT(*tdbb->getDefaultPool(),
function->fun_temp_length + DOUBLE_ALIGN - 1) str;
MOVE_CLEAR(temp_string->str_data, temp_string->str_length); // useless, as noted by NS
temp_ptr = (UCHAR *) FB_ALIGN((U_IPTR) temp_string->str_data, DOUBLE_ALIGN);
@ -192,7 +192,7 @@ void FUN_evaluate(UserFunction* function, jrd_nod* node, impure_value* value)
}
if (!string)
{
string = FB_NEW_RPT(*tdbb->tdbb_default, ret_length) str;
string = FB_NEW_RPT(*tdbb->getDefaultPool(), ret_length) str;
string->str_length = ret_length;
value->vlu_string = string;
}

View File

@ -303,7 +303,7 @@ void IDX_create_index(
break; /* must be garbage collected */
secondary.rpb_record = NULL;
VIO_data(tdbb, &secondary,
reinterpret_cast<BLK>(tdbb->tdbb_default));
reinterpret_cast<BLK>(tdbb->getDefaultPool()));
stack.push(secondary.rpb_record);
secondary.rpb_page = secondary.rpb_b_page;
secondary.rpb_line = secondary.rpb_b_line;
@ -909,7 +909,7 @@ static IDX_E check_duplicates(
{
if (rpb.rpb_number != insertion->iib_number
&& VIO_get_current(tdbb, &rpb, insertion->iib_transaction,
reinterpret_cast<BLK>(tdbb->tdbb_default),
reinterpret_cast<BLK>(tdbb->getDefaultPool()),
(record_idx->idx_flags & idx_foreign) != 0))
{
// dimitr: we shouldn't ignore status exceptions which take place

View File

@ -961,7 +961,7 @@ static void add_index_set(Database* dbb,
}
idx.idx_count = index->ini_idx_segment_count;
idx.idx_flags = index->ini_idx_flags;
SelectivityList selectivity(*tdbb->tdbb_default);
SelectivityList selectivity(*tdbb->getDefaultPool());
IDX_create_index(tdbb, relation, &idx, string, NULL, NULL,
selectivity);
X.RDB$INDEX_ID = idx.idx_id + 1;

View File

@ -370,7 +370,7 @@ public:
USHORT err_pos;
SSHORT out_len = obj.to_wc(NULL, 0, str, len, &err_code, &err_pos);
if (out_len > (int) sizeof(tempBuffer))
out_str = FB_NEW(*tdbb->tdbb_default) UCS2_CHAR[out_len/2];
out_str = FB_NEW(*tdbb->getDefaultPool()) UCS2_CHAR[out_len/2];
else
out_str = tempBuffer;
len = obj.to_wc(out_str, out_len, str, len, &err_code, &err_pos);
@ -396,7 +396,7 @@ public:
PrevConverter(tdbb, obj, str, len)
{
if (len > (int) sizeof(tempBuffer))
out_str = FB_NEW(*tdbb->tdbb_default) UCHAR[len];
out_str = FB_NEW(*tdbb->getDefaultPool()) UCHAR[len];
else
out_str = tempBuffer;
obj.str_to_upper(len, str, len, out_str);
@ -434,7 +434,7 @@ public:
static ContainsObject* create(thread_db* tdbb, TextType ttype, const UCHAR* str, SSHORT length) {
StrConverter cvt(tdbb, ttype, str, length);
fb_assert(length % sizeof(CharType) == 0);
return FB_NEW(*tdbb->tdbb_default) ContainsObjectImpl(*tdbb->tdbb_default,
return FB_NEW(*tdbb->getDefaultPool()) ContainsObjectImpl(*tdbb->getDefaultPool(),
reinterpret_cast<const CharType*>(str), length / sizeof(CharType));
}
@ -444,7 +444,7 @@ public:
StrConverter cvt1(tdbb, ttype, p, pl), cvt2(tdbb, ttype, s, sl);
fb_assert(pl % sizeof(CharType) == 0);
fb_assert(sl % sizeof(CharType) == 0);
Firebird::ContainsEvaluator<CharType> evaluator(*tdbb->tdbb_default,
Firebird::ContainsEvaluator<CharType> evaluator(*tdbb->getDefaultPool(),
reinterpret_cast<const CharType*>(p), pl / sizeof(CharType));
evaluator.processNextChunk(reinterpret_cast<const CharType*>(s), sl / sizeof(CharType));
return evaluator.getResult();
@ -484,7 +484,7 @@ public:
{
StrConverter cvt(tdbb, ttype, str, length);
fb_assert(length % sizeof(CharType) == 0);
return FB_NEW(*tdbb->tdbb_default) LikeObjectImpl(*tdbb->tdbb_default,
return FB_NEW(*tdbb->getDefaultPool()) LikeObjectImpl(*tdbb->getDefaultPool(),
reinterpret_cast<const CharType*>(str), length / sizeof(CharType), escape);
}
@ -494,7 +494,7 @@ public:
StrConverter cvt1(tdbb, ttype, p, pl), cvt2(tdbb, ttype, s, sl);
fb_assert(pl % sizeof(CharType) == 0);
fb_assert(sl % sizeof(CharType) == 0);
Firebird::LikeEvaluator<CharType> evaluator(*tdbb->tdbb_default,
Firebird::LikeEvaluator<CharType> evaluator(*tdbb->getDefaultPool(),
reinterpret_cast<const CharType*>(p), pl / sizeof(CharType),
escape, SQL_MATCH_ANY_CHARS, SQL_MATCH_1_CHAR);
evaluator.processNextChunk(reinterpret_cast<const CharType*>(s), sl / sizeof(CharType));
@ -938,7 +938,7 @@ USHORT INTL_convert_bytes(thread_db* tdbb,
** allocate a temporary buffer that is large enough.
*/
BYTE* tmp_buffer =
(BYTE *) FB_NEW(*tdbb->tdbb_default) char[(SLONG) src_len * sizeof(UCS2_CHAR)];
(BYTE *) FB_NEW(*tdbb->getDefaultPool()) char[(SLONG) src_len * sizeof(UCS2_CHAR)];
cs_obj = from_cs.getConvToUnicode();
fb_assert(cs_obj != NULL);

View File

@ -218,18 +218,18 @@ void Jrd::Trigger::compile(thread_db* tdbb)
SET_TDBB(tdbb);
compile_in_progress = true;
JrdMemoryPool* old_pool = tdbb->tdbb_default,
*new_pool = JrdMemoryPool::createPool();
JrdMemoryPool* old_pool = tdbb->getDefaultPool(),
*new_pool = JrdMemoryPool::createPool();
// Allocate statement memory pool
tdbb->tdbb_default = new_pool;
tdbb->setDefaultPool(new_pool);
// Trigger request is not compiled yet. Lets do it now
try {
PAR_blr(tdbb, relation, blr.begin(), NULL, NULL, &request, true,
(USHORT)(flags & TRG_ignore_perm ? csb_ignore_perm : 0));
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
catch (const std::exception&) {
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
compile_in_progress = false;
if (request) {
CMP_release(tdbb,request);
@ -240,7 +240,7 @@ void Jrd::Trigger::compile(thread_db* tdbb)
}
throw;
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
if (name.hasData())
{
@ -2209,7 +2209,7 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, Attachment** handle)
tdbb->tdbb_attachment = attachment;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(0);
/* Count active thread in database */
@ -2322,7 +2322,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
tdbb->tdbb_attachment = attachment;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = dbb->dbb_permanent;
tdbb->setDefaultPool(dbb->dbb_permanent);
/* Count active thread in database */
@ -2417,7 +2417,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
const jrd_file* file = dbb->dbb_file;
const Shadow* shadow = dbb->dbb_shadow;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(NULL);
#ifdef GOVERNOR
if (JRD_max_users) {
@ -3707,8 +3707,8 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
jrd_tra* transaction = find_transaction(tdbb, *tra_handle, isc_req_wrong_db);
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new_pool = JrdMemoryPool::createPool();
old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(new_pool = JrdMemoryPool::createPool());
CompilerScratch* csb = PAR_parse(tdbb, reinterpret_cast<const UCHAR*>(blr), FALSE);
request = CMP_make_request(tdbb, csb);
@ -3730,7 +3730,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
}
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
old_pool = NULL;
request->req_attachment = attachment;
@ -3800,7 +3800,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
try {
if (old_pool) {
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
if (request) {
CMP_release(tdbb, request);
@ -4499,7 +4499,7 @@ static ISC_STATUS check_database(thread_db* tdbb, Attachment* attachment, ISC_ST
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(0);
tdbb->tdbb_inhibit = 0;
tdbb->tdbb_flags = 0;
@ -6175,7 +6175,7 @@ ULONG JRD_shutdown_all()
tdbb->tdbb_attachment = attach;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(0);
++dbb->dbb_use_count;
@ -6379,7 +6379,7 @@ static bool verify_database_name(const Firebird::PathName& name, ISC_STATUS* sta
{
// Check for security.fdb
static TEXT SecurityNameBuffer[MAXPATHLEN] = "";
static Firebird::PathName ExpandedSecurityNameBuffer(*getDefaultMemoryPool()); // !!!!!!!!!
static Firebird::PathName ExpandedSecurityNameBuffer(*getDefaultMemoryPool());
if (! SecurityNameBuffer[0]) {
SecurityDatabase::getPath(SecurityNameBuffer);
ISC_expand_filename(SecurityNameBuffer, ExpandedSecurityNameBuffer);

View File

@ -906,12 +906,13 @@ const USHORT WIN_garbage_collect = 8; /* scan left a page for garbage collector
// Thread specific database block
class thread_db : public thdd
{
private:
JrdMemoryPool* tdbb_default;
public:
Database* tdbb_database;
Attachment* tdbb_attachment;
jrd_tra* tdbb_transaction;
jrd_req* tdbb_request;
JrdMemoryPool* tdbb_default;
ISC_STATUS* tdbb_status_vector;
void* tdbb_setjmp;
USHORT tdbb_inhibit; // Inhibit context switch if non-zero
@ -924,6 +925,16 @@ public:
#if defined(UNIX) && defined(SUPERSERVER)
sigjmp_buf tdbb_sigsetjmp;
#endif
void setDefaultPool(JrdMemoryPool* p)
{
thdd::setPool(p);
tdbb_default = p;
}
JrdMemoryPool* getDefaultPool()
{
return tdbb_default;
}
};
// tdbb_flags

View File

@ -37,7 +37,7 @@
* 2004.01.16 Vlad Horsun: added support for default parameters
*/
/*
$Id: met.epp,v 1.132 2004-07-17 00:13:34 skidder Exp $
$Id: met.epp,v 1.133 2004-08-16 12:28:19 alexpeshkoff Exp $
*/
// This MUST be at the top of the file
#ifdef DARWIN
@ -952,7 +952,7 @@ jrd_nod* MET_get_dependencies(thread_db* tdbb,
SET_TDBB(tdbb);
Database* dbb = tdbb->tdbb_database;
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->tdbb_default, 5);
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
csb->csb_g_flags |= csb_get_dependencies;
jrd_nod* node;
@ -2326,7 +2326,7 @@ jrd_nod* MET_parse_blob(thread_db* tdbb,
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
const SLONG length = blob->blb_length + 10;
str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
str* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), length) str();
BLB_get_data(tdbb, blob, temp->str_data, length);
jrd_nod* node = PAR_blr(tdbb, relation, temp->str_data, NULL, csb_ptr, request_ptr,
@ -2425,12 +2425,12 @@ void MET_parse_sys_trigger(thread_db* tdbb, jrd_rel* relation)
const USHORT par_flags = (USHORT)
((trig_flags & TRG_ignore_perm) ? csb_ignore_perm : 0);
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = JrdMemoryPool::createPool();
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(JrdMemoryPool::createPool());
PAR_blr(tdbb, relation, blr, NULL, NULL,
&request, true, par_flags);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
request->req_trg_name = name;
@ -2701,15 +2701,15 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
if ((PA.RDB$PARAMETER_TYPE == 0) && !F.RDB$DEFAULT_VALUE.NULL) {
procedure->prc_defaults++;
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = JrdMemoryPool::createPool();
old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(JrdMemoryPool::createPool());
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->tdbb_default, 5);
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
parameter->prm_default_val =
parse_param_blr(tdbb, procedure, &F.RDB$DEFAULT_VALUE, csb);
delete csb;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
END_FOR;
@ -2745,9 +2745,9 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
format->fmt_length = (USHORT) length;
}
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = JrdMemoryPool::createPool();
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->tdbb_default, 5);
old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(JrdMemoryPool::createPool());
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
// Now, check the result of this function here! Null pointer means failure.
// Or should parse_procedure_blr and its callee throw exceptions instead?
if (!parse_procedure_blr(tdbb, procedure, &P.RDB$PROCEDURE_BLR, csb))
@ -2768,7 +2768,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
}
}
delete csb;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
END_FOR;
@ -3247,8 +3247,8 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
for (USHORT itr = 0; itr < TRIGGER_MAX; ++itr) {
triggers[itr] = NULL;
}
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = dbb->dbb_permanent;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(dbb->dbb_permanent);
/* If anything errors, catch it to reset the scan flag. This will
make sure that the error will be caught if the operation is tried
@ -3507,7 +3507,7 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
#endif
relation->rel_current_format = NULL;
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
} // try
catch (const std::exception&) {
@ -3521,7 +3521,7 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
#ifdef SUPERSERVER
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
#endif
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
throw;
}
}
@ -3660,7 +3660,7 @@ static int blocking_ast_procedure(void* ast_object)
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(0);
if (procedure->prc_existence_lock) {
LCK_release(tdbb, procedure->prc_existence_lock);
@ -3703,7 +3703,7 @@ static int blocking_ast_relation(void* ast_object)
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_request = NULL;
tdbb->tdbb_transaction = NULL;
tdbb->tdbb_default = NULL;
tdbb->setDefaultPool(0);
if (relation->rel_use_count) {
relation->rel_flags |= REL_blocking;
@ -3832,7 +3832,7 @@ static void lookup_view_contexts( thread_db* tdbb, jrd_rel* view)
/* allocate a view context block and link it in
to the relation block's linked list */
ViewContext* view_context = FB_NEW(*tdbb->tdbb_default) ViewContext();
ViewContext* view_context = FB_NEW(*tdbb->getDefaultPool()) ViewContext();
*vcx_ptr = view_context;
vcx_ptr = &view_context->vcx_next;
@ -3841,7 +3841,7 @@ static void lookup_view_contexts( thread_db* tdbb, jrd_rel* view)
/* allocate a string block for the context name */
SSHORT length = name_length(V.RDB$CONTEXT_NAME);
str* alias = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
str* alias = FB_NEW_RPT(*tdbb->getDefaultPool(), length + 1) str();
V.RDB$CONTEXT_NAME[length] = 0;
strcpy((char*)alias->str_data, V.RDB$CONTEXT_NAME);
alias->str_length = length;
@ -3851,7 +3851,7 @@ static void lookup_view_contexts( thread_db* tdbb, jrd_rel* view)
/* allocate a string block for the relation name */
length = name_length(V.RDB$RELATION_NAME);
alias = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
alias = FB_NEW_RPT(*tdbb->getDefaultPool(), length + 1) str();
V.RDB$RELATION_NAME[length] = 0;
strcpy((char*)alias->str_data, V.RDB$RELATION_NAME);
alias->str_length = length;
@ -3948,7 +3948,7 @@ static jrd_nod* parse_procedure_blr(
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
const SLONG length = blob->blb_length + 10;
// CVC: Warning: the str class is limited by 64K
str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
str* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), length) str();
BLB_get_data(tdbb, blob, temp->str_data, length);
csb->csb_blr = temp->str_data;
// CVC: Why don't we check this function's return value!
@ -4001,7 +4001,7 @@ static bool par_messages(thread_db* tdbb,
const USHORT msg_number = BLR_BYTE;
USHORT count = BLR_BYTE;
count += (BLR_BYTE) << 8;
Format* format = Format::newFormat(*tdbb->tdbb_default, count);
Format* format = Format::newFormat(*tdbb->getDefaultPool(), count);
format->fmt_count = count;
// CVC: This offset should be protected against 32K overflow in the future
USHORT offset = 0;

View File

@ -341,7 +341,7 @@ RecordSource* OPT_compile(thread_db* tdbb,
index_desc* idx = NULL;
OptimizerBlk* opt = FB_NEW(*tdbb->tdbb_default) OptimizerBlk(tdbb->tdbb_default);
OptimizerBlk* opt = FB_NEW(*tdbb->getDefaultPool()) OptimizerBlk(tdbb->getDefaultPool());
opt->opt_streams.grow(csb->csb_n_stream);
RecordSource* rsb = 0;
@ -525,7 +525,7 @@ RecordSource* OPT_compile(thread_db* tdbb,
if (rsb) {
const SSHORT i = local_streams[0];
River* river = FB_NEW_RPT(*tdbb->tdbb_default, i) River();
River* river = FB_NEW_RPT(*tdbb->getDefaultPool(), i) River();
river->riv_count = (UCHAR) i;
river->riv_rsb = rsb;
MOVE_FAST(local_streams + 1, river->riv_streams, i);
@ -1106,7 +1106,7 @@ void OPT_set_index(thread_db* tdbb,
/* set up a dummy optimizer block just for the purposes
of the set index, to pass information to subroutines */
OptimizerBlk* opt = FB_NEW(*tdbb->tdbb_default) OptimizerBlk(tdbb->tdbb_default);
OptimizerBlk* opt = FB_NEW(*tdbb->getDefaultPool()) OptimizerBlk(tdbb->getDefaultPool());
opt->opt_g_flags |= opt_g_stream;
/* generate a new rsb for the retrieval, making sure to
@ -3332,7 +3332,7 @@ static void find_best(thread_db* tdbb,
// Save the various flag bits from the optimizer block to reset its
// state after each test.
Firebird::HalfStaticArray<UCHAR, OPT_STATIC_ITEMS>
stream_flags(*tdbb->tdbb_default), conjunct_flags(*tdbb->tdbb_default);
stream_flags(*tdbb->getDefaultPool()), conjunct_flags(*tdbb->getDefaultPool());
stream_flags.grow(csb->csb_n_stream);
conjunct_flags.grow(opt->opt_base_conjuncts);
int i;
@ -3823,7 +3823,7 @@ static bool form_river(thread_db* tdbb,
CompilerScratch* csb = opt->opt_csb;
// Allocate a river block and move the best order into it.
River* river = FB_NEW_RPT(*tdbb->tdbb_default, count) River();
River* river = FB_NEW_RPT(*tdbb->getDefaultPool(), count) River();
river_stack.push(river);
river->riv_count = (UCHAR) count;
@ -3835,7 +3835,7 @@ static bool form_river(thread_db* tdbb,
ptr = &river->riv_rsb;
}
else {
river->riv_rsb = rsb = FB_NEW_RPT(*tdbb->tdbb_default, count) RecordSource();
river->riv_rsb = rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), count) RecordSource();
rsb->rsb_type = rsb_cross;
rsb->rsb_count = count;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
@ -3939,7 +3939,7 @@ static RecordSource* gen_aggregate(thread_db* tdbb, OptimizerBlk* opt, jrd_nod*
// allocate and optimize the record source block
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_type = rsb_aggregate;
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_UCHAR);
@ -4040,7 +4040,7 @@ static RecordSource* gen_boolean(thread_db* tdbb, OptimizerBlk* opt,
SET_TDBB(tdbb);
CompilerScratch* csb = opt->opt_csb;
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_count = 1;
rsb->rsb_type = rsb_boolean;
rsb->rsb_next = prior_rsb;
@ -4076,7 +4076,7 @@ static RecordSource* gen_first(thread_db* tdbb, OptimizerBlk* opt,
SET_TDBB(tdbb);
CompilerScratch* csb = opt->opt_csb;
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_count = 1;
rsb->rsb_type = rsb_first;
rsb->rsb_next = prior_rsb;
@ -4137,7 +4137,7 @@ static void gen_join(thread_db* tdbb,
dbb->dbb_page_size / format->fmt_length;
}
River* river = FB_NEW_RPT(*tdbb->tdbb_default, 1) River();
River* river = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) River();
river->riv_count = 1;
fb_assert(csb->csb_rpt[streams[1]].csb_relation);
@ -4386,7 +4386,7 @@ static RecordSource* gen_nav_rsb(thread_db* tdbb,
SET_TDBB(tdbb);
USHORT key_length = ROUNDUP(BTR_key_length(relation, idx), sizeof(SLONG));
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_NAV_count) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), RSB_NAV_count) RecordSource();
rsb->rsb_type = rsb_navigate;
rsb->rsb_relation = relation;
rsb->rsb_stream = (UCHAR) stream;
@ -4515,7 +4515,7 @@ static RecordSource* gen_outer(thread_db* tdbb,
stream_i.stream_rsb = gen_residual_boolean(tdbb, opt, stream_i.stream_rsb);
// Allocate and fill in the rsb
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_LEFT_count) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), RSB_LEFT_count) RecordSource();
rsb->rsb_type = rsb_left_cross;
rsb->rsb_count = 2;
rsb->rsb_impure = CMP_impure(opt->opt_csb, sizeof(struct irsb));
@ -4524,11 +4524,11 @@ static RecordSource* gen_outer(thread_db* tdbb,
rsb->rsb_arg[RSB_LEFT_boolean] = (RecordSource*) boolean;
rsb->rsb_arg[RSB_LEFT_inner_boolean] = (RecordSource*) inner_boolean;
rsb->rsb_left_streams =
FB_NEW(*tdbb->tdbb_default) StreamStack(*tdbb->tdbb_default);
FB_NEW(*tdbb->getDefaultPool()) StreamStack(*tdbb->getDefaultPool());
rsb->rsb_left_inner_streams =
FB_NEW(*tdbb->tdbb_default) StreamStack(*tdbb->tdbb_default);
FB_NEW(*tdbb->getDefaultPool()) StreamStack(*tdbb->getDefaultPool());
rsb->rsb_left_rsbs =
FB_NEW(*tdbb->tdbb_default) RsbStack(*tdbb->tdbb_default);
FB_NEW(*tdbb->getDefaultPool()) RsbStack(*tdbb->getDefaultPool());
// find all the outer and inner substreams and push them on a stack.
find_rsbs(stream_i.stream_rsb,
rsb->rsb_left_streams,
@ -4561,7 +4561,7 @@ static RecordSource* gen_procedure(thread_db* tdbb, OptimizerBlk* opt, jrd_nod*
CompilerScratch* csb = opt->opt_csb;
jrd_prc* procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(IPTR)node->nod_arg[e_prc_procedure], false, false, 0);
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), RSB_PRC_count) RecordSource();
rsb->rsb_type = rsb_procedure;
rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
rsb->rsb_procedure = procedure;
@ -4723,10 +4723,10 @@ static RecordSource* gen_retrieval(thread_db* tdbb,
could be calculated via the index; currently we won't detect that case
*/
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_walk_vector(*tdbb->tdbb_default);
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_walk_vector(*tdbb->getDefaultPool());
idx_walk_vector.grow(csb_tail->csb_indices);
index_desc** idx_walk = idx_walk_vector.begin();
Firebird::HalfStaticArray<UINT64, OPT_STATIC_ITEMS> idx_priority_level_vector(*tdbb->tdbb_default);
Firebird::HalfStaticArray<UINT64, OPT_STATIC_ITEMS> idx_priority_level_vector(*tdbb->getDefaultPool());
idx_priority_level_vector.grow(csb_tail->csb_indices);
UINT64* idx_priority_level = idx_priority_level_vector.begin();
@ -4819,10 +4819,10 @@ static RecordSource* gen_retrieval(thread_db* tdbb,
// when necessary build the index
Firebird::HalfStaticArray<SSHORT, OPT_STATIC_ITEMS>
conjunct_position_vector(*tdbb->tdbb_default);
conjunct_position_vector(*tdbb->getDefaultPool());
Firebird::HalfStaticArray<OptimizerBlk::opt_conjunct*, OPT_STATIC_ITEMS>
matching_nodes_vector(*tdbb->tdbb_default);
matching_nodes_vector(*tdbb->getDefaultPool());
for (i = 0; i < idx_walk_count; i++)
{
@ -5042,14 +5042,14 @@ static RecordSource* gen_rsb(thread_db* tdbb,
else {
SSHORT size;
if (inversion) {
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) RecordSource();
rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_type = rsb_indexed;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RecordSource*) inversion;
}
else {
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 0) RecordSource();
rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) RecordSource();
rsb->rsb_type = rsb_sequential;
size = sizeof(struct irsb);
if (boolean)
@ -5107,7 +5107,7 @@ static RecordSource* gen_skip(thread_db* tdbb, OptimizerBlk* opt,
CompilerScratch* csb = opt->opt_csb;
// was : rsb = (RecordSource*) ALLOCDV (type_rsb, 1);
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, 0) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) RecordSource();
rsb->rsb_count = 1;
rsb->rsb_type = rsb_skip;
rsb->rsb_next = prior_rsb;
@ -5198,7 +5198,7 @@ static RecordSource* gen_sort(thread_db* tdbb,
const USHORT count = items +
(sizeof(sort_key_def) * 2 * sort->nod_count + sizeof(smb_repeat) -
1) / sizeof(smb_repeat);
SortMap* map = FB_NEW_RPT(*tdbb->tdbb_default, count) SortMap();
SortMap* map = FB_NEW_RPT(*tdbb->getDefaultPool(), count) SortMap();
map->smb_keys = sort->nod_count * 2;
map->smb_count = items;
if (project_flag) {
@ -5384,7 +5384,7 @@ static RecordSource* gen_sort(thread_db* tdbb,
/* That was most unpleasant. Never the less, it's done (except for
the debugging). All that remains is to build the record source
block for the sort. */
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_type = rsb_sort;
rsb->rsb_next = prior_rsb;
rsb->rsb_arg[0] = (RecordSource*) map;
@ -5425,7 +5425,7 @@ static bool gen_sort_merge(thread_db* tdbb, OptimizerBlk* opt, RiverStack& org_r
stack1.object()->riv_number = cnt++;
}
Firebird::HalfStaticArray<jrd_nod*, OPT_STATIC_ITEMS> scratch(*tdbb->tdbb_default);
Firebird::HalfStaticArray<jrd_nod*, OPT_STATIC_ITEMS> scratch(*tdbb->getDefaultPool());
scratch.grow(opt->opt_base_conjuncts * cnt);
jrd_nod** classes = scratch.begin();
@ -5484,7 +5484,7 @@ static bool gen_sort_merge(thread_db* tdbb, OptimizerBlk* opt, RiverStack& org_r
to indicate that nothing could be done. */
USHORT river_cnt = 0, stream_cnt = 0;
Firebird::HalfStaticArray<jrd_nod**, OPT_STATIC_ITEMS> selected_classes(*tdbb->tdbb_default, cnt);
Firebird::HalfStaticArray<jrd_nod**, OPT_STATIC_ITEMS> selected_classes(*tdbb->getDefaultPool(), cnt);
for (eq_class = classes; eq_class < last_class; eq_class += cnt) {
i = river_count(cnt, eq_class);
if (i > river_cnt) {
@ -5510,7 +5510,7 @@ static bool gen_sort_merge(thread_db* tdbb, OptimizerBlk* opt, RiverStack& org_r
return false;
// Build a sort stream.
RecordSource* merge_rsb = FB_NEW_RPT(*tdbb->tdbb_default, river_cnt * 2) RecordSource();
RecordSource* merge_rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), river_cnt * 2) RecordSource();
merge_rsb->rsb_count = river_cnt;
merge_rsb->rsb_type = rsb_merge;
merge_rsb->rsb_impure =
@ -5525,7 +5525,7 @@ static bool gen_sort_merge(thread_db* tdbb, OptimizerBlk* opt, RiverStack& org_r
continue;
}
stream_cnt += river1->riv_count;
jrd_nod* sort = FB_NEW_RPT(*tdbb->tdbb_default, selected_classes.getCount() * 3) jrd_nod();
jrd_nod* sort = FB_NEW_RPT(*tdbb->getDefaultPool(), selected_classes.getCount() * 3) jrd_nod();
sort->nod_type = nod_sort;
sort->nod_count = selected_classes.getCount();
jrd_nod*** selected_class;
@ -5545,7 +5545,7 @@ static bool gen_sort_merge(thread_db* tdbb, OptimizerBlk* opt, RiverStack& org_r
// Finally, merge selected rivers into a single river, and rebuild
// original river stack.
River* river1 = FB_NEW_RPT(*tdbb->tdbb_default, stream_cnt) River();
River* river1 = FB_NEW_RPT(*tdbb->getDefaultPool(), stream_cnt) River();
river1->riv_count = (UCHAR) stream_cnt;
river1->riv_rsb = merge_rsb;
UCHAR* stream = river1->riv_streams;
@ -5635,7 +5635,7 @@ static RecordSource* gen_union(thread_db* tdbb,
jrd_nod* clauses = union_node->nod_arg[e_uni_clauses];
const USHORT count = clauses->nod_count;
CompilerScratch* csb = opt->opt_csb;
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), count + nstreams + 1) RecordSource();
rsb->rsb_type = rsb_union;
rsb->rsb_count = count;
rsb->rsb_stream = (UCHAR)(IPTR) union_node->nod_arg[e_uni_stream];
@ -5748,7 +5748,7 @@ static IndexedRelationship* indexed_relationship(thread_db* tdbb, OptimizerBlk*
if (opt->opt_segments[0].opt_lower || opt->opt_segments[0].opt_upper) {
if (!relationship) {
relationship = FB_NEW(*tdbb->tdbb_default) IndexedRelationship();
relationship = FB_NEW(*tdbb->getDefaultPool()) IndexedRelationship();
}
if (idx->idx_flags & idx_unique) {
relationship->irl_unique = TRUE;
@ -5804,7 +5804,7 @@ static str* make_alias(thread_db* tdbb, CompilerScratch* csb,
/* allocate a string block to hold the concatenated alias */
str* alias = FB_NEW_RPT(*tdbb->tdbb_default, alias_length) str();
str* alias = FB_NEW_RPT(*tdbb->getDefaultPool(), alias_length) str();
alias->str_length = alias_length - 1;
/* now concatenate the individual aliases into the string block,
beginning at the end and copying back to the beginning */
@ -5883,7 +5883,7 @@ static RecordSource* make_cross(thread_db* tdbb, OptimizerBlk* opt, RiverStack&
}
CompilerScratch* csb = opt->opt_csb;
RecordSource* rsb = FB_NEW_RPT(*tdbb->tdbb_default, count) RecordSource();
RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), count) RecordSource();
rsb->rsb_type = rsb_cross;
rsb->rsb_count = count;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
@ -5927,7 +5927,7 @@ static jrd_nod* make_index_node(thread_db* tdbb, jrd_rel* relation,
node->nod_type = nod_index;
node->nod_count = 0;
IndexRetrieval* retrieval =
FB_NEW_RPT(*tdbb->tdbb_default, idx->idx_count * 2) IndexRetrieval();
FB_NEW_RPT(*tdbb->getDefaultPool(), idx->idx_count * 2) IndexRetrieval();
node->nod_arg[e_idx_retrieval] = (jrd_nod*) retrieval;
retrieval->irb_index = idx->idx_id;
MOVE_FAST(idx, &retrieval->irb_desc, sizeof(retrieval->irb_desc));
@ -6069,13 +6069,13 @@ static jrd_nod* make_inversion(thread_db* tdbb, OptimizerBlk* opt,
bool used_in_compound = false;
float compound_selectivity = 1; // Real maximum selectivity possible is 1.
// TMN: Shouldn't this be allocated from the tdbb->tdbb_default pool?
// TMN: Shouldn't this be allocated from the tdbb->getDefaultPool() pool?
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS>
idx_walk_vector(*tdbb->tdbb_default);
idx_walk_vector(*tdbb->getDefaultPool());
idx_walk_vector.grow(csb_tail->csb_indices);
index_desc** idx_walk = idx_walk_vector.begin();
Firebird::HalfStaticArray<UINT64, OPT_STATIC_ITEMS>
idx_priority_level_vector(*tdbb->tdbb_default);
idx_priority_level_vector(*tdbb->getDefaultPool());
idx_priority_level_vector.grow(csb_tail->csb_indices);
UINT64* idx_priority_level = idx_priority_level_vector.begin();
@ -7203,7 +7203,7 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
index_desc* selected_idx = NULL;
USHORT i, j;
Firebird::Array<index_desc> idx_sort(*JRD_get_thread_data()->tdbb_default, csb_tail->csb_indices);
Firebird::Array<index_desc> idx_sort(*JRD_get_thread_data()->getDefaultPool(), csb_tail->csb_indices);
bool same_selectivity = false;
// Walk through the indices and sort them into into idx_sort
@ -7272,7 +7272,7 @@ static SSHORT sort_indices_by_priority(CompilerScratch::csb_repeat* csb_tail,
* Sort indices based on the priority level.
*
***************************************************/
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_csb(*JRD_get_thread_data()->tdbb_default);
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_csb(*JRD_get_thread_data()->getDefaultPool());
idx_csb.grow(csb_tail->csb_indices);
memcpy(idx_csb.begin(), idx_walk, csb_tail->csb_indices * sizeof(index_desc*));

View File

@ -230,7 +230,7 @@ ExternalFile* EXT_file(jrd_rel* relation, TEXT* file_name, bid* description)
}
const ptrdiff_t l2 = (UCHAR *) index - index_buffer;
if (l2) {
str* string = FB_NEW_RPT(tdbb->tdbb_default, l2) str();
str* string = FB_NEW_RPT(tdbb->getDefaultPool(), l2) str();
MOVE_FAST(index_buffer, string->str_data, l2);
file->ext_indices = string->str_data;
}
@ -456,21 +456,21 @@ RecordSource* EXT_optimize(OptimizerBlk* opt, SSHORT stream, jrd_nod** sort_ptr)
RecordSource* rsb;
SSHORT size; // better size_t
if (dbkey) {
rsb = FB_NEW_RPT(tdbb->tdbb_default, 1) RecordSource();
rsb = FB_NEW_RPT(tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_type = rsb_ext_dbkey;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RecordSource*) dbkey;
}
else if (inversion) {
rsb = FB_NEW_RPT(tdbb->tdbb_default, 1) RecordSource();
rsb = FB_NEW_RPT(tdbb->getDefaultPool(), 1) RecordSource();
rsb->rsb_type = rsb_ext_indexed;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RecordSource*) inversion;
}
else {
rsb = FB_NEW(tdbb->tdbb_default) RecordSource();
rsb = FB_NEW(tdbb->getDefaultPool()) RecordSource();
rsb->rsb_type = rsb_ext_sequential;
size = sizeof(struct irsb);
}

View File

@ -157,7 +157,7 @@ jrd_nod* PAR_blr(thread_db* tdbb,
size_t count = 5;
if (view_csb)
count += view_csb->csb_rpt.getCapacity();
csb = CompilerScratch::newCsb(*tdbb->tdbb_default, count);
csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), count);
csb->csb_g_flags |= flags;
}
@ -376,7 +376,7 @@ jrd_nod* PAR_gen_field(thread_db* tdbb, USHORT stream, USHORT id)
**************************************/
SET_TDBB(tdbb);
jrd_nod* node = FB_NEW_RPT(*tdbb->tdbb_default, e_fld_length) jrd_nod();
jrd_nod* node = FB_NEW_RPT(*tdbb->getDefaultPool(), e_fld_length) jrd_nod();
node->nod_type = nod_field;
node->nod_arg[e_fld_id] = (jrd_nod*) (IPTR) id;
node->nod_arg[e_fld_stream] = (jrd_nod*) (IPTR) stream;
@ -499,7 +499,7 @@ jrd_nod* PAR_make_node(thread_db* tdbb, int size)
**************************************/
SET_TDBB(tdbb);
jrd_nod* node = FB_NEW_RPT(*tdbb->tdbb_default, size) jrd_nod();
jrd_nod* node = FB_NEW_RPT(*tdbb->getDefaultPool(), size) jrd_nod();
node->nod_count = size;
return node;
@ -520,7 +520,7 @@ CompilerScratch* PAR_parse(thread_db* tdbb, const UCHAR* blr, USHORT internal_fl
**************************************/
SET_TDBB(tdbb);
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->tdbb_default, 5);
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
csb->csb_running = csb->csb_blr = blr;
const SSHORT version = *csb->csb_running++;
if (internal_flag)
@ -733,7 +733,7 @@ static jrd_nod* par_cast(thread_db* tdbb, CompilerScratch* csb)
jrd_nod* node = PAR_make_node(tdbb, e_cast_length);
node->nod_count = count_table[blr_cast];
Format* format = Format::newFormat(*tdbb->tdbb_default, 1);
Format* format = Format::newFormat(*tdbb->getDefaultPool(), 1);
format->fmt_count = 1;
node->nod_arg[e_cast_fmt] = (jrd_nod*) format;
@ -776,7 +776,7 @@ static PsqlException* par_condition(thread_db* tdbb, CompilerScratch* csb)
return NULL;
}
PsqlException* exception_list = FB_NEW_RPT(*tdbb->tdbb_default, 1) PsqlException();
PsqlException* exception_list = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) PsqlException();
exception_list->xcp_count = 1;
switch (code_type) {
@ -841,7 +841,7 @@ static PsqlException* par_conditions(thread_db* tdbb, CompilerScratch* csb)
/* allocate a node to represent the conditions list */
const USHORT n = BLR_WORD;
PsqlException* exception_list = FB_NEW_RPT(*tdbb->tdbb_default, n) PsqlException();
PsqlException* exception_list = FB_NEW_RPT(*tdbb->getDefaultPool(), n) PsqlException();
exception_list->xcp_count = n;
for (int i = 0; i < n; i++) {
const USHORT code_type = BLR_BYTE;
@ -967,7 +967,7 @@ static void par_dependency(thread_db* tdbb,
node->nod_arg[e_dep_field] = field_node;
field_node->nod_type = nod_literal;
field_node->nod_arg[0] = (jrd_nod*)
stringDup(*tdbb->tdbb_default, field_name);
stringDup(*tdbb->getDefaultPool(), field_name);
}
else if (id >= 0) {
jrd_nod* field_node = PAR_make_node(tdbb, 1);
@ -1438,7 +1438,7 @@ static jrd_nod* par_message(thread_db* tdbb, CompilerScratch* csb)
out the format block */
n = BLR_WORD;
Format* format = Format::newFormat(*tdbb->tdbb_default, n);
Format* format = Format::newFormat(*tdbb->getDefaultPool(), n);
node->nod_arg[e_msg_format] = (jrd_nod*) format;
format->fmt_count = n;
ULONG offset = 0;
@ -1648,7 +1648,7 @@ static jrd_nod* par_plan(thread_db* tdbb, CompilerScratch* csb)
access_type->nod_arg[0] = (jrd_nod*) (IPTR) relation_id;
access_type->nod_arg[1] = (jrd_nod*) (IPTR) index_id;
access_type->nod_arg[2] = (jrd_nod*) ALL_cstring(tdbb->tdbb_default, name);
access_type->nod_arg[2] = (jrd_nod*) ALL_cstring(tdbb->getDefaultPool(), name);
if (BLR_PEEK == blr_indices)
// dimitr: FALL INTO, if the plan item is ORDER ... INDEX (...)
@ -1703,7 +1703,7 @@ static jrd_nod* par_plan(thread_db* tdbb, CompilerScratch* csb)
*arg++ = (jrd_nod*) (IPTR) relation_id;
*arg++ = (jrd_nod*) (IPTR) index_id;
*arg++ = (jrd_nod*) ALL_cstring(tdbb->tdbb_default, name);
*arg++ = (jrd_nod*) ALL_cstring(tdbb->getDefaultPool(), name);
}
break;
}
@ -1829,7 +1829,7 @@ static void par_procedure_parms(
/* dimitr: procedure (with its parameter formats) is allocated out of
its own pool (prc_request->req_pool) and can be freed during
the cache cleanup (MET_clear_cache). Since the current
tdbb_default pool is different from the procedure's one,
tdbb default pool is different from the procedure's one,
it's dangerous to copy a pointer from one request to another.
As an experiment, I've decided to copy format by value
instead of copying the reference. Since Format structure
@ -1843,7 +1843,7 @@ static void par_procedure_parms(
message->nod_arg[e_msg_format] = (jrd_nod*) format;
*/
Format* fmt_copy = Format::newFormat(*tdbb->tdbb_default, format->fmt_count);
Format* fmt_copy = Format::newFormat(*tdbb->getDefaultPool(), format->fmt_count);
*fmt_copy = *format;
message->nod_arg[e_msg_format] = (jrd_nod*) fmt_copy;
/* --- end of fix --- */
@ -1962,7 +1962,7 @@ static jrd_nod* par_relation(
if (alias_string)
{
node->nod_arg[e_rel_alias] =
(jrd_nod*) stringDup(*tdbb->tdbb_default, *alias_string);
(jrd_nod*) stringDup(*tdbb->getDefaultPool(), *alias_string);
}
/* Scan the relation if it hasn't already been scanned for meta data */
@ -2418,7 +2418,7 @@ static jrd_nod* parse(thread_db* tdbb, CompilerScratch* csb, USHORT expected,
*arg++ = (jrd_nod*) (IPTR) BLR_BYTE;
Firebird::string name;
par_name(csb, name);
*arg++ = (jrd_nod*) ALL_cstring(tdbb->tdbb_default, name);
*arg++ = (jrd_nod*) ALL_cstring(tdbb->getDefaultPool(), name);
break;
}
@ -2628,7 +2628,7 @@ static jrd_nod* parse(thread_db* tdbb, CompilerScratch* csb, USHORT expected,
node->nod_arg[e_dcl_id] = (jrd_nod*) (IPTR) n;
PAR_desc(csb, (DSC *) (node->nod_arg + e_dcl_desc));
vec* vector = csb->csb_variables =
vec::newVector(*tdbb->tdbb_default, csb->csb_variables, n + 1);
vec::newVector(*tdbb->getDefaultPool(), csb->csb_variables, n + 1);
(*vector)[n] = (BLK) node;
}
break;

View File

@ -104,7 +104,7 @@ int PCMET_expression_index(
relation->rel_length = strlen(relation->rel_name);
}
if (IDX.RDB$INDEX_ID && IDX.RDB$STATISTICS < 0.0) {
SelectivityList selectivity(tdbb->tdbb_default);
SelectivityList selectivity(tdbb->getDefaultPool());
const USHORT id = IDX.RDB$INDEX_ID - 1;
IDX_statistics(tdbb, relation, id, selectivity);
DFW_update_index(work->dfw_name, id, selectivity);
@ -138,8 +138,8 @@ int PCMET_expression_index(
/* allocate a new pool to contain the expression tree
for the expression index */
default_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new_pool = ALL_pool(&jrd_alloc_info);
default_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(new_pool = ALL_pool(&jrd_alloc_info));
MET_scan_relation(tdbb, relation);
if (!IDX.RDB$EXPRESSION_BLR.NULL)
@ -150,7 +150,7 @@ int PCMET_expression_index(
&csb,
IDX.RDB$INDEX_NAME,
obj_expression_index);
tdbb->tdbb_default = default_pool;
tdbb->setDefaultPool(default_pool);
/* fake a description of the index */
@ -177,7 +177,7 @@ int PCMET_expression_index(
/* Actually create the index */
SelectivityList selectivity(tdbb->tdbb_default);
SelectivityList selectivity(tdbb->getDefaultPool());
current_request = tdbb->tdbb_request;
tdbb->tdbb_request = idx.idx_expression_request;
@ -249,12 +249,12 @@ void PCMET_lookup_index( jrd_rel* relation, index_desc* idx)
tree and request in its own pool so that it may be cached
with the index block in the "permanent" metadata cache */
plb* const old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = ALL_pool(&jrd_alloc_info);
plb* const old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(ALL_pool(&jrd_alloc_info));
idx->idx_expression =
MET_parse_blob(tdbb, relation, &IDX.RDB$EXPRESSION_BLR, &csb,
&idx->idx_expression_request, false, false);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
END_FOR;

View File

@ -408,7 +408,7 @@ DSC *RNG_begin(jrd_nod* node, impure_value* impure)
/* allocate the range block and move the event name into it */
refresh_range = FB_NEW_RPT(*tdbb->tdbb_default, p - event_name + 1) RefreshRange();
refresh_range = FB_NEW_RPT(*tdbb->getDefaultPool(), p - event_name + 1) RefreshRange();
refresh_range->rng_event_length = p - event_name;
strcpy(refresh_range->rng_event, event_name);
@ -428,7 +428,7 @@ DSC *RNG_begin(jrd_nod* node, impure_value* impure)
refresh_range->rng_number = range_number;
refresh_ranges =
ALL_vector(tdbb->tdbb_default, &request->req_refresh_ranges,
ALL_vector(tdbb->getDefaultPool(), &request->req_refresh_ranges,
EXTEND(range_number));
refresh_ranges->vec_object[range_number] = (BLK) refresh_range;

View File

@ -20,7 +20,7 @@
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* $Id: rse.cpp,v 1.73 2004-06-25 22:12:19 skidder Exp $
* $Id: rse.cpp,v 1.74 2004-08-16 12:28:20 alexpeshkoff Exp $
*
* 2001.07.28: John Bellardo: Implemented rse_skip and made rse_first work with
* seekable streams.
@ -733,7 +733,7 @@ void RSE_open(thread_db* tdbb, RecordSource* rsb)
case rsb_union:
{
((IRSB) impure)->irsb_count = 0;
VIO_record(tdbb, rpb, rsb->rsb_format, tdbb->tdbb_default);
VIO_record(tdbb, rpb, rsb->rsb_format, tdbb->getDefaultPool());
/* Initialize the record number of each stream in the union */
@ -750,7 +750,7 @@ void RSE_open(thread_db* tdbb, RecordSource* rsb)
case rsb_aggregate:
((IRSB) impure)->irsb_count = 3;
VIO_record(tdbb, rpb, rsb->rsb_format, tdbb->tdbb_default);
VIO_record(tdbb, rpb, rsb->rsb_format, tdbb->getDefaultPool());
return;
case rsb_merge:
@ -779,7 +779,7 @@ void RSE_open(thread_db* tdbb, RecordSource* rsb)
{
VIO_record(tdbb,
&request->req_rpb[stack.object()->rsb_stream],
stack.object()->rsb_format, tdbb->tdbb_default);
stack.object()->rsb_format, tdbb->getDefaultPool());
}
return;
}
@ -1754,7 +1754,7 @@ static bool get_merge_join(
const ULONG key_length = map->smb_key_length * sizeof(ULONG);
UCHAR* first_data;
if (key_length > sizeof(key))
first_data = FB_NEW(*tdbb->tdbb_default) UCHAR[key_length];
first_data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[key_length];
else
first_data = (UCHAR *) key;
MOVE_FASTER(get_merge_data(tdbb, mfb, 0), first_data, key_length);
@ -1945,7 +1945,7 @@ static bool get_merge_join(thread_db* tdbb, RecordSource* rsb, IRSB_MRG impure)
const ULONG key_length = map->smb_key_length * sizeof(ULONG);
UCHAR* first_data;
if (key_length > sizeof(key))
first_data = FB_NEW(*tdbb->tdbb_default) UCHAR[key_length];
first_data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[key_length];
else
first_data = (UCHAR *) key;
MOVE_FASTER(get_merge_data(tdbb, mfb, 0), first_data, key_length);
@ -2104,7 +2104,7 @@ static bool get_procedure(thread_db* tdbb,
if (!impure->irsb_message)
{
const SLONG size = msg_format->fmt_length + ALIGNMENT;
impure->irsb_message = FB_NEW_RPT(*tdbb->tdbb_default, size) str();
impure->irsb_message = FB_NEW_RPT(*tdbb->getDefaultPool(), size) str();
impure->irsb_message->str_length = size;
}
UCHAR* om =
@ -2115,7 +2115,7 @@ static bool get_procedure(thread_db* tdbb,
Record* record;
if (!rpb->rpb_record) {
record = rpb->rpb_record =
FB_NEW_RPT(*tdbb->tdbb_default, rec_format->fmt_length) Record(*tdbb->tdbb_default);
FB_NEW_RPT(*tdbb->getDefaultPool(), rec_format->fmt_length) Record(*tdbb->getDefaultPool());
record->rec_format = rec_format;
record->rec_length = rec_format->fmt_length;
}
@ -2894,7 +2894,7 @@ static void join_to_nulls(thread_db* tdbb, RecordSource* rsb, StreamStack* strea
MET_format(tdbb, rpb->rpb_relation,
rpb->rpb_format_number);
}
record = VIO_record(tdbb, rpb, format, tdbb->tdbb_default);
record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool());
}
record->rec_fmt_bk = record->rec_format;
@ -3222,7 +3222,7 @@ static void open_sort(thread_db* tdbb, RecordSource* rsb, IRSB_SORT impure, UINT
record_param* rpb = &request->req_rpb[stream];
if (rpb->rpb_relation)
VIO_record(tdbb, rpb, MET_current(tdbb, rpb->rpb_relation),
tdbb->tdbb_default);
tdbb->getDefaultPool());
}
}
@ -3707,10 +3707,10 @@ static void save_record(thread_db* tdbb, record_param* rpb)
delete rec_copy;
}
else
rpb->rpb_copy = rpb_copy = FB_NEW(*tdbb->tdbb_default) SaveRecordParam();
rpb->rpb_copy = rpb_copy = FB_NEW(*tdbb->getDefaultPool()) SaveRecordParam();
MOVE_FAST(rpb, rpb_copy->srpb_rpb, sizeof(record_param));
Record* rec_copy = FB_NEW_RPT(*tdbb->tdbb_default, size) Record(*tdbb->tdbb_default);
Record* rec_copy = FB_NEW_RPT(*tdbb->getDefaultPool(), size) Record(*tdbb->getDefaultPool());
rpb_copy->srpb_rpb->rpb_record = rec_copy;
rec_copy->rec_length = size;

View File

@ -763,7 +763,7 @@ void SBM_set(thread_db* tdbb, SparseBitmap** bitmap, SLONG number)
SparseBitmap* vector = *bitmap;
if (!vector) {
*bitmap = vector = FB_NEW(*tdbb->tdbb_default) SparseBitmap(*tdbb->tdbb_default, 5);
*bitmap = vector = FB_NEW(*tdbb->getDefaultPool()) SparseBitmap(*tdbb->getDefaultPool(), 5);
vector->sbm_type = SBM_ROOT;
vector->sbm_count = 5;
vector->sbm_state = SBM_SINGULAR;
@ -804,12 +804,12 @@ void SBM_set(thread_db* tdbb, SparseBitmap** bitmap, SLONG number)
SparseBitmap* bucket = (SparseBitmap*) vector->sbm_segments[slot];
if (!bucket) {
if ( (bucket = tdbb->tdbb_default->plb_buckets) )
tdbb->tdbb_default->plb_buckets = bucket->sbm_next;
if ( (bucket = tdbb->getDefaultPool()->plb_buckets) )
tdbb->getDefaultPool()->plb_buckets = bucket->sbm_next;
else {
bucket = FB_NEW(*tdbb->tdbb_default)
SparseBitmap(*tdbb->tdbb_default, BUNCH_BUCKET);
bucket->sbm_pool = tdbb->tdbb_default;
bucket = FB_NEW(*tdbb->getDefaultPool())
SparseBitmap(*tdbb->getDefaultPool(), BUNCH_BUCKET);
bucket->sbm_pool = tdbb->getDefaultPool();
}
clear_bucket(bucket);
vector->sbm_segments[slot] = (BitmapSegment*) bucket;
@ -834,13 +834,13 @@ void SBM_set(thread_db* tdbb, SparseBitmap** bitmap, SLONG number)
BitmapSegment* segment = vector->sbm_segments[slot];
if (!segment) {
if ( (segment = tdbb->tdbb_default->plb_segments) ) {
tdbb->tdbb_default->plb_segments = segment->bms_next;
if ( (segment = tdbb->getDefaultPool()->plb_segments) ) {
tdbb->getDefaultPool()->plb_segments = segment->bms_next;
clear_segment(segment);
}
else {
segment = FB_NEW(*tdbb->tdbb_default) BitmapSegment();
segment->bms_pool = tdbb->tdbb_default;
segment = FB_NEW(*tdbb->getDefaultPool()) BitmapSegment();
segment->bms_pool = tdbb->getDefaultPool();
}
vector->sbm_segments[slot] = segment;
vector->sbm_used++;

View File

@ -180,7 +180,7 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number)
the spare page buffer for raw disk access. */
SCHAR* const spare_buffer =
FB_NEW(*tdbb->tdbb_default) char[dbb->dbb_page_size + MIN_PAGE_SIZE];
FB_NEW(*tdbb->getDefaultPool()) char[dbb->dbb_page_size + MIN_PAGE_SIZE];
// And why doesn't the code check that the allocation succeeds?
SCHAR* spare_page =
@ -945,7 +945,7 @@ void SDW_start(
shadow = NULL;
SLONG* const spare_buffer =
FB_NEW(*tdbb->tdbb_default) SLONG[(dbb->dbb_page_size + MIN_PAGE_SIZE) / sizeof(SLONG)];
FB_NEW(*tdbb->getDefaultPool()) SLONG[(dbb->dbb_page_size + MIN_PAGE_SIZE) / sizeof(SLONG)];
SLONG* spare_page = reinterpret_cast<SLONG*>((SCHAR *)
(((U_IPTR)
spare_buffer + MIN_PAGE_SIZE -

View File

@ -474,18 +474,18 @@ USHORT SQZ_length(thread_db* tdbb, const SCHAR* data, int length, DataComprContr
if (control == end_control)
{
dcc->dcc_end = control;
if ( (dcc->dcc_next = tdbb->tdbb_default->plb_dccs) )
if ( (dcc->dcc_next = tdbb->getDefaultPool()->plb_dccs) )
{
dcc = dcc->dcc_next;
tdbb->tdbb_default->plb_dccs = dcc->dcc_next;
tdbb->getDefaultPool()->plb_dccs = dcc->dcc_next;
dcc->dcc_next = NULL;
fb_assert(dcc->dcc_pool == tdbb->tdbb_default);
fb_assert(dcc->dcc_pool == tdbb->getDefaultPool());
}
else
{
dcc->dcc_next = FB_NEW(*tdbb->tdbb_default) DataComprControl();
dcc->dcc_next = FB_NEW(*tdbb->getDefaultPool()) DataComprControl();
dcc = dcc->dcc_next;
dcc->dcc_pool = tdbb->tdbb_default;
dcc->dcc_pool = tdbb->getDefaultPool();
}
control = dcc->dcc_string;
end_control = dcc->dcc_string + sizeof(dcc->dcc_string);
@ -512,18 +512,18 @@ USHORT SQZ_length(thread_db* tdbb, const SCHAR* data, int length, DataComprContr
if (control == end_control)
{
dcc->dcc_end = control;
if ( (dcc->dcc_next = tdbb->tdbb_default->plb_dccs) )
if ( (dcc->dcc_next = tdbb->getDefaultPool()->plb_dccs) )
{
dcc = dcc->dcc_next;
tdbb->tdbb_default->plb_dccs = dcc->dcc_next;
tdbb->getDefaultPool()->plb_dccs = dcc->dcc_next;
dcc->dcc_next = NULL;
fb_assert(dcc->dcc_pool == tdbb->tdbb_default);
fb_assert(dcc->dcc_pool == tdbb->getDefaultPool());
}
else
{
dcc->dcc_next = FB_NEW(*tdbb->tdbb_default) DataComprControl();
dcc->dcc_next = FB_NEW(*tdbb->getDefaultPool()) DataComprControl();
dcc = dcc->dcc_next;
dcc->dcc_pool = tdbb->tdbb_default;
dcc->dcc_pool = tdbb->getDefaultPool();
}
control = dcc->dcc_string;
end_control = dcc->dcc_string + sizeof(dcc->dcc_string);

View File

@ -26,7 +26,7 @@
*
*/
/*
$Id: thd.h,v 1.34 2004-07-14 21:54:41 skidder Exp $
$Id: thd.h,v 1.35 2004-08-16 12:28:20 alexpeshkoff Exp $
*/
#ifndef JRD_THD_H
@ -36,6 +36,7 @@ $Id: thd.h,v 1.34 2004-07-14 21:54:41 skidder Exp $
#include "../jrd/isc.h"
#include "../common/classes/locks.h"
#include "../common/classes/rwlock.h"
#include "../common/classes/alloc.h"
// compatibility definitions
enum WLCK_type {WLCK_read = 1, WLCK_write = 2};
@ -147,6 +148,45 @@ public:
static FB_THREAD_ID getId(void);
static void getSpecificData(void** t_data);
static void putSpecificData(void* t_data);
private:
MemoryPool* thdd_pool;
public:
void makeDefaultPool()
{
thdd* previous = getSpecific();
if (previous)
{
thdd_pool = &previous->getPool();
}
if (! thdd_pool)
{
thdd_pool = getDefaultMemoryPool();
}
}
void setPool(MemoryPool* p)
{
if (p)
{
thdd_pool = p;
}
else
{
makeDefaultPool();
}
}
MemoryPool& getPool()
{
return *thdd_pool;
}
static MemoryPool& getDefaultPool()
{
return getSpecific()->getPool();
}
};
/* Thread structure types */

View File

@ -361,7 +361,7 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
if (transaction->tra_flags & TRA_invalidated)
ERR_post(isc_trans_invalid, 0);
tdbb->tdbb_default = transaction->tra_pool;
tdbb->setDefaultPool(transaction->tra_pool);
/* Perform any meta data work deferred */
@ -758,8 +758,8 @@ void TRA_post_resources(thread_db* tdbb, jrd_tra* transaction, ResourceList& res
**************************************/
SET_TDBB(tdbb);
JrdMemoryPool* const old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = transaction->tra_pool;
JrdMemoryPool* const old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(transaction->tra_pool);
for (Resource* rsc = resources.begin(); rsc < resources.end(); rsc++)
{
@ -793,7 +793,7 @@ void TRA_post_resources(thread_db* tdbb, jrd_tra* transaction, ResourceList& res
}
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
@ -939,9 +939,9 @@ jrd_tra* TRA_reconnect(thread_db* tdbb, const UCHAR* id, USHORT length)
ERR_post(isc_read_only_database, 0);
tdbb->tdbb_default = JrdMemoryPool::createPool();
jrd_tra* trans = FB_NEW_RPT(*tdbb->tdbb_default, 0) jrd_tra(*tdbb->tdbb_default);
trans->tra_pool = tdbb->tdbb_default;
tdbb->setDefaultPool(JrdMemoryPool::createPool());
jrd_tra* trans = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
trans->tra_pool = tdbb->getDefaultPool();
trans->tra_number = gds__vax_integer(id, length);
trans->tra_flags |= TRA_prepared | TRA_reconnected | TRA_write;
@ -1095,7 +1095,7 @@ void TRA_rollback(thread_db* tdbb, jrd_tra* transaction, const bool retaining_fl
**************************************/
SET_TDBB(tdbb);
tdbb->tdbb_default = transaction->tra_pool;
tdbb->setDefaultPool(transaction->tra_pool);
/* Check in with external file system */
@ -1424,9 +1424,9 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
transaction block first, sieze relation locks, the go ahead and
make up the real transaction block. */
tdbb->tdbb_default = JrdMemoryPool::createPool();
jrd_tra* temp = FB_NEW_RPT(*tdbb->tdbb_default, 0) jrd_tra(*tdbb->tdbb_default);
temp->tra_pool = tdbb->tdbb_default;
tdbb->setDefaultPool(JrdMemoryPool::createPool());
jrd_tra* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
temp->tra_pool = tdbb->getDefaultPool();
transaction_options(tdbb, temp, reinterpret_cast<const UCHAR*>(tpb),
tpb_length);
@ -1475,9 +1475,9 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
jrd_tra* trans;
if (temp->tra_flags & TRA_read_committed)
trans = FB_NEW_RPT(*tdbb->tdbb_default, 0) jrd_tra(*tdbb->tdbb_default);
trans = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
else {
trans = FB_NEW_RPT(*tdbb->tdbb_default, (number - base + TRA_MASK) / 4) jrd_tra(*tdbb->tdbb_default);
trans = FB_NEW_RPT(*tdbb->getDefaultPool(), (number - base + TRA_MASK) / 4) jrd_tra(*tdbb->getDefaultPool());
}
trans->tra_pool = temp->tra_pool;
@ -1925,7 +1925,7 @@ Lock* TRA_transaction_lock(thread_db* tdbb, BLK object)
SET_TDBB(tdbb);
Database* dbb = tdbb->tdbb_database;
Lock* lock = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(SLONG)) Lock();
Lock* lock = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(SLONG)) Lock();
lock->lck_type = LCK_tra;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
lock->lck_length = sizeof(SLONG);

View File

@ -696,9 +696,9 @@ bool VAL_validate(thread_db* tdbb, USHORT switches)
try {
old_pool = tdbb->tdbb_default;
old_pool = tdbb->getDefaultPool();
val_pool = 0;
tdbb->tdbb_default = val_pool = JrdMemoryPool::createPool();
tdbb->setDefaultPool(val_pool = JrdMemoryPool::createPool());
control.vdr_page_bitmap = NULL;
control.vdr_flags = 0;
@ -736,13 +736,13 @@ bool VAL_validate(thread_db* tdbb, USHORT switches)
CCH_flush(tdbb, FLUSH_FINI, 0);
JrdMemoryPool::deletePool(val_pool);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_flags &= ~TDBB_sweeper;
} // try
catch (const std::exception& ex) {
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
JrdMemoryPool::deletePool(val_pool);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
tdbb->tdbb_flags &= ~TDBB_sweeper;
return false;
}

View File

@ -2028,7 +2028,7 @@ static void RefetchRecord(thread_db* tdbb, record_param* rpb, jrd_tra* transacti
if ((!DPM_get(tdbb, rpb, LCK_read)) ||
(!VIO_chase_record_version
(tdbb, rpb, NULL, transaction,
reinterpret_cast<blk*>(tdbb->tdbb_default),
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
false)))
{
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
@ -2316,7 +2316,7 @@ bool VIO_writelock(thread_db* tdbb, record_param* org_rpb, RecordSource* rsb,
Record* org_record = org_rpb->rpb_record;
if (!org_record) {
org_record =
VIO_record(tdbb, org_rpb, NULL, tdbb->tdbb_default);
VIO_record(tdbb, org_rpb, NULL, tdbb->getDefaultPool());
org_rpb->rpb_address = org_record->rec_data;
org_rpb->rpb_length = org_record->rec_format->fmt_length;
org_rpb->rpb_format_number = org_record->rec_format->fmt_version;
@ -2332,7 +2332,7 @@ bool VIO_writelock(thread_db* tdbb, record_param* org_rpb, RecordSource* rsb,
if ((!DPM_get(tdbb, org_rpb, LCK_read)) ||
(!VIO_chase_record_version
(tdbb, org_rpb, NULL, transaction,
reinterpret_cast<blk*>(tdbb->tdbb_default), true)))
reinterpret_cast<blk*>(tdbb->getDefaultPool()), true)))
{
return false;
}
@ -2865,8 +2865,8 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
return;
}
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = transaction->tra_pool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(transaction->tra_pool);
// If the current to-be-cleaned-up savepoint is very big, and the next
// level savepoint is the transaction level savepoint, then get rid of
@ -2934,7 +2934,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
}
if (rpb.rpb_flags & rpb_delta) {
VIO_data(tdbb, &rpb,
reinterpret_cast<blk*>(tdbb->tdbb_default));
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
@ -2968,7 +2968,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
}
if (rpb.rpb_flags & rpb_delta) {
VIO_data(tdbb, &rpb,
reinterpret_cast<blk*>(tdbb->tdbb_default));
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
@ -2988,7 +2988,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
BUGCHECK(186); /* msg 186 record disappeared */
}
VIO_data(tdbb, &rpb,
reinterpret_cast<blk*>(tdbb->tdbb_default));
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
}
update_in_place(tdbb, transaction, &rpb, &new_rpb);
if (!(transaction->tra_flags & TRA_system)) {
@ -3072,7 +3072,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
VIO_verb_cleanup(tdbb, transaction); // get rid of savepoint
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}
@ -3474,7 +3474,7 @@ static void garbage_collect(thread_db* tdbb,
if (!DPM_fetch(tdbb, rpb, LCK_write)) {
BUGCHECK(291); /* msg 291 cannot find record back version */
}
delete_record(tdbb, rpb, prior_page, tdbb->tdbb_default);
delete_record(tdbb, rpb, prior_page, tdbb->getDefaultPool());
if (rpb->rpb_record) {
going.push(rpb->rpb_record);
}
@ -3573,7 +3573,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
thread_db thd_context, *tdbb;
JRD_set_thread_data(tdbb, thd_context);
tdbb->tdbb_database = dbb;
tdbb->tdbb_default = dbb->dbb_permanent;
tdbb->setDefaultPool(dbb->dbb_permanent);
tdbb->tdbb_status_vector = status_vector;
tdbb->tdbb_quantum = SWEEP_QUANTUM;
tdbb->tdbb_flags = TDBB_sweeper;
@ -3922,7 +3922,7 @@ static void list_staying(thread_db* tdbb, record_param* rpb, RecordStack& stayin
}
else {
VIO_data(tdbb, &temp,
reinterpret_cast<blk*>(tdbb->tdbb_default));
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
staying.push(temp.rpb_record);
data = temp.rpb_record;
}
@ -3981,12 +3981,12 @@ static void notify_garbage_collector(thread_db* tdbb, record_param* rpb)
/* A relation's garbage collect bitmap is allocated
from the database permanent pool. */
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->tdbb_default = dbb->dbb_permanent;
tdbb->setDefaultPool(dbb->dbb_permanent);
const SLONG dp_sequence = rpb->rpb_number / dbb->dbb_max_records;
SBM_set(tdbb, &relation->rel_gc_bitmap, dp_sequence);
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
/* If the garbage collector isn't active then poke
the event on which it sleeps to awaken it. */
@ -4742,8 +4742,8 @@ static void verb_post(
#pragma FB_COMPILER_MESSAGE("Out-of-memory condition in this function corrupts database. And it is likely due to huge amounts of allocations")
SET_TDBB(tdbb);
JrdMemoryPool* old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = transaction->tra_pool;
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
tdbb->setDefaultPool(transaction->tra_pool);
/* Find action block for relation */
VerbAction* action;
@ -4756,7 +4756,7 @@ static void verb_post(
}
if (!action) {
action = FB_NEW(*tdbb->tdbb_default) VerbAction();
action = FB_NEW(*tdbb->getDefaultPool()) VerbAction();
action->vct_next = transaction->tra_save_point->sav_verb_actions;
transaction->tra_save_point->sav_verb_actions = action;
action->vct_relation = rpb->rpb_relation;
@ -4768,7 +4768,7 @@ static void verb_post(
/* An update-in-place is being posted to this savepoint, and this
savepoint hasn't seen this record before. */
Record* data = FB_NEW_RPT(*tdbb->tdbb_default, old_data->rec_length) Record(*tdbb->tdbb_default);
Record* data = FB_NEW_RPT(*tdbb->getDefaultPool(), old_data->rec_length) Record(*tdbb->getDefaultPool());
data->rec_number = rpb->rpb_number;
data->rec_length = old_data->rec_length;
data->rec_format = old_data->rec_format;
@ -4782,7 +4782,7 @@ static void verb_post(
*p++ = *q;
}
if (!action->vct_undo) {
action->vct_undo = new UndoItemTree(tdbb->tdbb_default);
action->vct_undo = new UndoItemTree(tdbb->getDefaultPool());
}
action->vct_undo->add(UndoItem(rpb->rpb_number, data));
}
@ -4790,7 +4790,7 @@ static void verb_post(
/* An insert/update followed by a delete is posted to this savepoint,
and this savepoint hasn't seen this record before. */
Record* data = FB_NEW_RPT(*tdbb->tdbb_default, 1) Record(*tdbb->tdbb_default);
Record* data = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) Record(*tdbb->getDefaultPool());
data->rec_number = rpb->rpb_number;
data->rec_length = 0;
if (new_ver) {
@ -4801,7 +4801,7 @@ static void verb_post(
}
if (!action->vct_undo) {
action->vct_undo = new UndoItemTree(tdbb->tdbb_default);
action->vct_undo = new UndoItemTree(tdbb->getDefaultPool());
}
action->vct_undo->add(UndoItem(rpb->rpb_number, data));
}
@ -4817,12 +4817,12 @@ static void verb_post(
and this savepoint has seen this record before but it doesn't have
undo data. */
Record* data = FB_NEW_RPT(*tdbb->tdbb_default, 1) Record(*tdbb->tdbb_default);
Record* data = FB_NEW_RPT(*tdbb->getDefaultPool(), 1) Record(*tdbb->getDefaultPool());
data->rec_number = rpb->rpb_number;
data->rec_length = 0;
data->rec_flags |= (REC_same_tx | REC_new_version);
if (!action->vct_undo) {
action->vct_undo = new UndoItemTree(tdbb->tdbb_default);
action->vct_undo = new UndoItemTree(tdbb->getDefaultPool());
}
action->vct_undo->add(UndoItem(rpb->rpb_number, data));
}
@ -4841,7 +4841,7 @@ static void verb_post(
garbage_collect_idx(tdbb, rpb, new_rpb, old_data);
}
tdbb->tdbb_default = old_pool;
tdbb->setDefaultPool(old_pool);
}