ENH: Version 5.5000 from sourceforge.

Source code taken from here:
http://sourceforge.net/projects/fis-gtm/files/GT.M-x86-Linux-src/V5.5-000/
This commit is contained in:
Luis Ibanez 2012-03-24 14:06:46 -04:00
parent 9299623e19
commit dee71008dd
758 changed files with 36022 additions and 20178 deletions

9
README
View File

@ -1,3 +1,12 @@
All software in this package is part of FIS GT.M (http://fis-gtm.com)
which is Copyright 2012 Fidelity Information Services, Inc., and
provided to you under the terms of a license. If there is a COPYING
file included in this package, it contains the terms of the license under
which the package is provided to you. If there is not a COPYING file in
the package, you must ensure that your use of FIS GT.M complies with the
license under which it is provided. If you are unsure as to the terms of
your license, please consult with the entity that provided you with the package.
The make file enclosed (sr_unix/comlist.mk) will build GT.M from source.
The prerequisites are GNU make, GT.M binary installation (which you can
download from http://sourceforge.net/projects/fis-gtm/), Linux x86, tcsh,

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -24,6 +24,9 @@
#define XFER_LONG_SZ 6
#define INST_SZ 1
error_def(ERR_LABELUNKNOWN);
error_def(ERR_ROUTINEUNKNOWN);
rhdtyp *auto_zlink (unsigned char *pc, int4 **line)
{
char *adj_pc; /* address of PEA rtnref offset */
@ -32,61 +35,52 @@ rhdtyp *auto_zlink (unsigned char *pc, int4 **line)
urx_rtnref *rtnurx;
mval rtn;
rhdtyp *rhead;
error_def (ERR_ROUTINEUNKNOWN);
error_def (ERR_LABELUNKNOWN);
union
{
ModR_M modrm;
unsigned char byte;
} modrm_byte_byte, modrm_byte_long;
/* ASSUMPTION -- The instruction previous to the current mpc is a transfer table jump.
* This is either a byte or a int4 displacement off of ebx, instruction
* size either 3 or 6 (prefix byte, ModR/M byte, 8- or 32-bit offset).
*/
/* ASSUMPTION -- The instruction previous to the current mpc is a transfer table jump.
* This is either a byte or a int4 displacement off of ebx, instruction
* size either 3 or 6 (prefix byte, ModR/M byte, 8- or 32-bit offset).
*/
modrm_byte_byte.modrm.reg_opcode = I386_INS_CALL_Ev;
modrm_byte_byte.modrm.mod = I386_MOD32_BASE_DISP_8;
modrm_byte_byte.modrm.r_m = I386_REG_EBX;
modrm_byte_long.modrm.reg_opcode = I386_INS_CALL_Ev;
modrm_byte_long.modrm.mod = I386_MOD32_BASE_DISP_32;
modrm_byte_long.modrm.r_m = I386_REG_EBX;
if (*(pc - XFER_BYTE_SZ) == I386_INS_Grp5_Prefix && *(pc - XFER_BYTE_SZ + 1) == modrm_byte_byte.byte)
if ((*(pc - XFER_BYTE_SZ) == I386_INS_Grp5_Prefix) && (*(pc - XFER_BYTE_SZ + 1) == modrm_byte_byte.byte))
{
assert (*(pc - XFER_BYTE_SZ - PEA_SZ) == I386_INS_PUSH_Iv);
assert(*(pc - XFER_BYTE_SZ - PEA_SZ) == I386_INS_PUSH_Iv);
adj_pc = (char *)pc - XFER_BYTE_SZ - PEA_SZ;
}
else if (*(pc - XFER_LONG_SZ) == I386_INS_Grp5_Prefix && *(pc - XFER_LONG_SZ + 1) == modrm_byte_long.byte)
} else if ((*(pc - XFER_LONG_SZ) == I386_INS_Grp5_Prefix) && (*(pc - XFER_LONG_SZ + 1) == modrm_byte_long.byte))
{
assert (*(pc - XFER_LONG_SZ - PEA_SZ) == I386_INS_PUSH_Iv);
assert(*(pc - XFER_LONG_SZ - PEA_SZ) == I386_INS_PUSH_Iv);
adj_pc = (char *)pc - XFER_LONG_SZ - PEA_SZ;
}
else
} else
GTMASSERT;
if (azl_geturxrtn (adj_pc + INST_SZ, &rname, &rtnurx))
if (azl_geturxrtn(adj_pc + INST_SZ, &rname, &rtnurx))
{
assert (0 <= rname.len && rname.len <= MAX_MIDENT_LEN);
assert (rname.addr);
/* Copy rname into local storage because azl_geturxrtn sets
rname.addr to an address that is freed during op_zlink
and before the call to find_rtn_hdr.
*/
assert((0 <= rname.len) && (MAX_MIDENT_LEN >= rname.len));
assert(rname.addr);
/* Copy rname into local storage because azl_geturxrtn sets rname.addr to an address that is
* freed during op_zlink and before the call to find_rtn_hdr.
*/
memcpy(rname_local.c, rname.addr, rname.len);
rname.addr = rname_local.c;
assert (rtnurx);
assert (*(adj_pc - PEA_SZ) == I386_INS_PUSH_Iv);
assert (azl_geturxlab (adj_pc - PEA_SZ + INST_SZ, rtnurx));
assert (!find_rtn_hdr (&rname));
assert(rtnurx);
assert(*(adj_pc - PEA_SZ) == I386_INS_PUSH_Iv);
assert(azl_geturxlab(adj_pc - PEA_SZ + INST_SZ, rtnurx));
assert(!find_rtn_hdr(&rname));
rtn.mvtype = MV_STR;
rtn.str.len = rname.len;
rtn.str.addr = rname.addr;
op_zlink (&rtn, 0);
if (0 != (rhead = find_rtn_hdr (&rname)))
if (0 != (rhead = find_rtn_hdr(&rname))) /* note the assignment */
{
*line = *(int4 **) (adj_pc - PEA_SZ + INST_SZ);
*line = *(int4 **)(adj_pc - PEA_SZ + INST_SZ);
if (!(*line))
rts_error(VARLSTCNT(1) ERR_LABELUNKNOWN);
return rhead;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -26,66 +26,58 @@ zb_code *find_line_call(void *addr)
call_addr = (unsigned char *)addr;
modrm_byte.byte = *(call_addr + 1);
if (*call_addr == I386_INS_Grp5_Prefix && modrm_byte.modrm.reg_opcode == I386_INS_CALL_Ev)
if ((I386_INS_Grp5_Prefix == *call_addr) && (I386_INS_CALL_Ev == modrm_byte.modrm.reg_opcode))
{
call_addr++;
assert (modrm_byte.modrm.r_m == I386_REG_EBX);
assert(I386_REG_EBX == modrm_byte.modrm.r_m);
call_addr++;
if (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8)
if (I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod)
{
if (*call_addr == xf_linestart * SIZEOF(int4) ||
*call_addr == xf_zbstart * SIZEOF(int4))
if ((xf_linestart * SIZEOF(int4) == *call_addr) ||
(xf_zbstart * SIZEOF(int4) == *call_addr))
return (zb_code *)call_addr;
call_addr++;
}
else
} else
{
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32);
if (*((int4 *)call_addr) != xf_isformal * SIZEOF(int4))
return (zb_code *)addr;
call_addr += SIZEOF(int4);
assert (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod);
return (zb_code *)addr;
}
}
modrm_byte.byte = *(call_addr + 1);
if (*call_addr == I386_INS_PUSH_Ib || *call_addr == I386_INS_PUSH_Iv)
if ((I386_INS_PUSH_Ib == *call_addr) || (I386_INS_PUSH_Iv == *call_addr))
{
while (*call_addr == I386_INS_PUSH_Ib || *call_addr == I386_INS_PUSH_Iv)
while ((I386_INS_PUSH_Ib == *call_addr) || (I386_INS_PUSH_Iv == *call_addr))
{
if (*call_addr == I386_INS_PUSH_Ib)
if (I386_INS_PUSH_Ib == *call_addr)
call_addr += 1 + SIZEOF(unsigned char);
else
{
assert (*call_addr == I386_INS_PUSH_Iv);
assert(I386_INS_PUSH_Iv == *call_addr);
call_addr += 1 + SIZEOF(int4);
}
}
modrm_byte.byte = *(call_addr + 1);
if (*call_addr++ != I386_INS_Grp5_Prefix || modrm_byte.modrm.reg_opcode != I386_INS_CALL_Ev)
if ((I386_INS_Grp5_Prefix != *call_addr++) || (I386_INS_CALL_Ev != modrm_byte.modrm.reg_opcode))
return (zb_code *)addr;
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8 || modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32);
assert (modrm_byte.modrm.r_m == I386_REG_EBX);
assert((I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod) || (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod));
assert(I386_REG_EBX == modrm_byte.modrm.r_m);
call_addr++;
if (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8)
if (I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod)
{
if (*call_addr != xf_linefetch * SIZEOF(int4) &&
*call_addr != xf_zbfetch * SIZEOF(int4))
if ((xf_linefetch * SIZEOF(int4) != *call_addr) && (xf_zbfetch * SIZEOF(int4) != *call_addr))
return (zb_code *)addr;
}
}
else if (*call_addr == I386_INS_Grp5_Prefix && modrm_byte.modrm.reg_opcode == I386_INS_CALL_Ev)
else if ((I386_INS_Grp5_Prefix == *call_addr) && (I386_INS_CALL_Ev != modrm_byte.modrm.reg_opcode))
{
call_addr++;
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8 || modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32);
assert (modrm_byte.modrm.r_m == I386_REG_EBX);
assert((I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod) || (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod));
assert(I386_REG_EBX == modrm_byte.modrm.r_m);
call_addr++;
if (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8)
if (I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod)
{
if (*call_addr != xf_linestart * SIZEOF(int4) &&
*call_addr != xf_zbstart * SIZEOF(int4))
if ((xf_linestart * SIZEOF(int4) != *call_addr) && (xf_zbstart * SIZEOF(int4) != *call_addr))
return (zb_code *)addr;
}
}

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2011 Fidelity Information Services, Inc #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -28,7 +28,7 @@ msf_typ_off = 32
msf_flags_off = 34
msf_for_ctrl_stack = 36
msf_frame_size = 40
msf_frame_size = 44
SFT_COUNT = 0x01
SFT_DM = 0x02
@ -36,7 +36,6 @@ SFT_REP_OP = 0x04
SFT_ZBRK_ACT = 0x08
SFT_DEV_ACT = 0x10
SFT_ZTRAP = 0x20
SFT_EXTFUN = 0x40
SFT_ZSTEP_ACT = 0x80
SFT_ZINTR = 0x100

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -27,17 +27,19 @@
#include "cmd_qlf.h" /* needed for CQ_UTF8 */
#include "gtm_text_alloc.h"
/* INCR_LINK - read and process a mumps object module. Link said module to
currently executing image */
/* INCR_LINK - read and process a mumps object module. Link said module to currently executing image */
LITREF char gtm_release_name[];
LITREF int4 gtm_release_name_len;
static char *code;
GBLREF mident_fixed zlink_mname;
GBLREF unsigned char *zl_lab_err;
GBLREF boolean_t gtm_utf8_mode;
error_def(ERR_INVOBJ);
error_def(ERR_LOADRUNNING);
error_def(ERR_TEXT);
#define RELREAD 50 /* number of relocation entries to buffer */
typedef struct res_list_struct
{
@ -53,7 +55,7 @@ bool incr_link(int file_desc)
{
rhdtyp *hdr, *old_rhead;
int code_size, save_errno, cnt;
int4 rhd_diff,lab_miss_off,*olnt_ent,*olnt_top, read_size;
int4 rhd_diff, read_size;
char *literal_ptr;
var_tabent *curvar;
char module_name[SIZEOF(mident_fixed)];
@ -62,16 +64,11 @@ bool incr_link(int file_desc)
int order;
struct exec file_hdr;
error_def(ERR_INVOBJ);
error_def(ERR_LOADRUNNING);
error_def(ERR_TEXT);
urx_lcl_anchor.len = 0;
urx_lcl_anchor.addr = 0;
urx_lcl_anchor.lab = 0;
urx_lcl_anchor.next = 0;
code = NULL;
DOREADRL(file_desc, &file_hdr, SIZEOF(file_hdr), read_size);
if (read_size != SIZEOF(file_hdr))
{
@ -80,16 +77,13 @@ bool incr_link(int file_desc)
save_errno = errno;
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)),
STRERROR(save_errno));
}
else
} else
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("reading file header"));
}
else if (OMAGIC != file_hdr.a_magic)
} else if (OMAGIC != file_hdr.a_magic)
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("bad magic"));
else if (OBJ_LABEL != file_hdr.a_stamp)
return FALSE; /* wrong version */
assert (file_hdr.a_bss == 0);
assert(0 == file_hdr.a_bss);
code_size = file_hdr.a_text + file_hdr.a_data;
code = GTM_TEXT_ALLOC(code_size);
DOREADRL(file_desc, code, code_size, read_size);
@ -98,10 +92,8 @@ bool incr_link(int file_desc)
if (-1 == read_size)
{
save_errno = errno;
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)),
STRERROR(save_errno));
}
else
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)), STRERROR(save_errno)); /* BYPASSOK */
} else
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("reading code"));
}
hdr = (rhdtyp *)code;
@ -120,38 +112,30 @@ bool incr_link(int file_desc)
curvar->var_name.addr += (uint4)literal_ptr;
}
for (cnt = hdr->labtab_len, curlab = LABTAB_ADR(hdr); cnt; --cnt, ++curlab)
{ /* relocate the label table */
/* relocate the label table */
curlab->lab_name.addr += (uint4)literal_ptr;
}
if (!addr_fix(file_desc, &file_hdr, &urx_lcl_anchor, hdr))
{
urx_free(&urx_lcl_anchor);
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("address fixup failure"));
}
if (!zlput_rname (hdr))
if (!zlput_rname(hdr))
{
urx_free(&urx_lcl_anchor);
/* Copy routine name to local variable because zl_error free's it. */
memcpy(&module_name[0], hdr->routine_name.addr, hdr->routine_name.len);
zl_error(file_desc, 0, ERR_LOADRUNNING, hdr->routine_name.len, &module_name[0]);
}
urx_add (&urx_lcl_anchor);
old_rhead = (rhdtyp *) hdr->old_rhead_ptr;
lbt_bot = (lab_tabent *) ((char *)hdr + hdr->labtab_ptr);
urx_add(&urx_lcl_anchor);
old_rhead = (rhdtyp *)hdr->old_rhead_ptr;
lbt_bot = (lab_tabent *)((char *)hdr + hdr->labtab_ptr);
lbt_top = lbt_bot + hdr->labtab_len;
while (old_rhead)
{
rhd_diff = (char *) hdr - (char *) old_rhead;
lab_miss_off = (char *)(&zl_lab_err) - rhd_diff - (char *) old_rhead;
lbt_ent = lbt_bot;
olnt_ent = (int4 *)((char *) old_rhead + old_rhead->lnrtab_ptr);
olnt_top = olnt_ent + old_rhead->lnrtab_len;
for ( ; olnt_ent < olnt_top ;olnt_ent++)
*olnt_ent = lab_miss_off;
olbt_bot = (lab_tabent *) ((char *) old_rhead + old_rhead->labtab_ptr);
olbt_bot = (lab_tabent *)((char *)old_rhead + old_rhead->labtab_ptr);
olbt_top = olbt_bot + old_rhead->labtab_len;
for (olbt_ent = olbt_bot; olbt_ent < olbt_top ;olbt_ent++)
for (olbt_ent = olbt_bot; olbt_ent < olbt_top; olbt_ent++)
{
for (; lbt_ent < lbt_top; lbt_ent++)
{
@ -161,11 +145,12 @@ bool incr_link(int file_desc)
}
if ((lbt_ent < lbt_top) && !order)
{
olnt_ent = (int4 *)((char *) old_rhead + olbt_ent->lab_ln_ptr);
assert(*olnt_ent == lab_miss_off);
*olnt_ent = *((int4 *) (code + lbt_ent->lab_ln_ptr));
}
olbt_ent->lab_ln_ptr = lbt_ent->lab_ln_ptr;
olbt_ent->has_parms = lbt_ent->has_parms;
} else
olbt_ent->lab_ln_ptr = 0;
}
rhd_diff = (char *)hdr - (char *)old_rhead;
old_rhead->src_full_name = hdr->src_full_name;
old_rhead->routine_name = hdr->routine_name;
old_rhead->vartab_len = hdr->vartab_len;
@ -176,7 +161,7 @@ bool incr_link(int file_desc)
old_rhead->temp_size = hdr->temp_size;
old_rhead = (rhdtyp *) old_rhead->old_rhead_ptr;
}
urx_resolve (hdr, lbt_bot, lbt_top);
urx_resolve(hdr, lbt_bot, lbt_top);
return TRUE;
}
@ -199,7 +184,6 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
numrel = (fhead->a_trsize + fhead->a_drsize) / SIZEOF(struct relocation_info);
if (numrel * SIZEOF(struct relocation_info) != fhead->a_trsize + fhead->a_drsize)
return FALSE;
for ( ; numrel;)
{
rel_read = numrel < RELREAD ? numrel : RELREAD;
@ -211,8 +195,10 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
}
numrel -= rel_read;
for (i = 0; i < rel_read; i++)
{ if (rel[i].r_extern)
{ new_res = (res_list *) malloc(SIZEOF(*new_res));
{
if (rel[i].r_extern)
{
new_res = (res_list *)malloc(SIZEOF(*new_res));
new_res->symnum = rel[i].r_symbolnum;
new_res->addr = rel[i].r_address;
new_res->next = new_res->list = 0;
@ -223,33 +209,33 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
{ res_temp = res_root;
res_temp1 = 0;
while (res_temp)
{ if (res_temp->symnum >= new_res->symnum)
{
if (res_temp->symnum >= new_res->symnum)
break;
res_temp1 = res_temp;
res_temp = res_temp->next;
}
if (res_temp)
{ if (res_temp->symnum == new_res->symnum)
{ new_res->list = res_temp->list;
{
new_res->list = res_temp->list;
res_temp->list = new_res;
}
else
} else
{ if (res_temp1)
{ new_res->next = res_temp1->next;
{
new_res->next = res_temp1->next;
res_temp1->next = new_res;
}
else
{ assert(res_temp == res_root);
} else
{
assert(res_temp == res_root);
new_res->next = res_root;
res_root = new_res;
}
}
}
else
} else
res_temp1->next = new_res;
}
}
else
} else
*(unsigned int *)(((char *)code) + rel[i].r_address) += (unsigned int)code;
}
}
@ -259,7 +245,6 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
zlink_mname.c[code->routine_name.len] = 0;
if (!res_root)
return TRUE;
if ((off_t)-1 == lseek(file, (off_t)fhead->a_syms, SEEK_CUR))
{ res_free(res_root);
return FALSE;
@ -279,14 +264,15 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
res_free(res_root);
return FALSE;
}
/* Match up unresolved entries with the null terminated symbol name entries from the
* symbol text pool we just read in. */
* symbol text pool we just read in.
*/
sym_temp = sym_temp1 = symbols;
symtop = symbols + string_size;
for (i = 0; res_root; i++)
{ while (i < res_root->symnum)
{ /* Forward symbol space until our symnum index (i) matches the symbol we are processing in res_root */
{
while (i < res_root->symnum)
{ /* Forward symbol space until our symnum index (i) matches the symbol we are processing in res_root */
while (*sym_temp)
{
if (sym_temp >= symtop)
@ -303,7 +289,7 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
}
assert (i == res_root->symnum);
/* Find end of routine name that we care about */
while (*sym_temp1 != '.' && *sym_temp1)
while (('.' != *sym_temp1) && *sym_temp1)
{ if (sym_temp1 >= symtop)
{
free(symbols);
@ -316,20 +302,21 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
assert(sym_size <= MAX_MIDENT_LEN);
memcpy(&rtnid.c[0], sym_temp, sym_size);
rtnid.c[sym_size] = 0;
if (rtnid.c[0] == '_')
if ('_' == rtnid.c[0])
rtnid.c[0] = '%';
assert(sym_size != mid_len(&zlink_mname) || 0 != memcmp(&zlink_mname.c[0], &rtnid.c[0], sym_size));
assert((sym_size != mid_len(&zlink_mname)) || (0 != memcmp(&zlink_mname.c[0], &rtnid.c[0], sym_size)));
rtn_str.addr = &rtnid.c[0];
rtn_str.len = sym_size;
rtn = find_rtn_hdr(&rtn_str); /* Routine already resolved? */
sym_size = 0;
labsym = FALSE;
if (*sym_temp1 == '.')
{ /* If symbol is for a label, find the end of the label name */
{ /* If symbol is for a label, find the end of the label name */
sym_temp1++;
sym_temp = sym_temp1;
while (*sym_temp1)
{ if (sym_temp1 >= symtop)
{
if (sym_temp1 >= symtop)
{
free(symbols);
res_free(res_root);
@ -341,33 +328,33 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
assert(sym_size <= MAX_MIDENT_LEN);
memcpy(&labid.c[0], sym_temp, sym_size);
labid.c[sym_size] = 0;
if (labid.c[0] == '_')
if ('_' == labid.c[0])
labid.c[0] = '%';
labsym = TRUE;
}
sym_temp1++;
sym_temp = sym_temp1;
if (rtn)
{ /* The routine part at least is known */
{ /* The routine part at least is known */
if (labsym)
{ /* Look our target label up in the routines label table */
label = (lab_tabent *)((char *) rtn + rtn->labtab_ptr);
{ /* Look our target label up in the routines label table */
label = (lab_tabent *)((char *)rtn + rtn->labtab_ptr);
labtop = label + rtn->labtab_len;
for (; label < labtop && (sym_size != label->lab_name.len ||
memcmp(&labid.c[0], label->lab_name.addr, sym_size)); label++)
for (; label < labtop && ((sym_size != label->lab_name.len)
|| memcmp(&labid.c[0], label->lab_name.addr, sym_size)); label++)
;
if (label < labtop)
res_addr = (char *)(label->LABENT_LNR_OFFSET + (char *)rtn);
res_addr = (char *)&label->LABENT_LNR_OFFSET;
else
res_addr = 0;
}
else
} else
res_addr = (char *)rtn;
if (res_addr)
{ /* The external symbol definition is available. Resolve all references to it */
{ /* The external symbol definition is available. Resolve all references to it */
res_temp = res_root->next;
while(res_root)
{ *(uint4 *)(((char *)code) + res_root->addr) = (unsigned int) res_addr;
while (res_root)
{
*(uint4 *)(((char *)code) + res_root->addr) = (unsigned int)res_addr;
res_temp1 = res_root->list;
free(res_root);
res_root = res_temp1;
@ -379,12 +366,12 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
/* This symbol is unknown. Put on the (local) unresolved extern chain -- either for labels or routines */
urx_rp = urx_putrtn(rtn_str.addr, rtn_str.len, urx_lcl);
res_temp = res_root->next;
while(res_root)
while (res_root)
{
if (labsym)
urx_putlab(&labid.c[0], sym_size, urx_rp, ((char *)code) + res_root->addr);
else
{ urx_tmpaddr = (urx_addr *) malloc(SIZEOF(urx_addr));
{ urx_tmpaddr = (urx_addr *)malloc(SIZEOF(urx_addr));
urx_tmpaddr->next = urx_rp->addr;
urx_tmpaddr->addr = (INTPTR_T *)(((char *)code) + res_root->addr);
urx_rp->addr = urx_tmpaddr;
@ -415,13 +402,13 @@ void res_free(res_list *root)
}
}
/* ZL_ERROR - perform cleanup and signal errors found in zlinking a mumps object module
* err - an error code that accepts no arguments and
* err2 - an error code that accepts two arguments (!AD) */
* err2 - an error code that accepts two arguments (!AD)
*/
void zl_error(int4 file, int4 err, int4 err2, int4 len, char *addr)
{
int rc;
int rc;
if (code)
{
@ -429,7 +416,7 @@ void zl_error(int4 file, int4 err, int4 err2, int4 len, char *addr)
code = NULL;
}
CLOSEFILE_RESET(file, rc); /* resets "file" to FD_INVALID */
if (0 != err && 0 != err2)
if ((0 != err) && (0 != err2))
rts_error(VARLSTCNT(6) err, 0, err2, 2, len, addr);
else if (0 != err)
rts_error(VARLSTCNT(1) err);

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2002 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -85,10 +85,6 @@ byte_off:
long: movl %eax,msf_mpc_off(%edx)
addl $5,msf_mpc_off(%edx)
cont: call exfun_frame
movl frame_pointer,%edx
movl msf_old_frame_off(%edx),%eax
movl %eax,frame_pointer
movl %edx,sav_msf(%ebp)
leal ret_val(%ebp),%esi
movl %esp,%edi
movl act_cnt(%ebp),%eax
@ -102,10 +98,8 @@ cont: call exfun_frame
addl $4,%eax
pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
done: movl sav_msf(%ebp),%eax
movl %eax,frame_pointer
orw $SFT_EXTFUN,msf_typ_off(%eax)
movl msf_temps_ptr_off(%eax),%edi
done: movl frame_pointer,%edx
movl msf_temps_ptr_off(%edx),%edi
retlab: leal sav_ebx(%ebp),%esp
movl rtn_pc(%ebp),%edx
movl act_cnt(%ebp),%eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -33,12 +33,17 @@
# PUBLIC op_extcall
ENTRY op_extcall
putframe
addl $4,%esp
popl %edx
popl %eax
addl $4,%esp # burn return pc
popl %edx # routine hdr addr
popl %eax # label addr
cmpl $0,%eax
je l2
l1: movl (%eax),%eax
l1: movl (%eax),%eax # get the line number offset
cmpl $0,%eax
je l4
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax # get the line number pointer
movl (%eax),%eax # get the line number
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax
pushl %eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2002 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -46,11 +46,6 @@
.extern push_parm
.extern rts_error
Grp5_Prefix = 0x0ff # escape for CALL_Ev opcode
CALL_Ev = 0x010 # CALL_Ev part of ModR/M byte
reg_opcode_mask = 0x038
ISFORMAL = 0x0244 # xf_isformal*4
actual1 = 24
act_cnt = 20
mask_arg = 16
@ -78,26 +73,27 @@ ENTRY op_extexfun
movl label_arg(%ebp),%eax
cmpl $0,%eax
je l3
l1: movl (%eax),%ebx
l1: pushl %eax # save labaddr
movl (%eax),%eax # get offset to line number entry
cmpl $0,%eax
je l5
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax # get the pointer to line number entry
movl (%eax),%ebx # get line number
addl mrt_curr_ptr(%edx),%ebx
addl %edx,%ebx
cmpb $Grp5_Prefix,0(%ebx)
jne l6
movb 1(%ebx),%cl
andb $reg_opcode_mask,%cl
cmpb $CALL_Ev,%cl
jne l6
cmpl $ISFORMAL,2(%ebx)
jne l6
popl %eax # restore labaddr
cmpl $0,4(%eax) # labaddr += 4, to point to has_parms; then *has_parms
je l6 # if has_parms == 0, then issue an error
pushl %ebx
pushl $0
pushl %edx
call new_stack_frame
addl $12,%esp
movl frame_pointer,%edx
movl msf_old_frame_off(%edx),%eax
movl %eax,frame_pointer
movl %edx,sav_msf(%ebp)
leal ret_val(%ebp),%esi
movl %esp,%edi
movl act_cnt(%ebp),%eax
@ -111,9 +107,7 @@ l1: movl (%eax),%ebx
addl $4,%eax # include: $T(just pushed) plus other 3
pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
movl sav_msf(%ebp),%eax
movl %eax,frame_pointer
orw $SFT_EXTFUN,msf_typ_off(%eax)
retlab: leal sav_ebx(%ebp),%esp
movl act_cnt(%ebp),%eax
addl $5,%eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2007 Fidelity Information Services, Inc #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -33,7 +33,7 @@
# PUBLIC op_extjmp
ENTRY op_extjmp
putframe
addl $4,%esp
addl $4,%esp # Burn return pc
popl %edx
cmpl $0,%edx
je l2
@ -41,7 +41,12 @@ ENTRY op_extjmp
cmpl $0,%eax
je l4
l1: movl (%eax),%eax
l1: movl (%eax),%eax # get line number offset
cmpl $0,%eax
je l4
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax # get line number pointer
movl (%eax),%eax # get line number
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax
pushl %eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2002 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -85,10 +85,6 @@ byte_off:
long: movl %eax,msf_mpc_off(%edx)
addl $5,msf_mpc_off(%edx)
cont: call exfun_frame_sp
movl frame_pointer,%edx
movl msf_old_frame_off(%edx),%eax
movl %eax,frame_pointer
movl %edx,sav_msf(%ebp)
leal ret_val(%ebp),%esi
movl %esp,%edi
movl act_cnt(%ebp),%eax
@ -102,10 +98,8 @@ cont: call exfun_frame_sp
addl $4,%eax
pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
done: movl sav_msf(%ebp),%eax
movl %eax,frame_pointer
orw $SFT_EXTFUN,msf_typ_off(%eax)
movl msf_temps_ptr_off(%eax),%edi
done: movl frame_pointer,%edx
movl msf_temps_ptr_off(%edx),%edi
retlab: leal sav_ebx(%ebp),%esp
movl rtn_pc(%ebp),%edx
movl act_cnt(%ebp),%eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -33,12 +33,17 @@
# PUBLIC op_mprofextcall
ENTRY op_mprofextcall
putframe
addl $4,%esp
popl %edx
popl %eax
addl $4,%esp # burn return pc
popl %edx # routine hdr addr
popl %eax # label addr
cmpl $0,%eax
je l2
l1: movl (%eax),%eax
l1: movl (%eax),%eax # get the line number offset
cmpl $0,%eax
je l4
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax # get the line number pointer
movl (%eax),%eax # get the line number
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax
pushl %eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2002 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -46,11 +46,6 @@
.extern push_parm
.extern rts_error
Grp5_Prefix = 0x0ff # escape for CALL_Ev opcode
CALL_Ev = 0x010 # CALL_Ev part of ModR/M byte
reg_opcode_mask = 0x038
ISFORMAL = 0x0244 # xf_isformal*4
actual1 = 24
act_cnt = 20
mask_arg = 16
@ -78,26 +73,27 @@ ENTRY op_mprofextexfun
movl label_arg(%ebp),%eax
cmpl $0,%eax
je l3
l1: movl (%eax),%ebx
l1: pushl %eax # save labaddr
movl (%eax),%eax # get offset to line number entry
cmpl $0,%eax
je l5
addl mrt_curr_ptr(%edx),%eax
addl %edx,%eax # get the pointer to line number entry
movl (%eax),%ebx # get line number
addl mrt_curr_ptr(%edx),%ebx
addl %edx,%ebx
cmpb $Grp5_Prefix,0(%ebx)
jne l6
movb 1(%ebx),%cl
andb $reg_opcode_mask,%cl
cmpb $CALL_Ev,%cl
jne l6
cmpl $ISFORMAL,2(%ebx)
jne l6
popl %eax # restore labaddr
cmpl $0,4(%eax) # labaddr += 4, to point to has_parms; then *has_parms
je l6 # if has_parms == 0, then issue an error
pushl %ebx
pushl $0
pushl %edx
call new_stack_frame_sp
addl $12,%esp
movl frame_pointer,%edx
movl msf_old_frame_off(%edx),%eax
movl %eax,frame_pointer
movl %edx,sav_msf(%ebp)
leal ret_val(%ebp),%esi
movl %esp,%edi
movl act_cnt(%ebp),%eax
@ -111,9 +107,7 @@ l1: movl (%eax),%ebx
addl $4,%eax # include: $T(just pushed) plus other 3
pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
movl sav_msf(%ebp),%eax
movl %eax,frame_pointer
orw $SFT_EXTFUN,msf_typ_off(%eax)
retlab: leal sav_ebx(%ebp),%esp
movl act_cnt(%ebp),%eax
addl $5,%eax

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001 Sanchez Computer Associates, Inc. #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -24,7 +24,7 @@
.extern frame_pointer
.text
.extern exfun_frame_push_dummy_frame
.extern exfun_frame_sp
.sbttl op_mprofforlcldob
# PUBLIC op_mprofforlcldob
@ -33,7 +33,7 @@ ENTRY op_mprofforlcldob
movl (%esp),%eax
movl %eax,msf_mpc_off(%edx)
addl $2,msf_mpc_off(%edx) # store pc in MUMPS stack frame
doit: call exfun_frame_push_dummy_frame
doit: call exfun_frame_sp
movl frame_pointer,%edx
movl msf_temps_ptr_off(%edx),%edi
ret

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2008 Fidelity Information Services, Inc *
* Copyright 2008, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -10,18 +10,19 @@
****************************************************************/
/* caller_id routine called from CRIT_TRACE macro to
return the return address of our caller allowing CRIT_TRACE
(used in various semaphore routines) to determine who was
calling those semaphore routines and for what purpose and
when. This is a system dependent type of operation and is
generally implemented in assembly language.
Presently 32bit linux system has its own implementation in
assembly. Similar implementation will not work on x86_64
since register rbp is also used as M Frame pointer in its
assembly files.
This particular implementation will work only on Linux x86_64 system
due to its dependency on "backtrace" function call which is not
available on all Unix flovours.*/
* return the return address of our caller allowing CRIT_TRACE
* (used in various semaphore routines) to determine who was
* calling those semaphore routines and for what purpose and
* when. This is a system dependent type of operation and is
* generally implemented in assembly language.
* Presently 32bit linux system has its own implementation in
* assembly. Similar implementation will not work on x86_64
* since register rbp is also used as M Frame pointer in its
* assembly files.
* This particular implementation will work only on Linux x86_64 system
* due to its dependency on "backtrace" function call which is not
* available on all Unix flovours.
*/
#include "mdef.h"
@ -29,14 +30,17 @@
#include <signal.h>
#include "gtm_stdlib.h"
#include "gt_timer.h"
#include "caller_id.h"
#define MAX_TRACE_DEPTH 3
/*We need the callers caller of caller_id */
#define RETURN_ADDRESS_DEPTH 2
GBLREF boolean_t blocksig_initialized;
GBLREF sigset_t block_sigsent;
GBLREF boolean_t blocksig_initialized;
GBLREF sigset_t block_sigsent;
GBLREF int process_exiting;
GBLREF volatile boolean_t timer_in_handler;
static boolean_t caller_id_reent = FALSE; /* If ever true, our helper gets a lobotomy */
@ -47,10 +51,15 @@ caddr_t caller_id(void)
sigset_t savemask;
/* We cannot let this routine nest itself due to the impolite things that
occur when the exception routines get re-entered so just play dead.
*/
* occur when the exception routines get re-entered so just play dead.
*/
if (caller_id_reent)
return (caddr_t)-1;
/* Return 0 if we are already in timer or generic signal signal handler to prevent deadlocks
* due to nested mallocs/frees resulting from interrupting in external function calls.
*/
if (timer_in_handler || process_exiting)
return (caddr_t)0;
/* When backtrace is processing and a signal occurs, there is the potential for a deadlock -- waiting on a
* lock that this process already holds. A work around is to temporarily block signals (SIGINT, SIGQUIT,
* SIGTERM, SIGTSTP, SIGCONT, SIGALRM) and then restore them after the backtrace call returns.
@ -66,8 +75,7 @@ caddr_t caller_id(void)
caller_id_reent = FALSE;
if (blocksig_initialized)
sigprocmask(SIG_SETMASK, &savemask, NULL);
/* backtrace will return call stack with address.*/
/* backtrace will return call stack with address.*/
if (trace_size >= RETURN_ADDRESS_DEPTH)
return (caddr_t)trace[RETURN_ADDRESS_DEPTH];
else

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2011 Fidelity Information Services, Inc #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -204,11 +204,15 @@ if ( $?gtm_version_change == "1" ) then
setenv gt_ld_options_all_exe "-rdynamic -Wl,-u,gtm_filename_to_id -Wl,-u,gtm_zstatus"
setenv gt_ld_options_all_exe "$gt_ld_options_all_exe -Wl,--version-script,gtmexe_symbols.export"
# optimize for all 64bit platforms
setenv gt_ld_syslibs " -lrt -lelf -lncurses -lm -ldl"
# optimize for all 64bit platforms
#
# -lrt doesn't work to pull in semaphores with GCC 4.6, so use -lpthread.
# Add -lc in front of -lpthread to avoid linking in thread-safe versions
# of libc routines from libpthread.
setenv gt_ld_syslibs " -lelf -lncurses -lm -ldl -lc -lpthread -lrt"
if ( 32 == $gt_build_type ) then
# 32bit x86_64 and ia32 - decided at the beginning of the file
setenv gt_ld_syslibs " -lrt -lncurses -lm -ldl"
setenv gt_ld_syslibs " -lncurses -lm -ldl -lc -lpthread -lrt"
endif
if ( "cygwin" == $platform_only ) then
setenv gt_ld_syslibs "-lncurses -lm -lcrypt"

View File

@ -1,6 +1,6 @@
#################################################################
# #
# Copyright 2001, 2011 Fidelity Information Services, Inc #
# Copyright 2001, 2012 Fidelity Information Services, Inc #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
@ -126,21 +126,21 @@ gt_ld_options_pro=-Wl,-M
gt_ld_shl_linker=cc
gt_ld_shl_options=-shared
gt_ld_shl_suffix=.so
gt_ld_syslibs= -lrt -lelf -lncurses -lm -ldl
gt_ld_sysrtns=
ifeq ($(gt_build_type),32)
gt_ld_m_shl_options=
gt_ld_syslibs= -lrt -lncurses -lm -ldl
endif
# -lrt for async I/O in mupip recover/rollback
# -lrt doesn't work to pull in semaphores with GCC 4.6, so use -lpthread.
# Add -lc in front of -lpthread to avoid linking in thread-safe versions
# of libc routines from libpthread.
ifeq ($(gt_build_type), 64)
gt_ld_syslibs=-lrt -lelf -lncurses -lm -ldl
gt_ld_syslibs=-lrt -lelf -lncurses -lm -ldl -lc -lpthread
else
ifeq ($(gt_os_type),Linux)
gt_ld_syslibs=-lrt -lncurses -lm -ldl
gt_ld_syslibs=-lrt -lncurses -lm -ldl -lc -lpthread
else
gt_ld_syslibs=-lncurses -lm -lcrypt
endif
@ -183,7 +183,8 @@ endef
#
define gt-dep
@echo $*.o $*.d : '\' > $@; \
echo $(notdir $(filter-out /usr/include% /usr/lib% /usr/local/include% /usr/local/lib/%, $(filter %.c %.h,$(shell $(gt_cc_compiler) -M $(gt_cc_options) $(gt_cc_dep_option) $<)))) >> $@
echo $(notdir $(filter-out /usr/include% /usr/lib% /usr/local/include% /usr/local/lib/%, \
$(filter %.c %.h,$(shell $(gt_cc_compiler) -M $(gt_cc_options) $(gt_cc_dep_option) $<)))) >> $@
endef
define gt-export
@echo "{" >$@

View File

@ -10,15 +10,15 @@
****************************************************************/
#ifdef __CYGWIN__
#define GTM_RELEASE_NAME "GT.M V5.4-002B CYGWIN x86"
#define GTM_RELEASE_NAME "GT.M V5.5-000 CYGWIN x86"
#elif defined(__ia64)
#define GTM_RELEASE_NAME "GT.M V5.4-002B Linux IA64"
#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux IA64"
#elif defined(__x86_64__)
#define GTM_RELEASE_NAME "GT.M V5.4-002B Linux x86_64"
#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux x86_64"
#elif defined(__s390__)
#define GTM_RELEASE_NAME "GT.M V5.4-002B Linux S390X"
#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux S390X"
#else
#define GTM_RELEASE_NAME "GT.M V5.4-002B Linux x86"
#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux x86"
#endif
#define GTM_PRODUCT "GT.M"
#define GTM_VERSION "V5.4"
#define GTM_VERSION "V5.5"

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2005 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,96 +15,92 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
GBLREF mident window_ident;
error_def (ERR_MAXACTARG);
error_def (ERR_NAMEEXPECTED);
error_def (ERR_COMMAORRPAREXP);
int actuallist (oprtype *opr)
int actuallist (oprtype *opr)
{
triple *ref0, *ref1, *ref2, *masktrip, *counttrip;
oprtype ot;
int mask, parmcount;
error_def (ERR_MAXACTARG);
error_def (ERR_NAMEEXPECTED);
error_def (ERR_COMMAORRPAREXP);
oprtype ot;
triple *counttrip, *masktrip, *ref0, *ref1, *ref2;
DCL_THREADGBL_ACCESS;
assert (window_token == TK_LPAREN);
advancewindow ();
masktrip = newtriple (OC_PARAMETER);
SETUP_THREADGBL_ACCESS;
assert(TK_LPAREN == TREF(window_token));
advancewindow();
masktrip = newtriple(OC_PARAMETER);
mask = 0;
counttrip = newtriple (OC_PARAMETER);
masktrip->operand[1] = put_tref (counttrip);
counttrip = newtriple(OC_PARAMETER);
masktrip->operand[1] = put_tref(counttrip);
ref0 = counttrip;
if (window_token == TK_RPAREN)
if (TK_RPAREN == TREF(window_token))
parmcount = 0;
else
for (parmcount = 1; ; parmcount++)
{
if (parmcount > MAX_ACTUALS)
for (parmcount = 1; ; parmcount++)
{
stx_error (ERR_MAXACTARG);
return FALSE;
}
if (window_token == TK_PERIOD)
{
advancewindow ();
if (window_token == TK_IDENT)
if (MAX_ACTUALS < parmcount)
{
ot = put_mvar (&window_ident);
mask |= (1 << parmcount - 1);
advancewindow ();
}
else if (window_token == TK_ATSIGN)
{
if (!indirection(&ot))
return FALSE;
ref2 = newtriple(OC_INDLVNAMADR);
ref2->operand[0] = ot;
ot = put_tref(ref2);
mask |= (1 << parmcount - 1);
}
else
{
stx_error (ERR_NAMEEXPECTED);
stx_error (ERR_MAXACTARG);
return FALSE;
}
}
else if (window_token == TK_COMMA)
{
ref2 = newtriple(OC_NULLEXP);
ot = put_tref(ref2);
}
else
if (!expr (&ot)) return FALSE;
ref1 = newtriple (OC_PARAMETER);
ref0->operand[1] = put_tref (ref1);
ref1->operand[0] = ot;
if (window_token == TK_COMMA)
{ advancewindow ();
if (window_token == TK_RPAREN)
{ ref0 = ref1;
if (TK_PERIOD == TREF(window_token))
{
advancewindow ();
if (TK_IDENT == TREF(window_token))
{
ot = put_mvar(&(TREF(window_ident)));
mask |= (1 << parmcount - 1);
advancewindow();
} else if (TK_ATSIGN == TREF(window_token))
{
if (!indirection(&ot))
return FALSE;
ref2 = newtriple(OC_INDLVNAMADR);
ref2->operand[0] = ot;
ot = put_tref(ref2);
mask |= (1 << parmcount - 1);
} else
{
stx_error(ERR_NAMEEXPECTED);
return FALSE;
}
} else if (TK_COMMA == TREF(window_token))
{
ref2 = newtriple(OC_NULLEXP);
ot = put_tref(ref2);
ref1 = newtriple (OC_PARAMETER);
ref0->operand[1] = put_tref (ref1);
ref1->operand[0] = ot;
parmcount++;
} else if (EXPR_FAIL == expr(&ot, MUMPS_EXPR))
return FALSE;
ref1 = newtriple(OC_PARAMETER);
ref0->operand[1] = put_tref(ref1);
ref1->operand[0] = ot;
if (TK_COMMA == TREF(window_token))
{ advancewindow ();
if (TK_RPAREN == TREF(window_token))
{ ref0 = ref1;
ref2 = newtriple(OC_NULLEXP);
ot = put_tref(ref2);
ref1 = newtriple(OC_PARAMETER);
ref0->operand[1] = put_tref(ref1);
ref1->operand[0] = ot;
parmcount++;
break;
}
} else if (TREF(window_token) == TK_RPAREN)
break;
else
{
stx_error (ERR_COMMAORRPAREXP);
return FALSE;
}
ref0 = ref1;
}
else
if (window_token == TK_RPAREN)
break;
else
{
stx_error (ERR_COMMAORRPAREXP);
return FALSE;
}
ref0 = ref1;
}
advancewindow ();
masktrip->operand[0] = put_ilit (mask);
counttrip->operand[0] = put_ilit (parmcount);
advancewindow();
masktrip->operand[0] = put_ilit(mask);
counttrip->operand[0] = put_ilit(parmcount);
parmcount += 2;
*opr = put_tref (masktrip);
*opr = put_tref(masktrip);
return parmcount;
}

View File

@ -27,20 +27,15 @@
GBLREF unsigned char *source_buffer;
GBLREF short int source_column;
GBLREF char window_token;
GBLREF mval window_mval;
GBLREF char director_token;
GBLREF mval director_mval;
GBLREF char *lexical_ptr;
GBLREF spdesc stringpool;
GBLREF boolean_t gtm_utf8_mode;
GBLREF boolean_t run_time;
GBLREF mident window_ident; /* the current identifier */
GBLREF mident director_ident; /* the look-ahead identifier */
LITREF char ctypetab[NUM_CHARS];
error_def(ERR_LITNONGRAPH);
error_def(ERR_NUMOFLOW);
static readonly unsigned char apos_ok[] =
{
@ -56,7 +51,6 @@ static readonly unsigned char apos_ok[] =
void advancewindow(void)
{
error_def(ERR_NUMOFLOW);
unsigned char *cp1, *cp2, *cp3, x;
char *tmp, source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)];
int y, charlen;
@ -69,189 +63,188 @@ void advancewindow(void)
SETUP_THREADGBL_ACCESS;
TREF(last_source_column) = source_column;
source_column = (unsigned char *)lexical_ptr - source_buffer + 1;
window_token = director_token;
window_mval = director_mval;
director_mval.mvtype = 0; /* keeps mval from being GC'd since it is not useful until re-used */
/* It is more efficient to swich buffers between window_ident and director_ident
* instead of copying the text from director_ident to window_ident. This can be
* done by exchanging the pointers window_ident.addr and director_ident.addr */
tmp = window_ident.addr;
window_ident = director_ident;
director_ident.addr = tmp;
TREF(window_token) = TREF(director_token);
TREF(window_mval) = TREF(director_mval);
(TREF(director_mval)).mvtype = 0; /* keeps mval from being GC'd since it is not useful until re-used */
tmp = (TREF(window_ident)).addr; /* More efficient to swap pointers between window_ident.addr & director_ident.addr */
TREF(window_ident) = TREF(director_ident); /* than to copy text from director_ident to window_ident */
(TREF(director_ident)).addr = tmp;
x = *lexical_ptr;
switch (y = ctypetab[x])
{
case TK_QUOTE:
ENSURE_STP_FREE_SPACE(MAX_SRCLINE);
cp1 = (unsigned char *)lexical_ptr + 1;
cp2 = cp3 = stringpool.free;
for (;;)
case TK_EOL:
TREF(director_token) = TK_EOL;
return; /* if next character is terminator, avoid incrementing past it */
case TK_QUOTE:
ENSURE_STP_FREE_SPACE(MAX_SRCLINE);
cp1 = (unsigned char *)lexical_ptr + 1;
cp2 = cp3 = stringpool.free;
for (;;)
{
# ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode)
cptr = (unsigned char *)UTF8_MBTOWC((sm_uc_ptr_t)cp1, source_buffer + MAX_SRCLINE, ch);
# endif
x = *cp1++;
if ((SP > x) UNICODE_ONLY(|| (gtm_utf8_mode && !(U_ISPRINT(ch)))))
{
#ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode)
cptr = (unsigned char *)UTF8_MBTOWC((sm_uc_ptr_t)cp1, source_buffer + MAX_SRCLINE, ch);
#endif
x = *cp1++;
if ((SP > x) UNICODE_ONLY(|| (gtm_utf8_mode && !(U_ISPRINT(ch)))))
TREF(last_source_column) = cp1 - source_buffer;
if ('\0' == x)
{
TREF(last_source_column) = cp1 - source_buffer;
if ('\0' == x)
{
director_token = window_token = TK_ERROR;
return;
}
if (!run_time)
{
show_source_line(source_line_buff, SIZEOF(source_line_buff), TRUE);
dec_err(VARLSTCNT(1) ERR_LITNONGRAPH);
}
TREF(director_token) = TREF(window_token) = TK_ERROR;
return;
}
if ('\"' == x)
if (!run_time)
{
UNICODE_ONLY(assert(!gtm_utf8_mode || (cp1 == cptr)));
if ('\"' == *cp1)
cp1++;
else
break;
show_source_line(source_line_buff, SIZEOF(source_line_buff), TRUE);
dec_err(VARLSTCNT(1) ERR_LITNONGRAPH);
}
*cp2++ = x;
#ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && (cptr > cp1))
{
assert(4 > (cptr - cp1));
for (; cptr > cp1;)
*cp2++ = *cp1++;
}
#endif
assert(cp2 <= stringpool.top);
}
lexical_ptr = (char *)cp1;
director_token = TK_STRLIT;
director_mval.mvtype = MV_STR;
director_mval.str.addr = (char *)cp3;
director_mval.str.len = INTCAST(cp2 - cp3);
stringpool.free = cp2;
s2n(&director_mval);
#ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && !run_time)
{ /* UTF8 mode and not compiling an indirect gets an optimization to set the
(true) length of the string into the mval
*/
charlen = utf8_len_stx(&director_mval.str);
if (0 > charlen) /* got a BADCHAR error */
director_token = TK_ERROR;
if ('\"' == x)
{
UNICODE_ONLY(assert(!gtm_utf8_mode || (cp1 == cptr)));
if ('\"' == *cp1)
cp1++;
else
{
assert(charlen == director_mval.str.char_len);
director_mval.mvtype |= MV_UTF_LEN;
}
}
#endif
return;
case TK_LOWER:
case TK_PERCENT:
case TK_UPPER:
cp2 = (unsigned char *)director_ident.addr;
cp3 = cp2 + MAX_MIDENT_LEN;
for (;;)
{
if (cp2 < cp3)
*cp2++ = x;
y = ctypetab[x = *++lexical_ptr];
if ((TK_UPPER != y) && (TK_DIGIT != y) && (TK_LOWER != y))
break;
}
director_ident.len = INTCAST(cp2 - (unsigned char*)director_ident.addr);
director_token = TK_IDENT;
return;
case TK_PERIOD:
if (ctypetab[x = *(lexical_ptr + 1)] != TK_DIGIT)
*cp2++ = x;
# ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && (cptr > cp1))
{
assert(4 > (cptr - cp1));
for (; cptr > cp1;)
*cp2++ = *cp1++;
}
# endif
assert(cp2 <= stringpool.top);
}
lexical_ptr = (char *)cp1;
TREF(director_token) = TK_STRLIT;
(TREF(director_mval)).mvtype = MV_STR;
(TREF(director_mval)).str.addr = (char *)cp3;
(TREF(director_mval)).str.len = INTCAST(cp2 - cp3);
stringpool.free = cp2;
s2n(&(TREF(director_mval)));
# ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && !run_time)
{ /* UTF8 mode and not compiling an indirect gets an optimization to set the
* (true) length of the string into the mval
*/
charlen = utf8_len_stx(&(TREF(director_mval)).str);
if (0 > charlen) /* got a BADCHAR error */
TREF(director_token) = TK_ERROR;
else
{
assert(charlen == (TREF(director_mval)).str.char_len);
(TREF(director_mval)).mvtype |= MV_UTF_LEN;
}
}
# endif
return;
case TK_LOWER:
case TK_PERCENT:
case TK_UPPER:
cp2 = (unsigned char *)((TREF(director_ident)).addr);
cp3 = cp2 + MAX_MIDENT_LEN;
for (;;)
{
if (cp2 < cp3)
*cp2++ = x;
y = ctypetab[x = *++lexical_ptr];
if ((TK_UPPER != y) && (TK_DIGIT != y) && (TK_LOWER != y))
break;
case TK_DIGIT:
director_mval.str.addr = lexical_ptr;
director_mval.str.len = MAX_SRCLINE;
director_mval.mvtype = MV_STR;
lexical_ptr = (char *)s2n(&director_mval);
if (!(director_mval.mvtype &= MV_NUM_MASK))
{
stx_error(ERR_NUMOFLOW);
director_token = TK_ERROR;
return;
}
if (TREF(s2n_intlit))
{
director_token = TK_NUMLIT ;
n2s(&director_mval);
} else
{
director_token = TK_INTLIT ;
director_mval.str.len = INTCAST(lexical_ptr - director_mval.str.addr);
ENSURE_STP_FREE_SPACE(director_mval.str.len);
memcpy(stringpool.free, director_mval.str.addr, director_mval.str.len);
assert (stringpool.free <= stringpool.top) ;
}
}
(TREF(director_ident)).len = INTCAST(cp2 - (unsigned char*)(TREF(director_ident)).addr);
TREF(director_token) = TK_IDENT;
return;
case TK_PERIOD:
if (ctypetab[x = *(lexical_ptr + 1)] != TK_DIGIT)
break;
case TK_DIGIT:
(TREF(director_mval)).str.addr = lexical_ptr;
(TREF(director_mval)).str.len = MAX_SRCLINE;
(TREF(director_mval)).mvtype = MV_STR;
lexical_ptr = (char *)s2n(&(TREF(director_mval)));
if (!((TREF(director_mval)).mvtype &= MV_NUM_MASK))
{
stx_error(ERR_NUMOFLOW);
TREF(director_token) = TK_ERROR;
return;
case TK_APOSTROPHE:
if (( x = *++lexical_ptr) >= 32)
}
if (TREF(s2n_intlit))
{
TREF(director_token) = TK_NUMLIT ;
n2s(&(TREF(director_mval)));
} else
{
TREF(director_token) = TK_INTLIT ;
(TREF(director_mval)).str.len = INTCAST(lexical_ptr - (TREF(director_mval)).str.addr);
ENSURE_STP_FREE_SPACE((TREF(director_mval)).str.len);
memcpy(stringpool.free, (TREF(director_mval)).str.addr, (TREF(director_mval)).str.len);
assert (stringpool.free <= stringpool.top) ;
}
return;
case TK_APOSTROPHE:
if (( x = *++lexical_ptr) >= 32)
{
x -= 32;
if (x < SIZEOF(apos_ok) / SIZEOF(unsigned char))
{
x -= 32;
if (x < SIZEOF(apos_ok) / SIZEOF(unsigned char))
if (y = apos_ok[x])
{
if (y = apos_ok[x])
if (DEL < (x = *++lexical_ptr))
{
if (DEL < (x = *++lexical_ptr))
{
director_token = TK_ERROR;
return;
}
if (TK_RBRACKET == ctypetab[x])
{
lexical_ptr++;
y = TK_NSORTS_AFTER;
}
director_token = y;
TREF(director_token) = TK_ERROR;
return;
}
if (TK_RBRACKET == ctypetab[x])
{
lexical_ptr++;
y = TK_NSORTS_AFTER;
}
TREF(director_token) = y;
return;
}
}
director_token = TK_APOSTROPHE;
return;
case TK_SEMICOLON:
while (*++lexical_ptr) ;
y = TK_EOL;
break;
case TK_ASTERISK:
if (DEL < (x = *(lexical_ptr + 1)))
{
director_token = TK_ERROR;
return;
}
if (TK_ASTERISK == ctypetab[x])
{
lexical_ptr++;
y = TK_EXPONENT;
}
break;
case TK_RBRACKET:
if ((x = *(lexical_ptr + 1)) > DEL)
{
director_token = TK_ERROR;
return;
}
if (TK_RBRACKET == ctypetab[x])
{
lexical_ptr++;
y = TK_SORTS_AFTER;
}
break;
default:
}
TREF(director_token) = TK_APOSTROPHE;
return;
case TK_SEMICOLON:
while (*++lexical_ptr)
;
assert(TK_EOL == ctypetab[*lexical_ptr]);
TREF(director_token) = TK_EOL;
return; /* if next character is terminator, avoid incrementing past it */
case TK_ASTERISK:
if (DEL < (x = *(lexical_ptr + 1)))
{
TREF(director_token) = TK_ERROR;
return;
}
if (TK_ASTERISK == ctypetab[x])
{
lexical_ptr++;
y = TK_EXPONENT;
}
break;
case TK_RBRACKET:
if ((x = *(lexical_ptr + 1)) > DEL)
{
TREF(director_token) = TK_ERROR;
return;
}
if (TK_RBRACKET == ctypetab[x])
{
lexical_ptr++;
y = TK_SORTS_AFTER;
}
break;
default:
;
}
lexical_ptr++;
director_token = y;
TREF(director_token) = y;
return;
}
@ -272,13 +265,15 @@ void advwindw_hash_in_mname_allowed(void)
unsigned char *cp2, *cp3, x;
unsigned char ident_buffer[SIZEOF(mident_fixed)];
int ident_len, ch;
DCL_THREADGBL_ACCESS;
assert(TK_IDENT == window_token);
assert(TK_HASH == director_token);
SETUP_THREADGBL_ACCESS;
assert(TK_IDENT == TREF(window_token));
assert(TK_HASH == TREF(director_token));
/* First copy the existing token we want to expand into our safe-haven */
memcpy(ident_buffer, window_ident.addr, window_ident.len);
memcpy(ident_buffer, (TREF(window_ident)).addr, (TREF(window_ident)).len);
/* Now parse further until we run out of [m]ident */
cp2 = ident_buffer + window_ident.len;
cp2 = ident_buffer + (TREF(window_ident)).len;
cp3 = ident_buffer + MAX_MIDENT_LEN;
*cp2++ = '#'; /* We are only called if director token is '#' so put that char in buffer now */
/* Start processing with the token following the '#' */
@ -289,9 +284,9 @@ void advwindw_hash_in_mname_allowed(void)
if (cp2 < cp3)
*cp2++ = x;
}
director_ident.len = INTCAST(cp2 - ident_buffer);
director_token = TK_IDENT;
memcpy(director_ident.addr, ident_buffer, director_ident.len);
(TREF(director_ident)).len = INTCAST(cp2 - ident_buffer);
TREF(director_token) = TK_IDENT;
memcpy((TREF(director_ident)).addr, ident_buffer, (TREF(director_ident)).len);
advancewindow(); /* Makes the homogenized token the current token (again) and prereads next token */
}
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2009, 2011 Fidelity Information Services, Inc *
* Copyright 2009, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -41,6 +41,36 @@
#include "gtm_malloc.h"
#include "stringpool.h"
#include "mmemory.h"
#include "gtmio.h"
#include "have_crit.h"
GBLREF stack_frame *frame_pointer;
GBLREF symval *curr_symval;
GBLREF unsigned char *msp, *stackbase, *stacktop, *stackwarn;
GBLREF mv_stent *mv_chain;
GBLREF tp_frame *tp_pointer;
GBLREF zwr_hash_table *zwrhtab;
GBLREF trans_num local_tn; /* transaction number for THIS PROCESS */
GBLREF uint4 tstartcycle;
GBLREF uint4 lvtaskcycle; /* lv_val cycle for misc lv_val related tasks */
GBLREF mstr **stp_array;
GBLREF int stp_array_size;
GBLREF lv_val *zsrch_var, *zsrch_dir1, *zsrch_dir2;
GBLREF tp_frame *tp_pointer;
GBLREF int4 SPGC_since_LVGC; /* stringpool GCs since the last dead-data GC */
GBLREF boolean_t suspend_lvgcol;
GBLREF lv_xnew_var *xnewvar_anchor;
GBLREF lv_xnew_ref *xnewref_anchor;
GBLREF mval *alias_retarg;
LITREF mname_entry null_mname_entry;
/* Local routines -- not made static so they show up in pro core stack traces */
STATICFNDCL void als_xnew_killaliasarray(lvTree *lvt);
STATICFNDCL void als_prcs_xnew_alias_cntnr(lvTree *lvt, symval *popdsymval, symval *cursymval);
STATICFNDCL void als_prcs_markreached_cntnr(lvTree *lvt);
CONDITION_HANDLER(als_check_xnew_var_aliases_ch);
/* Define macros locally used by this routine only. General use macros are defined in alias.h */
@ -167,37 +197,6 @@
} \
}
GBLREF stack_frame *frame_pointer;
GBLREF symval *curr_symval;
GBLREF unsigned char *msp, *stackbase, *stacktop, *stackwarn;
GBLREF mv_stent *mv_chain;
GBLREF tp_frame *tp_pointer;
GBLREF zwr_hash_table *zwrhtab;
GBLREF trans_num local_tn; /* transaction number for THIS PROCESS */
GBLREF uint4 tstartcycle;
GBLREF uint4 lvtaskcycle; /* lv_val cycle for misc lv_val related tasks */
GBLREF mstr **stp_array;
GBLREF int stp_array_size;
GBLREF lv_val *zsrch_var, *zsrch_dir1, *zsrch_dir2;
GBLREF tp_frame *tp_pointer;
GBLREF int4 SPGC_since_LVGC; /* stringpool GCs since the last dead-data GC */
GBLREF boolean_t suspend_lvgcol;
GBLREF lv_xnew_var *xnewvar_anchor;
GBLREF lv_xnew_ref *xnewref_anchor;
GBLREF mval *alias_retarg;
LITREF mname_entry null_mname_entry;
/* Local routines -- not made static so they show up in pro core stack traces */
STATICFNDCL void als_xnew_killaliasarray(lvTree *lvt);
STATICFNDCL void als_prcs_xnew_alias_cntnr(lvTree *lvt, symval *popdsymval, symval *cursymval);
STATICFNDCL void als_prcs_markreached_cntnr(lvTree *lvt);
CONDITION_HANDLER(als_check_xnew_var_aliases_ch);
/***************************************************************************************/
/* Routine to repair the l_symtab entries in the stack due to hash table expansion such that the
* l_symtab entries no longer point to valid hash table entries.
*
@ -280,7 +279,7 @@ void als_lsymtab_repair(hash_table_mname *table, ht_ent_mname *table_base_orig,
* different symbol table - previous symbol tables and stack levels are not affected.
*/
fp = *(stack_frame **)(fp + 1); /* Backups up to "prev pointer" created by base_frame() */
if (NULL == fp || fp >= (stack_frame *)stackbase || fp < (stack_frame *)stacktop)
if ((NULL == fp) || (fp >= (stack_frame *)stackbase) || (fp < (stack_frame *)stacktop))
break; /* Pointer not within the stack -- must be earliest occurence */
}
} while(fp);
@ -307,11 +306,11 @@ void als_lsymtab_repair(hash_table_mname *table, ht_ent_mname *table_base_orig,
}
if (NULL == *htep)
continue;
if (*htep < table_base_orig || *htep >= table_top_orig)
if ((*htep < table_base_orig) || (*htep >= table_top_orig))
/* Entry doesn't point to the current symbol table so ignore it since it didn't change */
continue;
htenew = (ht_ent_mname *)((*htep)->value); /* Pick up entry we should now use */
assert(htenew >= table->base && htenew < (table->base + table->size));
assert((htenew >= table->base) && (htenew < (table->base + table->size)));
*htep = htenew;
}
/* For debug at least make unusable in case any stragglers point to it -- even though we are somewhat duplicating
@ -516,9 +515,9 @@ void als_check_xnew_var_aliases(symval *popdsymval, symval *cursymval)
}
/* Step 6: Check if a pending alias return value exists and if so if it needs to be processed.
* This type of value is created by unw_retarg() as the result of a "QUIT *" statement. It is an alias container
* mval that lives in the compiler temps of the caller with a pointer in an mv_stent of the callee in the mvs_parm
* block allocated by push_parm. Since this mval-container is just an mval and not an lv_val, we have to largely
* do similar processing to the "als_prcs_xnew_alias_cntnr" with this block type difference in mind.
* mval that lives in the compiler temps of the caller with a pointer in the stack frame of the callee. Since this
* mval-container is just an mval and not an lv_val, we have to largely do similar processing to the
* "als_prcs_xnew_alias_cntnr" with this block type difference in mind.
*/
if (NULL != alias_retarg)
{
@ -642,7 +641,8 @@ STATICFNDEF void als_prcs_xnew_alias_cntnr(lvTree *lvt, symval *popdsymval, symv
newlv, oldlv));
} else
{ /* lv_val is owned by current or older symval .. just use it in the subsequent scan in case
* it leads us to other lv_vals owned by the popped symtab. */
* it leads us to other lv_vals owned by the popped symtab.
*/
DBGRFCT((stderr, "\nals_prcs_xnew_alias_cntnr: aliascont var found - aliascont lv 0x"lvaddr
" just being (potentially) scanned for container vars\n", node));
newlv = oldlv;
@ -939,9 +939,8 @@ void als_zwrhtab_init(void)
if (zavb)
{
for (zavb_next = zavb->next; zavb_next; zavb = zavb_next, zavb_next = zavb->next)
{ /* Leave one block on queue if it exists .. get rid of others */
/* Leave one block on queue if it exists .. get rid of others */
free(zavb);
}
assert(zavb);
zwrhtab->first_zwrzavb = zavb;
}
@ -961,7 +960,6 @@ zwr_alias_var *als_getzavslot(void)
assert(zwrhtab);
assert(zwrhtab->first_zwrzavb);
zwrhtab->cleaned = FALSE; /* No longer in a clean/initialized state */
/* Check if a block can be allocated out of a zavb super block */
zavb = zwrhtab->first_zwrzavb;
@ -993,10 +991,10 @@ ht_ent_mname *als_lookup_base_lvval(lv_val *lvp)
htep_loweq = NULL;
htep = curr_symval->h_symtab.base;
htep_top = curr_symval->h_symtab.base + curr_symval->h_symtab.size;
assert(htep_top == curr_symval->h_symtab.top);
assert(htep_top == curr_symval->h_symtab.top);
for (; htep < htep_top; htep++)
{
if (HTENT_VALID_MNAME(htep, lv_val, lvhtval) && '$' != *htep->key.var_name.addr && lvp == lvhtval)
if (HTENT_VALID_MNAME(htep, lv_val, lvhtval) && ('$' != *htep->key.var_name.addr) && (lvp == lvhtval))
{ /* HT entry is valid and has a key that is not a $ZWRTAC type key and the lval matches
* so we have a candidate to check for "lowest" alias name for given lv_val addr.
*/
@ -1026,8 +1024,8 @@ ht_ent_mname *als_lookup_base_lvval(lv_val *lvp)
* 1) Run lv_blks which contain all lv_val structures in use for this symbol table.
* 2) Record each base lv_val in our version of the array used by stp_gcol. Base lv_vals can be identified
* by having a non-zero parent.sym field pointing to a block with type MV_SYM. There are 3 exceptions to
this: In UNIX, the zsearch_var, zsearch_dir1, and zsearch_dir2 fields contain lv_vals that should not be
released. Check for and avoid them.
* this: In UNIX, the zsearch_var, zsearch_dir1, and zsearch_dir2 fields contain lv_vals that should not be
* released. Check for and avoid them.
* 3) Increment lvtaskcycle with which we will mark lv_vals as having been marked accessible as we discover them.
* 4) Go through the hashtable. Set the lvtaskcycle field to mark the lv_val "reachable".
* 5) If the lv_val has descendants, run the decendant chain to look for container vars.
@ -1064,20 +1062,18 @@ int als_lvval_gc(void)
if (NULL == stp_array)
/* Same initialization as is in stp_gcol_src.h */
stp_array = (mstr **)malloc((stp_array_size = STP_MAXITEMS) * SIZEOF(mstr *));
lvarraycur = lvarray = (lv_val **)stp_array;
lvarraytop = lvarraycur + stp_array_size;
/* Steps 1,2 - find all the base lv_vals and put in list */
for (lv_blk_ptr = curr_symval->lv_first_block; lv_blk_ptr; lv_blk_ptr = lv_blk_ptr->next)
{
for (lvp = (lv_val *)LV_BLK_GET_BASE(lv_blk_ptr), lvlimit = LV_BLK_GET_FREE(lv_blk_ptr, lvp);
lvp < lvlimit; lvp++)
lvp < lvlimit; lvp++)
{
sym = LV_SYMVAL(lvp);
assert((NULL == sym) || SYM_IS_SYMVAL(sym));
if ((NULL != sym) UNIX_ONLY(&& (TREF(zsearch_var) != lvp))
UNIX_ONLY(&& (TREF(zsearch_dir1) != lvp) && (TREF(zsearch_dir2) != lvp)))
UNIX_ONLY(&& (TREF(zsearch_dir1) != lvp) && (TREF(zsearch_dir2) != lvp)))
{ /* Put it in the list */
assert(0 < lvp->stats.trefcnt);
if (lvarraycur >= lvarraytop)
@ -1099,13 +1095,12 @@ int als_lvval_gc(void)
htep_top = curr_symval->h_symtab.base + curr_symval->h_symtab.size;
assert(htep_top == curr_symval->h_symtab.top);
for (; htep < htep_top; htep++)
{
if (HTENT_VALID_MNAME(htep, lv_val, lvp))
{ /* HT entry is valid. Note for purposes of this loop, we do NOT bypass $ZWRTAC type keys since
* they are valid reachable variables even if hidden */
* they are valid reachable variables even if hidden
*/
MARK_REACHABLE(lvp);
}
}
/* Step 7 - Run the mv_stent chain marking those vars as reachable. */
DBGRFCT((stderr, "als_lvval_gc: Starting mv_stent scan\n"));
for (mv_st_ent = mv_chain; mv_st_ent; mv_st_ent = (mv_stent *)(mv_st_ent->mv_st_next + (char *)mv_st_ent))
@ -1165,9 +1160,9 @@ int als_lvval_gc(void)
}
/* Step 8 - Run the TP stack to see if there is anything we can mark reachable */
DBGRFCT((stderr, "als_lvval_gc: Starting TP stack scan\n"));
for (tf = tp_pointer; NULL != tf && tf->sym == curr_symval; tf = tf->old_tp_frame)
for (tf = tp_pointer; (NULL != tf) && (tf->sym == curr_symval); tf = tf->old_tp_frame)
{
for (restore_ent = tf->vars; NULL != restore_ent; restore_ent = restore_ent->next)
for (restore_ent = tf->vars; NULL != restore_ent; restore_ent = restore_ent->next)
{ /* Since TP keeps its own use count on these sorts of variables, we will mark both the
* current and saved values in these blocks. This is because the "current value" could
* be detached from the hash table at this point but is still viable while we hold a use
@ -1237,9 +1232,8 @@ int als_lvval_gc(void)
{
lvp = *lvptr;
if (lvp->stats.lvtaskcycle != lvtaskcycle && LV_SYMVAL(lvp))
{ /* Var is still intact, kill it */
/* Var is still intact, kill it */
assert(FALSE);
}
}
# endif
assert(lvtaskcycle == savelvtaskcycle);
@ -1263,18 +1257,12 @@ void als_lvmon_output(void)
flush_pio();
for (lvlsymtab = curr_symval; lvlsymtab; lvlsymtab = lvlsymtab->last_tab)
{
for (lvbp = curr_symval->lv_first_block; lvbp; lvbp = lvbp->next)
{
for (lvp = (lv_val *)LV_BLK_GET_BASE(lvbp), lvp_top = LV_BLK_GET_FREE(lvbp, lvp); lvp < lvp_top; lvp++)
{
if (lvp->lvmon_mark)
{ /* lv_val slot not used as an sbs and is marked. Report it */
FPRINTF(stderr, "als_lvmon_output: lv_val at 0x"lvaddr" is still marked\n", lvp);
}
}
}
}
fflush(stderr);
FFLUSH(stderr);
}
# endif

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -23,10 +23,10 @@
#include "alloc_reg.h"
#include "cdbg_dump.h"
#define MAX_TEMP_COUNT 128
#define MAX_TEMP_COUNT 128
GBLDEF int4 sa_temps[VALUED_REF_TYPES];
GBLDEF int4 sa_temps_offset[VALUED_REF_TYPES];
GBLDEF int4 sa_temps[VALUED_REF_TYPES];
GBLDEF int4 sa_temps_offset[VALUED_REF_TYPES];
GBLREF int mvmax;
GBLREF triple t_orig;
@ -48,14 +48,14 @@ error_def(ERR_TMPSTOREMAX);
void alloc_reg(void)
{
triple *x, *y, *ref;
tbp *b;
oprtype *j;
opctype opc, opx;
char tempcont[VALUED_REF_TYPES][MAX_TEMP_COUNT], dest_type;
int r, c, temphigh[VALUED_REF_TYPES];
unsigned int oct;
int4 size;
triple *x, *y, *ref;
tbp *b;
oprtype *j;
opctype opc, opx;
char tempcont[VALUED_REF_TYPES][MAX_TEMP_COUNT], dest_type;
int r, c, temphigh[VALUED_REF_TYPES];
unsigned int oct;
int4 size;
memset(&tempcont[0][0], 0, SIZEOF(tempcont));
memset(&temphigh[0], -1, SIZEOF(temphigh));
@ -72,20 +72,21 @@ void alloc_reg(void)
case OC_PARAMETER:
continue;
case OC_LINESTART:
/* If the next triple is also a LINESTART, then this is a comment line. Therefore
eliminate this LINESTART */
/* If the next triple is also a LINESTART, then this is a comment line.
* Therefore eliminate this LINESTART
*/
opx = x->exorder.fl->opcode;
if ((OC_LINESTART == opx) || (OC_LINEFETCH == opx) || (OC_ISFORMAL == opx))
if ((OC_LINESTART == opx) || (OC_LINEFETCH == opx))
{
opc = x->opcode = OC_NOOP;
COMPDBG(PRINTF(" ** Converting triple to NOOP (rsn 1) **\n"););
continue; /* continue, because 'normal' NOOP continues from this switch */
}
/* There is a special case in the case of NOLINE_ENTRY being specified. If a blank line is followed
by a line with a label and that label generates fetch information, the generated triple sequence
will be LINESTART (from blank line), ILIT (count from PREVIOUS fetch), LINEFETCH. We will detect
that sequence here and change the LINESTART to a NOOP.
*/
* by a line with a label and that label generates fetch information, the generated triple sequence
* will be LINESTART (from blank line), ILIT (count from PREVIOUS fetch), LINEFETCH. We will detect
* that sequence here and change the LINESTART to a NOOP.
*/
if (!(cmd_qlf.qlf & CQ_LINE_ENTRY) && (OC_ILIT == opx) && (NULL != x->exorder.fl->exorder.fl)
&& (OC_LINEFETCH == x->exorder.fl->exorder.fl->opcode))
{
@ -96,8 +97,7 @@ void alloc_reg(void)
break;
case OC_LINEFETCH:
case OC_FETCH:
assert((TRIP_REF == x->operand[0].oprclass)
&& (OC_ILIT == x->operand[0].oprval.tref->opcode));
assert((TRIP_REF == x->operand[0].oprclass) && (OC_ILIT == x->operand[0].oprval.tref->opcode));
if (x->operand[0].oprval.tref->operand[0].oprval.ilit == mvmax)
{
x->operand[0].oprval.tref->operand[0].oprval.ilit = 0;
@ -179,10 +179,10 @@ void alloc_reg(void)
} else
{
oct &= OCT_VALUE | OCT_MVADDR;
assert ((OCT_MVAL == oct) || (OCT_MINT == oct) || ((OCT_MVADDR | OCT_MVAL) == oct)
assert((OCT_MVAL == oct) || (OCT_MINT == oct) || ((OCT_MVADDR | OCT_MVAL) == oct)
|| (OCT_CDADDR == oct));
r = (OCT_MVAL == oct) ? TVAL_REF : (((OCT_MVADDR | OCT_MVAL) == oct) ? TVAD_REF
: ((OCT_MINT == oct) ? TINT_REF : TCAD_REF));
r = (OCT_MVAL == oct) ? TVAL_REF : (((OCT_MVADDR | OCT_MVAL) == oct)
? TVAD_REF : ((OCT_MINT == oct) ? TINT_REF : TCAD_REF));
for (c = 0; tempcont[r][c] && (MAX_TEMP_COUNT > c); c++)
;
if (MAX_TEMP_COUNT <= c)
@ -202,7 +202,7 @@ void alloc_reg(void)
x->destination = x->destination.oprval.tref->destination;
}
}
for (r = 0; VALUED_REF_TYPES > r ;r++)
for (r = 0; VALUED_REF_TYPES > r; r++)
sa_temps[r] = temphigh[r] + 1;
sa_temps_offset[TVAR_REF] = sa_temps[TVAR_REF] * sa_class_sizes[TVAR_REF];
size = sa_temps[TVAL_REF] * sa_class_sizes[TVAL_REF];

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -19,15 +19,15 @@
GBLREF unsigned char *stacktop, *stackwarn, *msp;
GBLREF stack_frame *frame_pointer;
error_def(ERR_STACKCRIT);
error_def(ERR_STACKOFLOW);
void base_frame(rhdtyp *base_address)
{
void gtm_ret_code(); /* This is an external which points to code without an entry mask */
unsigned char *msp_save;
stack_frame *fp;
error_def(ERR_STACKOFLOW);
error_def(ERR_STACKCRIT);
if ((INTPTR_T)msp & 1) /* synchronize mumps stack on even boundary */
msp--;
if ((INTPTR_T)msp & 2)
@ -59,4 +59,6 @@ void base_frame(rhdtyp *base_address)
fp->vartab_len = 0;
fp->vartab_ptr = (char *)fp;
fp->type = SFT_COUNT;
fp->ret_value = NULL;
fp->dollar_test = -1;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -81,7 +81,18 @@ block_id bm_getfree(block_id orig_hint, boolean_t *blk_used, unsigned int cw_wor
uint4 status;
srch_blk_status blkhist;
# ifdef GTM_TRUNCATE
if (dba_mm == cs_data->acc_meth)
{
total_blks = cs_addrs->total_blks;
} else
{
total_blks = cs_addrs->ti->total_blks;
cs_addrs->total_blks = MAX(cs_addrs->total_blks, total_blks);
}
# else
total_blks = (dba_mm == cs_data->acc_meth) ? cs_addrs->total_blks : cs_addrs->ti->total_blks;
# endif
if (orig_hint >= total_blks) /* for TP, hint can be > total_blks */
orig_hint = 1;
hint = orig_hint;
@ -105,6 +116,10 @@ block_id bm_getfree(block_id orig_hint, boolean_t *blk_used, unsigned int cw_wor
return (FILE_EXTENDED);
hint = total_blks;
total_blks = cs_addrs->ti->total_blks;
# ifdef GTM_TRUNCATE
assert(dba_mm != cs_data->acc_meth);
cs_addrs->total_blks = MAX(cs_addrs->total_blks, total_blks);
# endif
hint_cycled = DIVIDE_ROUND_UP(total_blks, BLKS_PER_LMAP);
local_maps = hint_cycled + 2; /* for (up to) 2 wraps */
/*

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -13,7 +13,7 @@
#include "compiler.h"
#include "opcode.h"
int bool_expr(bool op,oprtype *addr)
int bool_expr(boolean_t op, oprtype *addr)
{
oprtype x;
DCL_THREADGBL_ACCESS;
@ -26,10 +26,10 @@ int bool_expr(bool op,oprtype *addr)
TREF(expr_depth) = 0;
return FALSE;
}
assert(TRIP_REF == x.oprclass);
coerce(&x, OCT_BOOL);
if (!(--(TREF(expr_depth))))
TREF(shift_side_effects) = FALSE;
assert(x.oprclass == TRIP_REF);
bx_tail(x.oprval.tref, op, addr);
if (!(--(TREF(expr_depth))))
TREF(saw_side_effect) = TREF(shift_side_effects) = FALSE;
return TRUE;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -33,6 +33,6 @@ void bt_malloc(sgmnt_addrs *csa)
csa->nl->bt_base_off = (n += SIZEOF(bt_rec)); /* th_queue anchor referenced above */
assert((n += (csd->n_bts * SIZEOF(bt_rec))) == (SIZEOF_FILE_HDR(csd)) + (BT_SIZE(csd))); /* DON'T use n after this */
bt_init(csa);
bt_refresh(csa);
bt_refresh(csa, TRUE);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -18,16 +18,19 @@
#include "longset.h"
#include "relqop.h"
void bt_refresh(sgmnt_addrs *csa)
/* Refresh the database cache records in the shared memory. If init = TRUE, do the longset and initialize all the forward and
* backward links. If init = FALSE, reset only the needed fields.
*/
void bt_refresh(sgmnt_addrs *csa, boolean_t init)
{
sgmnt_data_ptr_t csd;
bt_rec_ptr_t ptr, top, bt1;
error_def(ERR_BTFAIL);
csd = csa->hdr;
assert(dba_bg == csd->acc_meth);
longset((uchar_ptr_t)csa->bt_header, (csd->bt_buckets + csd->n_bts + 1) * SIZEOF(bt_rec), 0);
if (init)
longset((uchar_ptr_t)csa->bt_header, (csd->bt_buckets + csd->n_bts + 1) * SIZEOF(bt_rec), 0);
for (ptr = csa->bt_header, top = ptr + csd->bt_buckets + 1; ptr < top; ptr++)
ptr->blk = BT_QUEHEAD;
@ -36,8 +39,12 @@ void bt_refresh(sgmnt_addrs *csa)
{
ptr->blk = BT_NOTVALID;
ptr->cache_index = CR_NOTVALID;
insqt((que_ent_ptr_t)ptr, (que_ent_ptr_t)bt1);
insqt((que_ent_ptr_t)((sm_uc_ptr_t)ptr + (2 * SIZEOF(sm_off_t))), (que_ent_ptr_t)csa->th_base);
ptr->tn = ptr->killtn = 0;
if (init)
{
insqt((que_ent_ptr_t)ptr, (que_ent_ptr_t)bt1);
insqt((que_ent_ptr_t)((sm_uc_ptr_t)ptr + (2 * SIZEOF(sm_off_t))), (que_ent_ptr_t)csa->th_base);
}
}
((th_rec *)((uchar_ptr_t)csa->th_base + csa->th_base->tnque.fl))->tn = csa->ti->curr_tn - 1;
csa->ti->mm_tn = 0;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -12,24 +12,187 @@
#include "mdef.h"
#include "compiler.h"
#include "opcode.h"
#include "mdq.h"
#include "mmemory.h"
#include "emit_code.h"
#include "fullbool.h"
void bx_boolop(triple *t, bool jmp_type_one, bool jmp_to_next, bool sense, oprtype *addr)
LITREF octabstruct oc_tab[];
void bx_boolop(triple *t, boolean_t jmp_type_one, boolean_t jmp_to_next, boolean_t sense, oprtype *addr)
{
oprtype *p;
boolean_t expr_fini;
oprtype *i, *p;
triple *ref0, *ref1, *t0, *t1;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(((1 & sense) == sense) && ((1 & jmp_to_next) == jmp_to_next) && ((1 & jmp_type_one) == jmp_type_one));
assert((TRIP_REF == t->operand[0].oprclass) && (TRIP_REF == t->operand[1].oprclass));
if (jmp_to_next)
{
p = (oprtype *) mcalloc(SIZEOF(oprtype));
p = (oprtype *)mcalloc(SIZEOF(oprtype));
*p = put_tjmp(t);
}
else
{
} else
p = addr;
if (GTM_BOOL == TREF(gtm_fullbool) || !TREF(saw_side_effect))
{ /* nice simple short circuit */
assert(NULL == TREF(boolchain_ptr));
bx_tail(t->operand[0].oprval.tref, jmp_type_one, p);
bx_tail(t->operand[1].oprval.tref, sense, addr);
} else
{ /* got a side effect and don't want them short circuited - this violates info hiding big-time
* This code relies on the original technique of setting up a jump ladder
* then it changes the jumps into stotemps and creates a new ladder using the saved evaluations
* for the relocated jumps to work with
* The most interesting part is getting the addresses for the new jump operands (targets)
* In theory we could turn this technique on and off around each side effect, but that's even more
* complicated, requiring additional instructions, and we don't predict the typical boolean expression
* has enough subexpressions to justify the extra trouble, although the potential pay-back would be to
* avoid unnecessary global references - again not expecting that many in a typical boolean expresion
*/
assert(TREF(shift_side_effects));
t0 = t->exorder.fl;
if (expr_fini = (NULL == TREF(boolchain_ptr))) /* NOTE assignment */
{
if (OC_BOOLFINI == t0->opcode)
{ /* ex_tail wraps bools that produce a value with OC_BOOLINIT and OC_BOOLFINI */
assert(OC_COMVAL == t0->exorder.fl->opcode);
assert(TRIP_REF == t0->operand[0].oprclass);
} else
assert(((OC_NOOP == t0->opcode) && (t0 == TREF(curtchain)))
|| (oc_tab[t0->opcode].octype & OCT_BOOL));
TREF(boolchain_ptr) = &(TREF(boolchain));
dqinit(TREF(boolchain_ptr), exorder);
}
for (i = t->operand; i < ARRAYTOP(t->operand); i++)
{
t1 = i->oprval.tref;
if (&(t->operand[0]) == i)
bx_tail(t1, jmp_type_one, p);
else
{ /* operand[1] */
bx_tail(t1, sense, addr);
if (!expr_fini)
break; /* only need to relocate last operand[1] */
}
if (OC_NOOP == t1->opcode)
{ /* the technique of sprinkling noops means fishing around for the actual instruction */
do
{
t1 = t1->exorder.bl;
} while (OC_NOOP == t1->opcode);
if (oc_tab[t1->opcode].octype & OCT_JUMP)
t1 = t1->exorder.bl;
else
{
for (t1 = i->oprval.tref; OC_NOOP == t1->opcode; t1 = t1->exorder.fl)
;
}
}
assert(NULL != TREF(boolchain_ptr));
switch (t1->opcode)
{ /* time to subvert the original jump ladder entry */
case OC_COBOOL:
/* insert COBOOL and copy of following JMP in boolchain; overlay them with STOTEMP and NOOP */
assert(oc_tab[t1->exorder.fl->opcode].octype & OCT_JUMP);
ref0 = maketriple(OC_COBOOL); /* coerce later while pulling it out of temp */
ref0->operand[0] = put_tref(t1);
ref1 = (TREF(boolchain_ptr))->exorder.bl;
dqins(ref1, exorder, ref0);
t1->opcode = OC_STOTEMP; /* save the value instead of coercing now */
t1 = t1->exorder.fl;
ref0 = maketriple(t1->opcode); /* create new jump on result of coerce */
ref0->operand[0] = t1->operand[0];
t1->operand[0].oprclass = NOCLASS;
t1->opcode = OC_NOOP; /* wipe out original jump */
break;
case OC_CONTAIN:
case OC_EQU:
case OC_FOLLOW:
case OC_NUMCMP:
case OC_PATTERN:
case OC_SORTS_AFTER:
/* insert copies of orig OC and following JMP in boolchain & overly originals with STOTEMPs */
assert(oc_tab[t1->exorder.fl->opcode].octype & OCT_JUMP);
assert(TRIP_REF == t1->operand[0].oprclass);
assert(TRIP_REF == t1->operand[1].oprclass);
ref0 = maketriple(t1->opcode); /* copy operands with the stotemps as args */
ref0->operand[0] = put_tref(t1);
ref0->operand[1] = put_tref(t1->exorder.fl);
ref1 = (TREF(boolchain_ptr))->exorder.bl;
dqins(ref1, exorder, ref0);
t1->opcode = OC_STOTEMP; /* overlay the original op with 1st stotemp */
t1 = t1->exorder.fl;
ref0 = maketriple(t1->opcode); /* copy jmp */
ref0->operand[0] = t1->operand[0];
t1->operand[0] = t1->exorder.bl->operand[1];
t1->opcode = OC_STOTEMP; /* overlay jmp with 2nd stotemp */
break;
case OC_JMPTSET:
case OC_JMPTCLR:
/* move copy of jmp to boolchain and NOOP it */
ref0 = maketriple(t1->opcode);
ref0->operand[0] = t1->operand[0];
t1->operand[0].oprclass = NOCLASS;
t1->opcode = OC_NOOP; /* wipe out original jump */
break;
default:
GTMASSERT;
}
if (jmp_to_next) /* mark target for later adjustment */
ref0->operand[1].oprval.tref = ref0->operand[0].oprval.tref;
ref1 = (TREF(boolchain_ptr))->exorder.bl;
dqins(ref1, exorder, ref0);
}
if (expr_fini)
{ /* time to deal with new jump ladder */
assert(NULL != TREF(boolchain_ptr));
t0 = t0->exorder.bl;
assert(oc_tab[t0->opcode].octype & OCT_BOOL);
assert(t0 == t);
dqadd(t0, TREF(boolchain_ptr), exorder); /* insert the new jump ladder */
ref0 = (TREF(boolchain_ptr))->exorder.bl->exorder.fl;
if (ref0 == TREF(curtchain))
{
newtriple(OC_NOOP);
ref0 = (TREF(curtchain))->exorder.bl;
}
assert(ref0);
t0 = t->exorder.fl;
if ((OC_JMPTSET != t0->opcode) && (OC_JMPTCLR != t0->opcode))
t0 = t0->exorder.fl;
for (; (t0 != TREF(curtchain)) && oc_tab[t0->opcode].octype & OCT_JUMP; t0 = t1)
{ /* check for jumps with targets */
assert(INDR_REF == t0->operand[0].oprclass);
t1 = t0->exorder.fl;
if (oc_tab[t1->opcode].octype & OCT_BOOL)
t1 = ref1 = t1->exorder.fl;
else
{
if ((OC_JMPTSET == t1->opcode) || (OC_JMPTCLR == t1->opcode))
ref1 = t1;
else
break;
}
if (t0->operand[1].oprval.tref == t0->operand[0].oprval.tref)
{ /* adjust relocated jump to "next" */
if (oc_tab[ref1->opcode].octype & OCT_JUMP)
ref1 = ref1->exorder.fl;
if ((ref1 == TREF(curtchain)
|| (t == t0->operand[0].oprval.tref->exorder.fl)))
ref1 = ref0;
assert((OC_NOOP == ref1->opcode) || (OC_BOOLFINI == ref1->opcode)
|| (OC_COMVAL == ref1->opcode) || (oc_tab[ref1->opcode].octype & OCT_BOOL));
t0->operand[0] = put_tjmp(ref1);
t0->operand[1].oprval.tref = NULL;
} else if (TJMP_REF == t0->operand[0].oprval.indr->oprclass)
t0->operand[0] = put_tjmp(ref0); /* adjust jump to "addr" */
}
TREF(boolchain_ptr) = NULL;
}
}
bx_tail(t->operand[0].oprval.tref, jmp_type_one, p);
bx_tail(t->operand[1].oprval.tref, sense, addr);
t->opcode = OC_NOOP;
t->operand[0].oprclass = t->operand[1].oprclass = 0;
t->operand[0].oprclass = t->operand[1].oprclass = NOCLASS;
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -18,39 +18,39 @@
LITREF octabstruct oc_tab[];
/* structure of jmps is as follows:
*
* sense OC_AND OC_OR
*
* TRUE op1 op1
* jmpf next jmpt addr
* op2 op2
* jmpt addr jmpt addr
*
* FALSE op1 op1
* jmpf addr jmpt next
* op2 op2
* jmpf addr jmpf addr
**/
sense OC_AND OC_OR
TRUE op1 op1
jmpf next jmpt addr
op2 op2
jmpt addr jmpt addr
FALSE op1 op1
jmpf addr jmpt next
op2 op2
jmpf addr jmpf addr
*/
void bx_tail(triple *t, bool sense, oprtype *addr)
void bx_tail(triple *t, boolean_t sense, oprtype *addr)
/*
triple *t; triple to be processed
bool sense; code to be generated is jmpt or jmpf
oprtype *addr; address to jmp
*/
* triple *t; triple to be processed
*boolean_t sense; code to be generated is jmpt or jmpf
*oprtype *addr; address to jmp
*/
{
triple *ref;
oprtype *p;
assert(sense == TRUE || sense == FALSE);
assert((1 & sense) == sense);
assert(oc_tab[t->opcode].octype & OCT_BOOL);
assert(t->operand[0].oprclass == TRIP_REF);
assert(t->operand[1].oprclass == TRIP_REF || t->operand[1].oprclass == 0);
assert(TRIP_REF == t->operand[0].oprclass);
assert((TRIP_REF == t->operand[1].oprclass) || (NOCLASS == t->operand[1].oprclass));
switch (t->opcode)
{
case OC_COBOOL:
ex_tail(&t->operand[0]);
if (t->operand[0].oprval.tref->opcode == OC_GETTRUTH)
if (OC_GETTRUTH == t->operand[0].oprval.tref->opcode)
{
dqdel(t->operand[0].oprval.tref, exorder);
t->opcode = sense ? OC_JMPTSET : OC_JMPTCLR;
@ -62,54 +62,54 @@ oprtype *addr; address to jmp
dqins(t, exorder, ref);
return;
case OC_COM:
bx_tail(t->operand[0].oprval.tref , !sense, addr);
bx_tail(t->operand[0].oprval.tref, !sense, addr);
t->opcode = OC_NOOP;
t->operand[0].oprclass = 0;
return;
case OC_NEQU:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_EQU:
bx_relop(t, OC_EQU, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break;
case OC_NPATTERN:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_PATTERN:
bx_relop(t, OC_PATTERN, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break;
case OC_NFOLLOW:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_FOLLOW:
bx_relop(t, OC_FOLLOW, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break;
case OC_NSORTS_AFTER:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_SORTS_AFTER:
bx_relop(t, OC_SORTS_AFTER, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break;
case OC_NCONTAIN:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_CONTAIN:
bx_relop(t, OC_CONTAIN, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break;
case OC_NGT:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_GT:
bx_relop(t, OC_NUMCMP, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break;
case OC_NLT:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_LT:
bx_relop(t, OC_NUMCMP, sense ? OC_JMPLSS : OC_JMPGEQ, addr);
break;
case OC_NAND:
sense = ! sense;
sense = !sense;
/* caution: fall through */
case OC_AND:
bx_boolop(t, FALSE, sense, sense, addr);
@ -124,7 +124,7 @@ oprtype *addr; address to jmp
GTMASSERT;
}
for (p = t->operand ; p < ARRAYTOP(t->operand); p++)
if (p->oprclass == TRIP_REF)
if (TRIP_REF == p->oprclass)
ex_tail(p);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -20,9 +20,8 @@
#include "mdef.h"
#include "caller_id.h"
caddr_t caller_id(void)
{
return NULL;
return (caddr_t)((INTPTR_T)-1);
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -10,12 +10,11 @@
****************************************************************/
#ifndef CALLG_H
#define CALLG_H
#include "fgncalsp.h"
typedef struct gparam_list_struct
{
intszofptr_t n;
void *arg[MAXIMUM_PARAMETERS];
void *arg[MAX_ACTUALS];
} gparam_list;
typedef INTPTR_T (*callgfnptr)(intszofptr_t cnt, ...);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2003, 2010 Fidelity Information Services, Inc *
* Copyright 2003, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -92,3 +92,7 @@ CDB_SC_LCHAR_ENTRY(cdb_sc_crbtmismatch, TRUE, 'k') /* 'k' cr->blk and bt->
CDB_SC_LCHAR_ENTRY(cdb_sc_phase2waitfail, TRUE, 'l') /* 'l' wcs_phase2_commit_wait timed out when called from t_qread */
CDB_SC_LCHAR_ENTRY(cdb_sc_inhibitkills, FALSE, 'm') /* 'm' t_end/tp_tend found inhibit_kills counter greater than zero */
CDB_SC_LCHAR_ENTRY(cdb_sc_triggermod, FALSE, 'n') /* 'n' csd->db_trigger_cycle changed since start of of transaction */
CDB_SC_LCHAR_ENTRY(cdb_sc_onln_rlbk1, FALSE, 'o') /* 'o' csa->onln_rlbk_cycle changed since start of transaction */
CDB_SC_LCHAR_ENTRY(cdb_sc_onln_rlbk2, FALSE, 'p') /* 'p' csa->db_onln_rlbkd_cycle changed since start of transaction */
CDB_SC_LCHAR_ENTRY(cdb_sc_truncate, FALSE, 'q') /* 'q' t_end or tp_tend (bg) - found the database truncated where it wanted to allocate blocks */
CDB_SC_LCHAR_ENTRY(cdb_sc_gvtrootmod, FALSE, 'r') /* 'r' gvcst_kill found a need to redo the gvcst_root_search */

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -21,6 +21,8 @@
#include "cdbg_dump.h"
#include "stringpool.h"
#include "cache.h"
#include "gtmio.h"
#include "have_crit.h"
LITDEF char *oprtype_names[] =
{
@ -100,7 +102,7 @@ void cdbg_dump_triple(triple *dtrip, int indent)
cdbg_dump_operand(indent + 1, &dtrip->operand[1], OP_1);
if (dtrip->destination.oprclass)
cdbg_dump_operand(indent + 1, &dtrip->destination, OP_DEST);
fflush(stdout);
FFLUSH(stdout);
}
void cdbg_dump_shrunk_triple(triple *dtrip, int old_size, int new_size)
@ -109,7 +111,7 @@ void cdbg_dump_shrunk_triple(triple *dtrip, int old_size, int new_size)
oc_tab_graphic[dtrip->opcode], (long unsigned int) dtrip, (long unsigned int) dtrip->exorder.fl,
(long unsigned int) dtrip->exorder.bl, dtrip->src.line, dtrip->src.column, dtrip->rtaddr);
PRINTF(" old size: %d new size: %d shrinkage: %d\n", old_size, new_size, (old_size - new_size));
fflush(stdout);
FFLUSH(stdout);
}
void cdbg_dump_operand(int indent, oprtype *opr, int opnum)
@ -127,7 +129,7 @@ void cdbg_dump_operand(int indent, oprtype *opr, int opnum)
PRINTF("%s ** Warning ** Null opr passed as operand\n", cdbg_indent(indent));
if (!opr->oprclass)
{
fflush(stdout);
FFLUSH(stdout);
return;
}
/* We have a real oprclass, dump it's info */
@ -225,7 +227,7 @@ void cdbg_dump_operand(int indent, oprtype *opr, int opnum)
default:
PRINTF("%s %s bogus reference\n", cdbg_indent(indent), oprtype_type_names[opr->oprclass]);
}
fflush(stdout);
FFLUSH(stdout);
}
void cdbg_dump_mval(int indent, mval *mv)
@ -253,7 +255,7 @@ void cdbg_dump_mval(int indent, mval *mv)
if (!first)
PRINTF(", ");
PRINTF("String");
fflush(stdout);
FFLUSH(stdout);
first = FALSE;
}
if (first)
@ -281,7 +283,7 @@ void cdbg_dump_mval(int indent, mval *mv)
else
cdbg_dump_mstr(indent, &mv->str);
}
fflush(stdout);
FFLUSH(stdout);
}
/* Dump value of a given mstr. Assumes length is non-zero */
@ -307,7 +309,7 @@ void cdbg_dump_mstr(int indent, mstr *ms)
memcpy(buffer, strp, len);
buffer[len] = 0;
PRINTF("%s String value: %s\n", cdbg_indent(indent), buffer);
fflush(stdout);
FFLUSH(stdout);
free(buffer);
}
@ -321,7 +323,7 @@ char *cdbg_indent(int indent)
indent_str = malloc(MAX_INDENT);
if (MAX_INDENT < indent * 2)
{
fflush(stdout);
FFLUSH(stdout);
GTMASSERT;
}
if (indent > last_indent)

View File

@ -37,9 +37,14 @@
# error UNSUPPORTED PLATFORM
#endif
GBLREF char window_token;
GBLREF mident window_ident;
GBLREF triple *curtchain, *curr_fetch_trip;
GBLREF triple *curr_fetch_trip;
error_def(ERR_CMD);
error_def(ERR_CNOTONSYS);
error_def(ERR_EXPR);
error_def(ERR_INVCMD);
error_def(ERR_PCONDEXPECTED);
error_def(ERR_SPOREOL);
int cmd(void)
{ /* All the commands are listed here. Two pairs of entries in general.
@ -86,6 +91,7 @@ LITDEF nametabent cmd_names[] =
,{2, "ZH"}
,{5, "ZHALT"}
,{5, "ZHELP"}
,{7, "ZINVCMD"}
,{2, "ZK"}, {5, "ZKILL"}
,{2, "ZL"}, {5, "ZLINK"}
,{2, "ZM"}, {8, "ZMESSAGE"}
@ -124,7 +130,7 @@ LITDEF unsigned char cmd_index[27] =
{
0, 0, 2, 4, 6, 8, 10, 12, 15, 17, 19, 21, 23
,25, 27, 29, 29, 31, 33, 35, 43, 45, 47, 49
,51, 51, GTMTRIG_ONLY(95) NON_GTMTRIG_ONLY(93)
,51, 51, GTMTRIG_ONLY(96) NON_GTMTRIG_ONLY(94)
};
LITDEF struct
{
@ -174,6 +180,7 @@ LITDEF struct
,{m_zhelp, 1, 1, ALL_SYS}
,{m_zhalt, 1, 1, ALL_SYS}
,{m_zhelp, 1, 1, ALL_SYS}
,{m_zinvcmd, 1, 1, ALL_SYS}
,{m_zwithdraw, 0, 1, ALL_SYS}, {m_zwithdraw, 0, 1, ALL_SYS}
,{m_zlink, 1, 1, ALL_SYS}, {m_zlink, 1, 1, ALL_SYS}
,{m_zmessage, 0, 1, ALL_SYS}, {m_zmessage, 0, 1, ALL_SYS}
@ -193,37 +200,32 @@ LITDEF struct
triple *temp_expr_start, *ref0, *ref1, *fetch0, *triptr;
char *c;
int x;
int rval, x;
oprtype *cr;
boolean_t rval, shifting;
error_def(ERR_CMD);
error_def(ERR_INVCMD);
error_def(ERR_PCONDEXPECTED);
error_def(ERR_SPOREOL);
error_def(ERR_EXPR);
error_def(ERR_CNOTONSYS);
boolean_t shifting;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(cmd_index[26] == (SIZEOF(cmd_names)/SIZEOF(nametabent)));
CHKTCHAIN(curtchain);
TREF(pos_in_chain) = *curtchain;
if (window_token != TK_IDENT)
assert((SIZEOF(cmd_names) / SIZEOF(nametabent)) == cmd_index[26]);
CHKTCHAIN(TREF(curtchain));
TREF(pos_in_chain) = *TREF(curtchain);
if (TREF(window_token) != TK_IDENT)
{
stx_error(ERR_CMD);
return FALSE;
}
assert(0 != window_ident.len);
c = window_ident.addr;
if (*c == '%')
assert(0 != (TREF(window_ident)).len);
c = (TREF(window_ident)).addr;
if ('%' == *c)
{
stx_error(ERR_CMD);
return FALSE;
}
if ((x = namelook(cmd_index, cmd_names, c, window_ident.len)) < 0)
if (0 > (x = namelook(cmd_index, cmd_names, c, (TREF(window_ident)).len)))
{
stx_error(ERR_INVCMD);
return FALSE;
if (0 > (x = namelook(cmd_index, cmd_names, "ZINVCMD", 7)))
return FALSE;
}
if (!VALID_CMD(x) )
{
@ -231,13 +233,13 @@ LITDEF struct
return FALSE;
}
advancewindow();
if (window_token != TK_COLON || !cmd_data[x].pcnd_ok)
if ((TK_COLON != TREF(window_token)) || !cmd_data[x].pcnd_ok)
cr = NULL;
else
{
advancewindow();
cr = (oprtype *)mcalloc(SIZEOF(oprtype));
if (!bool_expr((bool) FALSE,cr))
if (!bool_expr(FALSE, cr))
{
stx_error(ERR_PCONDEXPECTED);
return FALSE;
@ -249,9 +251,9 @@ LITDEF struct
triptr->operand[0] = put_tref(temp_expr_start);
}
}
if (window_token == TK_SPACE)
if (TK_SPACE == TREF(window_token))
advancewindow();
else if (window_token != TK_EOL || !cmd_data[x].eol_ok)
else if ((TK_EOL != TREF(window_token)) || !cmd_data[x].eol_ok)
{
stx_error(ERR_SPOREOL);
return FALSE;
@ -259,24 +261,23 @@ LITDEF struct
fetch0 = curr_fetch_trip;
for (;;)
{
rval = (*cmd_data[x].fcn)();
if (!rval || window_token != TK_COMMA)
if ((EXPR_FAIL == (rval = (*cmd_data[x].fcn)())) || (TK_COMMA != TREF(window_token))) /* NOTE assignment */
break;
else
{ advancewindow();
if (window_token == TK_SPACE || window_token == TK_EOL)
if ((TK_SPACE == TREF(window_token)) || (TK_EOL == TREF(window_token)))
{
stx_error(ERR_EXPR);
return FALSE;
}
}
}
if (rval && cr)
if ((EXPR_FAIL != rval) && cr)
{
if (fetch0 != curr_fetch_trip)
{
assert (curr_fetch_trip->opcode == OC_FETCH);
*cr = put_tjmp(curtchain->exorder.bl);
assert(OC_FETCH == curr_fetch_trip->opcode);
*cr = put_tjmp((TREF(curtchain))->exorder.bl);
} else
{
if (shifting)
@ -290,5 +291,7 @@ LITDEF struct
tnxtarg(cr);
}
}
if (!cr && (m_zinvcmd == cmd_data[x].fcn))
return FALSE;
return rval;
}

View File

@ -51,6 +51,7 @@ int m_zedit(void);
int m_zgoto(void);
int m_zhalt(void);
int m_zhelp(void);
int m_zinvcmd(void);
int m_zlink(void);
int m_zmessage(void);
int m_zprint(void);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2007 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -21,8 +21,6 @@
#include "emit_code.h"
#include "dumptable.h"
GBLDEF int4 codegen_padlen; /* pad code to section alignment */
LITREF octabstruct oc_tab[]; /* op-code table */
GBLREF triple t_orig; /* head of triples */
GBLREF char cg_phase; /* code generation phase */
@ -30,27 +28,28 @@ GBLREF int4 curr_addr; /* current address */
GBLREF src_line_struct src_head;
GBLREF short source_column,source_line;
GBLREF int4 pending_errtriplecode; /* if non-zero contains the error code to invoke ins_errtriple with */
GBLREF triple *curtchain;
void code_gen(void)
{
int4 old_line, pad_len;
triple *ct; /* current triple */
src_line_struct *sl;
triple *ct; /* current triple */
DCL_THREADGBL_ACCESS;
if (cg_phase == CGP_ASSEMBLY)
SETUP_THREADGBL_ACCESS;
if (CGP_ASSEMBLY == cg_phase)
{
curr_addr = t_orig.exorder.fl->rtaddr;
old_line = -1;
}
assert(0 == pending_errtriplecode); /* we should never have a pending ins_errtriple at this point */
assert(curtchain == &t_orig); /* curtchain should still be pointing to what it was originally */
assert(&t_orig == TREF(curtchain)); /* curtchain should still be pointing to what it was originally */
DEBUG_ONLY(chktchain(&t_orig)); /* if this assert fails, then recompile with DEBUG_TRIPLES to catch the issue sooner */
dqloop(&t_orig, exorder, ct)
{
if (cg_phase == CGP_APPROX_ADDR)
if (CGP_APPROX_ADDR == cg_phase)
ct->rtaddr = curr_addr;
else if (cg_phase == CGP_ASSEMBLY)
else if (CGP_ASSEMBLY == cg_phase)
{
if (ct->src.line != old_line)
{
@ -67,31 +66,27 @@ void code_gen(void)
}
source_line = ct->src.line;
source_column = ct->src.column;
if (!(oc_tab[ct->opcode].octype & OCT_CGSKIP))
trip_gen(ct);
}/* dqloop */
#ifdef _AIX
emit_epilog();
#endif
/* The code section needs to be padded so the next section (variable name table) can be optimally aligned
for use by the hashing functions (ex use 8 byte loads on alpha requires 8 byte alignment). We compute the
pad length and record it and add it to the code size. Later when the code is optimized, the pad length
will be subtracted back out, rechecked for padding and an appropriate pad length recomputed.
*/
if (CGP_APPROX_ADDR == cg_phase)
codegen_padlen = PADLEN(curr_addr, SECTION_ALIGN_BOUNDARY); /* Length to pad to align next section */
if (codegen_padlen)
TREF(codegen_padlen) = PADLEN(curr_addr, SECTION_ALIGN_BOUNDARY); /* Length to pad to align next section */
if (TREF(codegen_padlen))
{
assert(STR_LIT_LEN(PADCHARS) >= codegen_padlen);
assert(STR_LIT_LEN(PADCHARS) >= TREF(codegen_padlen));
if (CGP_MACHINE == cg_phase)
emit_immed(PADCHARS, codegen_padlen); /* Pad out with extraneous info */
emit_immed(PADCHARS, TREF(codegen_padlen)); /* Pad out with extraneous info */
else
curr_addr += codegen_padlen;
curr_addr += TREF(codegen_padlen);
}
if (cg_phase == CGP_ASSEMBLY)
if (CGP_ASSEMBLY == cg_phase)
dumptable();
}/* code_gen */

View File

@ -31,11 +31,10 @@ GBLREF spdesc stringpool, rts_stringpool, indr_stringpool;
GBLREF short int source_column;
GBLREF char cg_phase;
GBLREF unsigned char *source_buffer;
GBLREF char window_token;
error_def(ERR_INDEXTRACHARS);
int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len_t src_len)
int comp_fini(int status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len_t src_len)
{
triple *ref;
DCL_THREADGBL_ACCESS;
@ -43,11 +42,11 @@ int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len
SETUP_THREADGBL_ACCESS;
if (status)
{
while (TK_SPACE == window_token) /* Eat up trailing white space */
while (TK_SPACE == TREF(window_token)) /* Eat up trailing white space */
advancewindow();
if (source_column != src_len + 2 && source_buffer[source_column] != '\0')
if (((src_len + 2) != source_column) && ('\0' != source_buffer[source_column]))
{
status = FALSE;
status = EXPR_FAIL;
stx_error(ERR_INDEXTRACHARS);
} else
{
@ -77,7 +76,7 @@ int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len
indr_stringpool.free = indr_stringpool.base;
}
}
if (!status)
if (EXPR_FAIL == status)
{
assert(indr_stringpool.base == stringpool.base);
indr_stringpool = stringpool;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -34,7 +34,7 @@ GBLREF boolean_t is_tracing_on;
error_def(ERR_STACKCRIT);
error_def(ERR_STACKOFLOW);
void comp_indr (mstr *obj)
void comp_indr(mstr *obj)
{
stack_frame *sf;
unsigned char *fix, *fix_base, *tmps, *syms, *save_msp;
@ -46,10 +46,8 @@ void comp_indr (mstr *obj)
save_msp = msp;
sf = (stack_frame *)(msp -= SIZEOF(stack_frame));
rtnhdr = (ihdtyp *)obj->addr;
/* Check that our cache_entry pointer is in proper alignment with us */
assert(rtnhdr->indce->obj.addr == (char *)rtnhdr);
tempsz = ROUND_UP2(rtnhdr->temp_size, SIZEOF(char *));
tmps = msp -= tempsz;
vartabsz = rtnhdr->vartab_len;
@ -59,13 +57,12 @@ void comp_indr (mstr *obj)
{
if (msp <= stacktop)
{
msp = save_msp;
msp = save_msp;
rts_error(VARLSTCNT(1) ERR_STACKOFLOW);
} else
rts_error(VARLSTCNT(1) ERR_STACKCRIT);
}
syms = msp;
*sf = *frame_pointer;
sf->old_frame_pointer = frame_pointer;
sf->type = 0;
@ -74,16 +71,18 @@ void comp_indr (mstr *obj)
sf->vartab_len = rtnhdr->vartab_len;
if (zapsz = (vartabsz + tempsz)) /* Note assignment */
memset(syms, 0, zapsz); /* Zap temps and symtab together */
sf->vartab_ptr = (char *)rtnhdr + rtnhdr->vartab_off;
sf->temp_mvals = rtnhdr->temp_mvals;
/* Code starts just past the literals that were fixed up and past the validation and hdr offset fields */
sf->mpc = (unsigned char *)rtnhdr + rtnhdr->fixup_vals_off + (rtnhdr->fixup_vals_num * SIZEOF(mval));
/* IA64 required SECTION_ALIGN_BOUNDARY alignment (16 bytes). ABS 2008/12
This has been carried forward to other 64bit platfoms without problems */
GTM64_ONLY(sf->mpc = (unsigned char *)ROUND_UP2((UINTPTR_T)sf->mpc, SECTION_ALIGN_BOUNDARY));
* This has been carried forward to other 64bit platfoms without problems
*/
GTM64_ONLY(sf->mpc = (unsigned char *)ROUND_UP2((UINTPTR_T)sf->mpc, SECTION_ALIGN_BOUNDARY));
sf->mpc = sf->mpc + (2 * SIZEOF(INTPTR_T)); /* Account for hdroffset and MAGIC_VALUE */
sf->flags = SFF_INDCE; /* We will be needing cleanup for this frame */
sf->ret_value = NULL;
sf->dollar_test = -1; /* initialize it with -1 for indication of not yet being used */
DEBUG_ONLY(
vp = (INTPTR_T *)sf->mpc;
assert(NULL != vp);
@ -93,7 +92,6 @@ void comp_indr (mstr *obj)
assert((unsigned char*)rtnhdr == (unsigned char *)vp + *vp);
);
rtnhdr->indce->refcnt++; /* This entry is now in use on M stack */
if (is_tracing_on)
new_prof_frame(FALSE);
sf->ctxt = sf->mpc;

View File

@ -19,25 +19,27 @@
#include "advancewindow.h"
#include "compile_pattern.h"
#include "patcode.h"
#include "fullbool.h"
GBLREF spdesc stringpool;
GBLREF char *lexical_ptr;
GBLREF unsigned char *source_buffer;
GBLREF short int source_column;
int compile_pattern(oprtype *opr, bool is_indirect)
int compile_pattern(oprtype *opr, boolean_t is_indirect)
{
int status;
ptstr retstr;
mval retmval;
mstr instr;
int status;
triple *oldchain, tmpchain, *ref, *triptr;
triple *oldchain, *ref, tmpchain, *triptr;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (is_indirect)
{
if (TREF(shift_side_effects))
TREF(saw_side_effect) = TREF(shift_side_effects);
if (TREF(shift_side_effects) && (GTM_BOOL == TREF(gtm_fullbool)))
{
dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2002 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -12,6 +12,6 @@
#ifndef __COMPILE_PATTERN_H__
#define __COMPILE_PATTERN_H__
int compile_pattern(oprtype *z, bool is_indirect);
int compile_pattern(oprtype *z, boolean_t is_indirect);
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -162,7 +162,6 @@ typedef struct
#define OCT_CGSKIP 128
#define OCT_COERCE 256
typedef struct
{
char name[20];
@ -190,13 +189,17 @@ typedef struct
# error UNSUPPORTED PLATFORM
#endif
#define EXPR_FAIL 0 /* expression had syntax error */
#define EXPR_GOOD 1 /* expression ok, no indirection at root */
#define MUMPS_INT 0 /* integer - they only type the compiler handles differently */
#define MUMPS_EXPR 1 /* expression */
#define MUMPS_STR 2 /* string */
#define MUMPS_NUM 3 /* numeric - potentially non-integer */
#define EXPR_FAIL 0 /* expression had syntax error - frequently represented by FALSE*/
#define EXPR_GOOD 1 /* expression ok, no indirection at root - frequently represented by TRUE */
#define EXPR_INDR 2 /* expression ok, indirection at root */
#define EXPR_SHFT 4 /* expression ok, involved shifted GV references */
#define CHARMAXARGS 256
#define MAX_ACTUALS 32
#define MAX_FORARGS 127
#define MAX_SRCLINE 8192 /* maximum length of a program source or indirection line */
#define NO_FORMALLIST (-1)
@ -357,14 +360,14 @@ error_def(ERR_SVNOSET);
#define TRUE_WITH_INDX 2
int actuallist(oprtype *opr);
int bool_expr(bool op, oprtype *addr);
void bx_boolop(triple *t, bool jmp_type_one, bool jmp_to_next, bool sense, oprtype *addr);
int bool_expr(boolean_t op, oprtype *addr);
void bx_boolop(triple *t, boolean_t jmp_type_one, boolean_t jmp_to_next, boolean_t sense, oprtype *addr);
void bx_relop(triple *t, opctype cmp, opctype tst, oprtype *addr);
void bx_tail(triple *t, bool sense, oprtype *addr);
void bx_tail(triple *t, boolean_t sense, oprtype *addr);
void chktchain(triple *head);
void code_gen(void);
void coerce(oprtype *a, unsigned short new_type);
int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len_t src_len);
int comp_fini(int status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len_t src_len);
void comp_init(mstr *src);
void comp_indr(mstr *obj);
boolean_t compiler_startup(void);
@ -373,7 +376,7 @@ int eval_expr(oprtype *a);
int expratom(oprtype *a);
int exfunc(oprtype *a, boolean_t alias_target);
int expritem(oprtype *a);
int expr(oprtype *a);
int expr(oprtype *a, int m_type);
void ex_tail(oprtype *opr);
int extern_func(oprtype *a);
int f_ascii(oprtype *a, opctype op);
@ -437,21 +440,19 @@ int gvn(void);
void ind_code(mstr *obj);
int indirection(oprtype *a);
void ins_triple(triple *x);
int intexpr(oprtype *a);
void int_label(void);
int jobparameters (oprtype *c);
boolean_t line(uint4 *lnc);
int linetail(void);
int lkglvn(bool gblvn);
int lref(oprtype *label, oprtype *offset, bool no_lab_ok, mint commarg_code, bool commarg_ok, bool *got_some);
int lkglvn(boolean_t gblvn);
int lref(oprtype *label, oprtype *offset, boolean_t no_lab_ok, mint commarg_code, boolean_t commarg_ok, boolean_t *got_some);
int lvn(oprtype *a,opctype index_op,triple *parent);
void make_commarg(oprtype *x, mint ind);
oprtype make_gvsubsc(mval *v);
triple *maketriple(opctype op);
int name_glvn(bool gblvn, oprtype *a);
int name_glvn(boolean_t gblvn, oprtype *a);
triple *newtriple(opctype op);
int nref(void);
int numexpr(oprtype *a);
void obj_code(uint4 src_lines, uint4 checksum);
int one_job_param(char **parptr);
int parse_until_rparen_or_space(void);
@ -481,7 +482,6 @@ void shrink_jmps(void);
# endif
void start_fetches(opctype op);
void start_for_fetches(void);
int strexpr(oprtype *a);
void tnxtarg(oprtype *a);
void tripinit(void);
void walktree(mvar *n,void (*f)(),char *arg);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -27,16 +27,18 @@ GBLREF command_qualifier cmd_qlf;
GBLREF char cg_phase;
GBLREF boolean_t mstr_native_align, save_mstr_native_align;
error_def(ERR_ASSERT);
error_def(ERR_FORCEDHALT);
error_def(ERR_GTMASSERT);
error_def(ERR_GTMASSERT2);
error_def(ERR_GTMCHECK);
error_def(ERR_MEMORY);
error_def(ERR_VMSMEMORY);
error_def(ERR_STACKOFLOW);
error_def(ERR_OUTOFSPACE);
CONDITION_HANDLER(compiler_ch)
{
error_def(ERR_ASSERT);
error_def(ERR_FORCEDHALT);
error_def(ERR_GTMASSERT);
error_def(ERR_GTMCHECK);
error_def(ERR_MEMORY);
error_def(ERR_VMSMEMORY);
error_def(ERR_STACKOFLOW);
error_def(ERR_OUTOFSPACE);
START_CH;
if (DUMPABLE)

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -26,11 +26,11 @@ error_def(ERR_STACKOFLOW);
void copy_stack_frame(void)
{
register stack_frame *sf;
unsigned char *msp_save;
register stack_frame *sf;
unsigned char *msp_save;
msp_save = msp;
sf = (stack_frame *) (msp -= SIZEOF(stack_frame));
sf = (stack_frame *)(msp -= SIZEOF(stack_frame));
if (msp <= stackwarn)
{
if (msp <= stacktop)
@ -46,6 +46,8 @@ void copy_stack_frame(void)
sf->old_frame_pointer = frame_pointer;
sf->flags = 0; /* Don't propagate special flags */
sf->for_ctrl_stack = NULL;
sf->ret_value = NULL;
sf->dollar_test = -1; /* initialize it with -1 for indication of not yet being used */
frame_pointer = sf;
DBGEHND((stderr, "copy_stack_frame: Added stackframe at addr 0x"lvaddr" old-msp: 0x"lvaddr" new-msp: 0x"lvaddr"\n",
sf, msp_save, msp));

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2003, 2011 Fidelity Information Services, Inc *
* Copyright 2003, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -94,6 +94,15 @@ GBLREF jnl_gbls_t jgbl;
GBLREF boolean_t mupip_jnl_recover;
GBLREF jnl_process_vector *prc_vec;
ZOS_ONLY(error_def(ERR_BADTAG);)
error_def(ERR_FILERENAME);
error_def(ERR_JNLCRESTATUS);
error_def(ERR_JNLFNF);
error_def(ERR_PERMGENFAIL);
error_def(ERR_PREMATEOF);
error_def(ERR_RENAMEFAIL);
error_def(ERR_TEXT);
/* Create a journal file from info.
* If necessary, it renames journal file of same name.
* Note: jgbl.gbl_jrec_time must be set by callers
@ -104,8 +113,6 @@ uint4 cre_jnl_file(jnl_create_info *info)
int org_fn_len, rename_fn_len, fstat;
uint4 ustatus;
char *org_fn, rename_fn[MAX_FN_LEN];
error_def (ERR_JNLCRESTATUS);
error_def (ERR_JNLFNF);
if (!info->no_rename) /* ***MAY*** be rename is required */
{
@ -177,18 +184,13 @@ uint4 cre_jnl_file_common(jnl_create_info *info, char *rename_fn, int rename_fn_
int group_id;
struct stat sb;
int perm;
struct perm_diag_data pdd;
#endif
int idx;
trans_num db_tn;
uint4 temp_offset, temp_checksum;
uint4 jnl_fs_block_size;
error_def(ERR_FILERENAME);
error_def(ERR_RENAMEFAIL);
error_def(ERR_JNLCRESTATUS);
error_def(ERR_PREMATEOF);
error_def(ERR_TEXT);
ZOS_ONLY(error_def(ERR_BADTAG);)
jrecbuf = NULL;
if (info->no_rename)
{ /* The only cases where no-renaming is possible are as follows
@ -242,9 +244,23 @@ uint4 cre_jnl_file_common(jnl_create_info *info, char *rename_fn, int rename_fn_
return EXIT_ERR;
}
/* setup new group and permissions if indicated by the security rules.
* Use 0770 anded with current mode for the new mode if it is world writeable.
*/
gtm_set_group_and_perm(&sb, &group_id, &perm, (0770 & sb.st_mode));
if (gtm_set_group_and_perm(&sb, &group_id, &perm, PERM_FILE, &pdd) < 0)
{
send_msg(VARLSTCNT(6+PERMGENDIAG_ARG_COUNT)
ERR_PERMGENFAIL, 4, RTS_ERROR_STRING("journal file"), RTS_ERROR_STRING(info->fn),
PERMGENDIAG_ARGS(pdd));
if (IS_GTM_IMAGE)
rts_error(VARLSTCNT(6+PERMGENDIAG_ARG_COUNT)
ERR_PERMGENFAIL, 4, RTS_ERROR_STRING("journal file"), RTS_ERROR_STRING(info->fn),
PERMGENDIAG_ARGS(pdd));
else
gtm_putmsg(VARLSTCNT(6+PERMGENDIAG_ARG_COUNT)
ERR_PERMGENFAIL, 4, RTS_ERROR_STRING("journal file"), RTS_ERROR_STRING(info->fn),
PERMGENDIAG_ARGS(pdd));
F_CLOSE(channel, status);
return EXIT_ERR;
}
/* if group not the same then change group of temporary file */
if ((-1 != group_id) && (group_id != stat_buf.st_gid) && (-1 == fchown(channel, -1, group_id)))
{
@ -365,11 +381,24 @@ uint4 cre_jnl_file_common(jnl_create_info *info, char *rename_fn, int rename_fn_
epoch_record->blks_to_upgrd = info->blks_to_upgrd;
epoch_record->free_blocks = info->free_blocks;
epoch_record->total_blks = info->total_blks;
epoch_record->fully_upgraded = info->csd->fully_upgraded;
temp_offset = JNL_HDR_LEN + PINI_RECLEN;
temp_checksum = ADJUST_CHECKSUM(INIT_CHECKSUM_SEED, temp_offset);
epoch_record->prefix.checksum = ADJUST_CHECKSUM(temp_checksum, info->checksum);
epoch_record->suffix.suffix_code = JNL_REC_SUFFIX_CODE;
QWASSIGN(epoch_record->jnl_seqno, info->reg_seqno);
epoch_record->jnl_seqno = info->reg_seqno;
UNIX_ONLY(
for (idx = 0; idx < MAX_SUPPL_STRMS; idx++)
epoch_record->strm_seqno[idx] = info->csd->strm_reg_seqno[idx];
if (jgbl.forw_phase_recovery)
{ /* If MUPIP JOURNAL -ROLLBACK, might need some adjustment. See macro definition for comments */
MUR_ADJUST_STRM_REG_SEQNO_IF_NEEDED(info->csd, epoch_record->strm_seqno);
}
)
VMS_ONLY(
for (idx = 0; idx < MAX_SUPPL_STRMS; idx++)
assert(0 == epoch_record->strm_seqno[idx]); /* should have been zeroed already by above memset */
)
pfin_record = (struct_jrec_pfin *)&jrecbuf[PINI_RECLEN + EPOCH_RECLEN];
temp_offset = JNL_HDR_LEN + PINI_RECLEN + EPOCH_RECLEN;
temp_checksum = ADJUST_CHECKSUM(INIT_CHECKSUM_SEED, temp_offset);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -23,10 +23,13 @@ GBLREF boolean_t cw_stagnate_reinitialized;
#define CWS_INITIAL_SIZE 4
/* Initialize the cw_stagnate hash-table */
#define CWS_INIT \
{ \
init_hashtab_int4(&cw_stagnate, CWS_INITIAL_SIZE, HASHTAB_COMPACT, HASHTAB_SPARE_TABLE); \
cw_stagnate_reinitialized = TRUE; \
#define CWS_INIT \
{ \
if (0 == cw_stagnate.size) \
{ \
init_hashtab_int4(&cw_stagnate, CWS_INITIAL_SIZE, HASHTAB_COMPACT, HASHTAB_SPARE_TABLE); \
cw_stagnate_reinitialized = TRUE; \
} \
}
/* macro CWS_INSERT appends a block_id onto an hashtable of block_id's

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -55,20 +55,20 @@ void db_auto_upgrade(gd_region *reg)
/* zero is a legitimate value for csd->mutex_spin_parms.mutex_spin_sleep_mask; so can't detect if need re-initialization */
/* Auto upgrade based on minor database version number. This code currently only does auto upgrade and does not
do auto downgrade although that certainly is possible to implement if necessary. For now, if the current version
is at a lower level than the minor db version, we do nothing.
Note the purpose of the minor_dbver field is so that some part of gtm (either runtime, or conversion utility) some
time and several versions down the road from now knows by looking at this field what fields in the fileheader are
valid so it is important that the minor db version be updated each time the fileheader is updated and this routine
correspondingly updated. SE 5/2006.
*/
* do auto downgrade although that certainly is possible to implement if necessary. For now, if the current version
* is at a lower level than the minor db version, we do nothing.
*
* Note the purpose of the minor_dbver field is so that some part of gtm (either runtime, or conversion utility) some
* time and several versions down the road from now knows by looking at this field what fields in the fileheader are
* valid so it is important that the minor db version be updated each time the fileheader is updated and this routine
* correspondingly updated. SE 5/2006.
*/
if (csd->minor_dbver < GDSMVCURR)
{ /* In general, the method for adding new versions is:
1) If there are no automatic updates for this version, it is optional to add the version to the switch
statement below. Those there are more for example at this time (through V53000).
2) Update (or add) a case for the previous version to update any necessary fields.
*/
* 1) If there are no automatic updates for this version, it is optional to add the version to the switch
* statement below. Those there are more for example at this time (through V53000).
* 2) Update (or add) a case for the previous version to update any necessary fields.
*/
if (!csd->opened_by_gtmv53 && !csd->db_got_to_v5_once)
{
csd->opened_by_gtmv53 = TRUE;
@ -103,15 +103,28 @@ void db_auto_upgrade(gd_region *reg)
* e) Add assert(FALSE) and break (like it was before)
*/
switch(csd->minor_dbver)
{
{ /* Note that handling for any fields introduced in a version will not go in the "switch-case" block
* of code introduced for the new version but will go in the PREVIOUS "switch-case" block.
*/
case GDSMV51000: /* Multi-site replication available */
case GDSMV52000: /* Unicode */
case GDSMV53000: /* M-Itanium release */
gvstats_rec_upgrade(csa); /* Move GVSTATS information to new place in file header */
case GDSMV54002: /* Backward recovery related fields */
case GDSMV54002:
/* GT.M V54002B introduced jnl_eov_tn for backward recovery */
csd->jnl_eovtn = csd->trans_hist.curr_tn;
case GDSMV54002B:
/* GT.M V55000 introduced strm_reg_seqno, save_strm_reg_seqno, intrpt_recov_resync_strm_seqno
* AND obsoleted dualsite_resync_seqno. For new fields, we are guaranteed they are
* zero (in formerly unused sections of the file header) so no need for any initialization.
* For obsoleted fields, it would be good to clear them here so we dont run into issues later.
*/
UNIX_ONLY(csd->filler_seqno = 0;) /* was "dualsite_resync_seqno" in pre-V55000 versions */
/* In addition, V55000 introduced before_trunc_total_blks for MUPIP REORG -TRUNCATE.
* Since it is a new field no initialization necessary.
*/
break;
case GDSMV54003:
case GDSMV55000:
/* Nothing to do for this version since it is GDSMVCURR for now. */
assert(FALSE); /* When this assert fails, it means a new GDSMV* was created, */
break; /* so a new "case" needs to be added BEFORE the assert. */

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2007 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -37,9 +37,9 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
cache_rec_ptr_t cr, cr_hash_base;
int blk_hash, lcnt, ocnt, hmax;
bool is_mm;
#ifdef DEBUG
# ifdef DEBUG
cache_rec_ptr_t cr_low, cr_high;
#endif
# endif
csa = cs_addrs;
csd = csa->hdr;
@ -60,11 +60,10 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
cr_hash_base = (cache_rec_ptr_t)(csa->acc_meth.mm.mmblk_state->mmblk_array + blk_hash);
}
ocnt = 0;
csa->wbuf_dqd++; /* Tell rundown we have an orphaned block in case of interrupt */
do
{
cr = cr_hash_base;
assert(cr->blk == BT_QUEHEAD);
assert((0 == cr->blk) || (BT_QUEHEAD == cr->blk));
lcnt = hmax;
do
{
@ -77,10 +76,7 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
* queue changed on us.
*/
if (cr == cr_hash_base)
{
csa->wbuf_dqd--;
return (cache_rec_ptr_t)NULL;
}
break; /* Retry - something changed */
}
if ((CR_BLKEMPTY != cr->blk) && ((cr->blk % hmax) != blk_hash))
@ -99,7 +95,6 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
*/
cr->refer = TRUE;
}
csa->wbuf_dqd--;
return cr;
}
lcnt--;
@ -108,8 +103,6 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
/* We rarely expect to come here, hence it is considered better to recompute the maximum value of ocnt (for the
* termination check) instead of storing it in a local variable at the beginning of the do loop */
} while (ocnt < (csa->now_crit ? 1 : ENOUGH_TRIES_TO_FALL_BACK));
csa->wbuf_dqd--;
BG_TRACE_PRO_ANY(csa, db_csh_get_too_many_loops);
return (TRUE == csa->now_crit ? (cache_rec_ptr_t)CR_NOTVALID : (cache_rec_ptr_t) NULL);
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -14,17 +14,25 @@
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsblk.h"
#include "gdsfhead.h"
#include "interlock.h"
#include "lockconst.h"
#include "longset.h"
#include "relqop.h"
#include "filestruct.h"
#include "jnl.h"
error_def(ERR_WCFAIL);
GBLREF int4 process_id;
void db_csh_ref(sgmnt_addrs *csa)
GBLREF int4 process_id;
#if defined(UNIX) && defined(DEBUG)
GBLREF jnl_gbls_t jgbl;
#endif
/* Refresh the database cache records in the shared memory. If init = TRUE, do the longset and initialize all the latches and
* forward and backward links. If init = FALSE, just increment the cycle and set the blk to CR_BLKEMPTY.
*/
void db_csh_ref(sgmnt_addrs *csa, boolean_t init)
{
sgmnt_data_ptr_t csd;
node_local_ptr_t cnl;
@ -42,35 +50,47 @@ void db_csh_ref(sgmnt_addrs *csa)
is_mm = (dba_mm == csd->acc_meth);
if (!is_mm)
{
longset((uchar_ptr_t)csa->acc_meth.bg.cache_state,
SIZEOF(cache_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(cache_rec),
0); /* -1 since there is a cache_rec in cache_que_heads */
if (init)
{
longset((uchar_ptr_t)csa->acc_meth.bg.cache_state,
SIZEOF(cache_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(cache_rec),
0); /* -1 since there is a cache_rec in cache_que_heads */
SET_LATCH_GLOBAL(&csa->acc_meth.bg.cache_state->cacheq_active.latch, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&csa->acc_meth.bg.cache_state->cacheq_wip.latch, LOCK_AVAILABLE);
}
cr = cr1 = csa->acc_meth.bg.cache_state->cache_array;
buffer_size = csd->blk_size;
assert(buffer_size > 0);
assert(0 == buffer_size % DISK_BLOCK_SIZE);
SET_LATCH_GLOBAL(&csa->acc_meth.bg.cache_state->cacheq_active.latch, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&csa->acc_meth.bg.cache_state->cacheq_wip.latch, LOCK_AVAILABLE);
rec_size = SIZEOF(cache_rec);
} else
{
longset((uchar_ptr_t)csa->acc_meth.mm.mmblk_state,
SIZEOF(mmblk_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(mmblk_rec),
0); /* -1 since there is a mmblk_rec in mmblk_que_heads */
if (init)
{
longset((uchar_ptr_t)csa->acc_meth.mm.mmblk_state,
SIZEOF(mmblk_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(mmblk_rec),
0); /* -1 since there is a mmblk_rec in mmblk_que_heads */
SET_LATCH_GLOBAL(&csa->acc_meth.mm.mmblk_state->mmblkq_active.latch, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&csa->acc_meth.mm.mmblk_state->mmblkq_wip.latch, LOCK_AVAILABLE);
}
cr = cr1 = (cache_rec_ptr_t)csa->acc_meth.mm.mmblk_state->mmblk_array;
SET_LATCH_GLOBAL(&csa->acc_meth.mm.mmblk_state->mmblkq_active.latch, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&csa->acc_meth.mm.mmblk_state->mmblkq_wip.latch, LOCK_AVAILABLE);
rec_size = SIZEOF(mmblk_rec);
}
cnl = csa->nl;
SET_LATCH_GLOBAL(&cnl->wc_var_lock, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&cnl->db_latch, LOCK_AVAILABLE);
if (init)
{
SET_LATCH_GLOBAL(&cnl->wc_var_lock, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&cnl->db_latch, LOCK_AVAILABLE);
}
for (cr_top = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size * csd->bt_buckets);
cr < cr_top; cr = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size))
cr->blk = BT_QUEHEAD;
cr_top = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size * csd->n_bts);
cnl->cur_lru_cache_rec_off = GDS_ANY_ABS2REL(csa, cr);
cnl->cache_hits = 0;
if (init)
{
cnl->cur_lru_cache_rec_off = GDS_ANY_ABS2REL(csa, cr);
cnl->cache_hits = 0;
}
if (!is_mm)
{
bp = (sm_uc_ptr_t)ROUND_UP((sm_ulong_t)cr_top, OS_PAGE_SIZE);
@ -87,24 +107,35 @@ void db_csh_ref(sgmnt_addrs *csa)
for (; cr < cr_top; cr = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size),
cr1 = (cache_rec_ptr_t)((sm_uc_ptr_t)cr1 + rec_size))
{
if (!is_mm)
if (init)
{
INTERLOCK_INIT(cr);
} else
{
INTERLOCK_INIT_MM(cr);
if (!is_mm)
{
INTERLOCK_INIT(cr);
} else
{
INTERLOCK_INIT_MM(cr);
}
}
cr->cycle++; /* increment cycle whenever buffer's blk number changes (for tp_hist) */
cr->blk = CR_BLKEMPTY;
assert(0 == cr->bt_index); /* when cr->blk is empty, ensure no bt points to this cache-record */
if (!is_mm)
/* Typically db_csh_ref is invoked from db_init (when creating shared memory afresh) in which case cr->bt_index
* will be 0 (due to the memset). But, if db_csh_ref is invoked from online rollback where we are invalidating the
* cache but do not do the longset (above), bt_index can be a non-zero value. Assert that and set it to zero since
* we are invalidating the cache record anyways.
*/
assert((0 == cr->bt_index) UNIX_ONLY(|| jgbl.onlnrlbk));
cr->bt_index = 0;
if (init)
{
assert(bp <= bp_top);
cr->buffaddr = GDS_ANY_ABS2REL(csa, bp);
bp += buffer_size;
if (!is_mm)
{
assert(bp <= bp_top);
cr->buffaddr = GDS_ANY_ABS2REL(csa, bp);
bp += buffer_size;
}
insqt((que_ent_ptr_t)cr, (que_ent_ptr_t)cr1);
}
insqt((que_ent_ptr_t)cr, (que_ent_ptr_t)cr1);
cr->refer = FALSE;
}
cnl->wc_in_free = csd->n_bts;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2005, 2009 Fidelity Information Services, Inc *
* Copyright 2005, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -247,7 +247,7 @@ typedef struct
/* Debug macro. This macro is compiled into even the pro-build. It emits the enclosed message if a debug
option has been specified.*/
#define DBC_DEBUG(x) if (psa->dbc_debug) {PRINTF x; fflush(stdout);}
#define DBC_DEBUG(x) if (psa->dbc_debug) {PRINTF x; FFLUSH(stdout);}
/* We need to redefine 2 macros from gdsblkops.h (BLK_INIT and BLK_FINI) because they contain references
to the type blk_hdr which for V5 is a different size than the v15_blk_hdr type we are using for V4 databases.

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2005, 2008 Fidelity Information Services, Inc *
* Copyright 2005, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -39,6 +39,16 @@ GBLREF int4 exi_condition;
GBLREF int4 error_condition;
GBLREF enum gtmImageTypes image_type;
error_def(ERR_ASSERT);
error_def(ERR_GTMASSERT);
error_def(ERR_GTMASSERT2);
error_def(ERR_GTMCHECK);
error_def(ERR_MEMORY);
error_def(ERR_OUTOFSPACE);
error_def(ERR_STACKOFLOW);
error_def(ERR_VMSMEMORY);
VMS_ONLY(error_def(ERR_DBCNOFINISH);)
CONDITION_HANDLER(dbcertify_base_ch)
{
VMS_ONLY(
@ -48,14 +58,6 @@ CONDITION_HANDLER(dbcertify_base_ch)
unsigned char msg_buff[MAX_MSG_SIZE + 1];
$DESCRIPTOR(msgbuf, msg_buff);
)
error_def(ERR_GTMCHECK);
error_def(ERR_ASSERT);
error_def(ERR_GTMASSERT);
error_def(ERR_MEMORY);
error_def(ERR_VMSMEMORY);
error_def(ERR_STACKOFLOW);
error_def(ERR_OUTOFSPACE);
VMS_ONLY(error_def(ERR_DBCNOFINISH);)
START_CH;
PRN_ERROR;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2005, 2009 Fidelity Information Services, Inc *
* Copyright 2005, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -258,7 +258,7 @@ void dbcertify_certify_phase(void)
"- premature exit to main loop\n"));
break;
}
DBC_DEBUG(("DBC_DEBUG: ****************** Reading new p1out record (%d) *****************\n", \
DBC_DEBUG(("DBC_DEBUG: ****************** Reading new p1out record (%d) *****************\n",
(rec_num + 1)));
dbc_read_p1out(psa, &psa->rhdr, SIZEOF(p1rec));
if (0 != psa->rhdr.akey_len)
@ -278,7 +278,7 @@ void dbcertify_certify_phase(void)
++restart_cnt;
if (MAX_RESTART_CNT < restart_cnt)
GTMASSERT; /* No idea what could cause this.. */
DBC_DEBUG(("DBC_DEBUG: ****************** Restarted transaction (%d) *****************\n", \
DBC_DEBUG(("DBC_DEBUG: ****************** Restarted transaction (%d) *****************\n",
(rec_num + 1)));
/* "restart_transaction" is either set or cleared by dbc_split_blk() below */
}
@ -909,7 +909,7 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
/* See if they fit in their respective blocks */
if (level_0 || (new_lh_blk_len <= psa->max_blk_len) && (new_rh_blk_len <= psa->max_blk_len))
{ /* Method 1 - record goes to left-hand side */
DBC_DEBUG(("DBC_DEBUG: Method 1 block lengths: lh: %d rh: %d max_blk_len: %d\n", \
DBC_DEBUG(("DBC_DEBUG: Method 1 block lengths: lh: %d rh: %d max_blk_len: %d\n",
new_lh_blk_len, new_rh_blk_len, psa->max_blk_len));
/* New update array for new block */
if (level_0)
@ -1022,8 +1022,8 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
} else
{ /* Recompute sizes for inserted record being in righthand block as per
method (2) */
DBC_DEBUG(("DBC_DEBUG: Method 1 created invalid blocks: lh: %d rh: %d " \
"max_blk_len: %d -- trying method 2\n", new_lh_blk_len, new_rh_blk_len, \
DBC_DEBUG(("DBC_DEBUG: Method 1 created invalid blocks: lh: %d rh: %d "
"max_blk_len: %d -- trying method 2\n", new_lh_blk_len, new_rh_blk_len,
psa->max_blk_len));
/* By definition we *must* have an inserted record in this path */
assert(0 != ins_rec_len);
@ -1065,7 +1065,7 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
{
if (MAX_RESTART_CNT < restart_cnt)
GTMASSERT; /* No idea what could cause this */
DBC_DEBUG(("DBC_DEBUG: *** *** Recursive call to handle too large block 0x%x\n", \
DBC_DEBUG(("DBC_DEBUG: *** *** Recursive call to handle too large block 0x%x\n",
restart_blk_set.blk_num));
psa->block_depth_hwm = -1; /* Zaps cache so all blocks are re-read */
restart_transaction = dbc_split_blk(psa, restart_blk_set.blk_num,
@ -1074,7 +1074,7 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
}
return TRUE; /* This transaction must restart */
}
DBC_DEBUG(("DBC_DEBUG: Method 2 block lengths: lh: %d rh: %d max_blk_len: %d\n", \
DBC_DEBUG(("DBC_DEBUG: Method 2 block lengths: lh: %d rh: %d max_blk_len: %d\n",
new_lh_blk_len, new_rh_blk_len, psa->max_blk_len));
/* Start building (new) LHS block - for this index record, the record before the split
@ -1326,7 +1326,7 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
}
assert(lcl_blk); /* Shouldn't be zero as that is for the lcl bitmap itself */
allocated_blk_num = psa->hint_blk = bitmap_blk_num + lcl_blk;
DBC_DEBUG(("DBC_DEBUG: -- The newly allocated block for block index %d is 0x%x\n", \
DBC_DEBUG(("DBC_DEBUG: -- The newly allocated block for block index %d is 0x%x\n",
blk_index, allocated_blk_num));
/* Fill this block number in the places it needs to be filled */
assert(-1 == blk_set_p->blk_num);
@ -1345,7 +1345,7 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
blk_sega_p = (blk_segment *)blk_set_p->upd_addr;
if (gdsblk_bitmap == blk_set_p->blk_type || gdsblk_read == blk_set_p->usage)
{ /* Bitmap blocks are updated in place and of course read blocks have no updates */
DBC_DEBUG(("DBC_DEBUG: -- Block index %d bypassed for type (%d) or usage (%d)\n", \
DBC_DEBUG(("DBC_DEBUG: -- Block index %d bypassed for type (%d) or usage (%d)\n",
blk_index, blk_set_p->blk_type, blk_set_p->usage));
assert(NULL == blk_sega_p);
continue;
@ -1395,10 +1395,11 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
blk_set_p->new_buff = blk_set_p->old_buff;
blk_set_p->old_buff = blk_p;
}
DBC_DEBUG(("DBC_DEBUG: -- Block index %d being written as block 0x%x\n", blk_index, \
DBC_DEBUG(("DBC_DEBUG: -- Block index %d being written as block 0x%x\n", blk_index,
blk_set_p->blk_num));
psa->fc->op_buff = blk_set_p->new_buff;
psa->fc->op_pos = psa->dbc_cs_data->start_vbn + (blk_size / DISK_BLOCK_SIZE) * blk_set_p->blk_num;
psa->fc->op_pos = psa->dbc_cs_data->start_vbn
+ ((gtm_int64_t)(blk_size / DISK_BLOCK_SIZE) * blk_set_p->blk_num);
dbcertify_dbfilop(psa);
if (gdsblk_create == blk_set_p->usage)
psa->blks_created++;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2005, 2009 Fidelity Information Services, Inc *
* Copyright 2005, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -128,7 +128,7 @@ void dbc_write_command_file(phase_static_area *psa, char_ptr_t cmd)
{
save_errno = errno;
errmsg = STRERROR(save_errno);
rts_error(VARLSTCNT(11) ERR_SYSCALL, 5, RTS_ERROR_LITERAL("fprintf()"), CALLFROM,
rts_error(VARLSTCNT(11) ERR_SYSCALL, 5, RTS_ERROR_LITERAL("fprintf()"), CALLFROM, /* BYPASSOK */
ERR_TEXT, 2, RTS_ERROR_TEXT(errmsg));
}
rc = CHMOD((char_ptr_t)psa->tmpcmdfile, S_IRUSR + S_IWUSR + S_IXUSR + S_IRGRP + S_IROTH); /* Change to 744 */
@ -546,7 +546,7 @@ int dbc_read_dbblk(phase_static_area *psa, int blk_num, enum gdsblk_type blk_typ
((gdsblk_read == blk_set_p->usage) ? blk_set_p->old_buff : blk_set_p->new_buff),
psa->dbc_cs_data->blk_size);
blk_set_p->blk_num = -1; /* Effectively invalidate this (now) older cache entry */
DBC_DEBUG(("DBC_DEBUG: Found block in inactive cache differemt slot (%d) for blk_index %d\n", \
DBC_DEBUG(("DBC_DEBUG: Found block in inactive cache differemt slot (%d) for blk_index %d\n",
blk_index, psa->block_depth));
} else
{
@ -568,7 +568,7 @@ int dbc_read_dbblk(phase_static_area *psa, int blk_num, enum gdsblk_type blk_typ
correct configuration */
dbc_init_blk(psa, blk_set_p, blk_set_p->blk_num, gdsblk_read, blk_set_p->blk_len,
blk_set_p->blk_levl);
DBC_DEBUG(("DBC_DEBUG: Found block in inactive cache same slot for blk_index" \
DBC_DEBUG(("DBC_DEBUG: Found block in inactive cache same slot for blk_index"
" %d\n", psa->block_depth));
break;
default:
@ -590,7 +590,7 @@ int dbc_read_dbblk(phase_static_area *psa, int blk_num, enum gdsblk_type blk_typ
DBC_DEBUG(("DBC_DEBUG: Reading in database block 0x%x into blk_index %d\n", blk_num, psa->block_depth));
psa->fc->op = FC_READ;
psa->fc->op_buff = (sm_uc_ptr_t)blk_set_new_p->old_buff;
psa->fc->op_pos = psa->dbc_cs_data->start_vbn + (psa->dbc_cs_data->blk_size / DISK_BLOCK_SIZE) * blk_num;
psa->fc->op_pos = psa->dbc_cs_data->start_vbn + ((gtm_int64_t)(psa->dbc_cs_data->blk_size / DISK_BLOCK_SIZE) * blk_num);
psa->fc->op_len = psa->dbc_cs_data->blk_size; /* In case length field was modified during a file-extension */
dbcertify_dbfilop(psa); /* Read data/index block (no return if error) */
/* Now that we know some value, call initialize again to set the values the way we want */
@ -744,7 +744,7 @@ int dbc_find_record(phase_static_area *psa, dbc_gv_key *key, int blk_index, int
" key record\n"));
return blk_index;
}
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Recursing down a level via star key record at offset 0x%lx\n", \
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Recursing down a level via star key record at offset 0x%lx\n",
(rec_p - blk_p)));
GET_ULONG(blk_ptr, rec_p + VMS_ONLY(3) UNIX_ONLY(4));
blk_index = dbc_read_dbblk(psa, blk_ptr, blk_type);
@ -759,7 +759,7 @@ int dbc_find_record(phase_static_area *psa, dbc_gv_key *key, int blk_index, int
{ /* Found our record - If the record is in an index block, recurse. Else return the record we found */
if (gdsblk_gvtleaf == blk_set_p->blk_type || min_levl == blk_levl)
{ /* This is a terminal block. It is the end of the road */
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Reached minimum block level (or leaf level) -- matching" \
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Reached minimum block level (or leaf level) -- matching"
" scan was a normal keyed record at offset 0x%lx\n", (rec_p - blk_p)));
return blk_index;
}
@ -767,7 +767,7 @@ int dbc_find_record(phase_static_area *psa, dbc_gv_key *key, int blk_index, int
this record is known to contain a pointer to another block. Read the block in and
recurse to continue the search for the key.
*/
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Recursing down a level via keyed index record at offset 0x%lx\n", \
DBC_DEBUG(("DBC_DEBUG: dbc_find_record: Recursing down a level via keyed index record at offset 0x%lx\n",
(rec_p - blk_p)));
GET_ULONG(blk_ptr, (rec_p + SIZEOF(rec_hdr) + blk_set_p->curr_blk_key->end
- ((rec_hdr *)rec_p)->cmpc + 1));

View File

@ -12,8 +12,8 @@
#include "mdef.h"
#ifdef VMS
#include "efn.h"
#include <ssdef.h>
# include "efn.h"
# include <ssdef.h>
#endif
#include "xfer_enum.h"
@ -25,11 +25,9 @@
#include "add_inter.h"
#include "op.h"
#include "iott_wrterr.h"
#ifdef DEBUG_DEFERRED
#include "gtm_stdio.h"
#ifdef DEBUG_DEFERRED_EVENT
# include "gtm_stdio.h"
#endif
#include "fix_xfer_entry.h"
/* =============================================================================
@ -39,13 +37,10 @@
/* The transfer table */
GBLREF xfer_entry_t xfer_table[];
/* M Profiling active */
GBLREF boolean_t is_tracing_on;
/* Marks sensitive database operations */
GBLREF volatile int4 fast_lock_count;
#if defined(VMS)
GBLREF volatile short num_deferred;
#else
@ -74,7 +69,6 @@ GBLREF volatile int4 ctrap_action_is, outofband;
* should be in an AST and AST's can't be nested (we assert to that effect
* in xfer_set_handlers). The macro INCR_CNT_SP accomplishes this task for us.
*/
#if defined(UNIX)
volatile int4 xfer_table_events[DEFERRED_EVENTS];
#define INCR_CNT_SP(X,Y) INCR_CNT(X,Y)
@ -129,9 +123,9 @@ boolean_t xfer_set_handlers(int4 event_type, void (*set_fn)(int4 param), int4 p
* ------------------------------------------------------------------
* Use interlocked operations to prevent races between set and reset,
* and to avoid missing overlapping sets.
* On HP:
* On HPUX-HPPA:
* OK only if there's no a risk a conflicting operation is
* in progress (can deadlock).
* in progress (can deadlock in micro-lock).
* On all platforms:
* Don't want I/O from a sensitive area.
* Avoid both by testing fast_lock_count, and doing interlocks and
@ -139,51 +133,30 @@ boolean_t xfer_set_handlers(int4 event_type, void (*set_fn)(int4 param), int4 p
* risk is missing an event when there's already one happening.
* ------------------------------------------------------------------
*/
VMS_ONLY(assert(lib$ast_in_prog()));
if (fast_lock_count == 0)
{
#ifdef DEBUG_DEFERRED
(void) FPRINTF(stderr,
"\nBefore interlocked operations: "
"xfer_table_events[%d]=%d, "
"first_event=%s, "
"num_deferred=%d\n",
event_type,
xfer_table_events[event_type],
(is_first_event?"TRUE":"FALSE"),
num_deferred);
#endif
DBGDFRDEVNT((stderr, "xfer_set_handlers: Before interlocked operations: "
"xfer_table_events[%d]=%d, first_event=%s, num_deferred=%d\n",
event_type, xfer_table_events[event_type], (is_first_event ? "TRUE" : "FALSE"),
num_deferred));
if (1 == INCR_CNT_SP(&xfer_table_events[event_type], &defer_latch))
{
/* Concurrent events can collide here, too */
is_first_event = (1 == INCR_CNT_SP(&num_deferred, &defer_latch));
}
#ifdef DEBUG_DEFERRED
(void) FPRINTF(stderr,
"\nAfter interlocked operations: "
"xfer_table_events[%d]=%d, "
"first_event=%s, "
"num_deferred=%d\n",
event_type,xfer_table_events[event_type],
(is_first_event?"TRUE":"FALSE"),
num_deferred);
#endif
DBGDFRDEVNT((stderr, "xfer_set_handlers: After interlocked operations: "
"xfer_table_events[%d]=%d, first_event=%s, num_deferred=%d\n",
event_type,xfer_table_events[event_type], (is_first_event ? "TRUE" : "FALSE"),
num_deferred));
} else if (1 == ++xfer_table_events[event_type])
is_first_event = (1 == ++num_deferred);
if (is_first_event)
{
first_event = event_type;
#ifdef DEBUG_DEFERRED
# ifdef DEBUG_DEFERRED_EVENT
if (0 != fast_lock_count)
{
(void) FPRINTF(stderr,
"Setting xfer_table for event type %d.\n",
event_type);
}
#endif
DBGDFRDEVNT((stderr, "xfer_set_handlers: Setting xfer_table for event type %d\n",
event_type));
# endif
/* -------------------------------------------------------
* If table changed, it was not synchronized.
* (Assumes these entries are all that would be changed)
@ -191,48 +164,49 @@ boolean_t xfer_set_handlers(int4 event_type, void (*set_fn)(int4 param), int4 p
* fixed up addresses making direct comparisions non-trivial.
* --------------------------------------------------------
*/
#ifndef __ia64
assert((xfer_table[xf_linefetch] == op_linefetch) ||
(xfer_table[xf_linefetch] == op_zstepfetch) ||
(xfer_table[xf_linefetch] == op_zst_fet_over) ||
(xfer_table[xf_linefetch] == op_mproflinefetch));
assert((xfer_table[xf_linestart] == op_linestart) ||
(xfer_table[xf_linestart] == op_zstepstart) ||
(xfer_table[xf_linestart] == op_zst_st_over) ||
(xfer_table[xf_linestart] == op_mproflinestart));
assert((xfer_table[xf_zbfetch] == op_zbfetch) ||
(xfer_table[xf_zbfetch] == op_zstzb_fet_over) ||
(xfer_table[xf_zbfetch] == op_zstzbfetch));
assert((xfer_table[xf_zbstart] == op_zbstart) ||
(xfer_table[xf_zbstart] == op_zstzb_st_over) ||
(xfer_table[xf_zbstart] == op_zstzbstart));
assert((xfer_table[xf_forchk1] == op_forchk1) ||
(xfer_table[xf_forchk1] == op_mprofforchk1));
assert((xfer_table[xf_forloop] == op_forloop));
assert(xfer_table[xf_ret] == opp_ret ||
xfer_table[xf_ret] == opp_zst_over_ret ||
xfer_table[xf_ret] == opp_zstepret);
assert(xfer_table[xf_retarg] == op_retarg ||
xfer_table[xf_retarg] == opp_zst_over_retarg ||
xfer_table[xf_retarg] == opp_zstepretarg);
#endif /* !ia64 */
# ifndef __ia64
assert((xfer_table[xf_linefetch] == op_linefetch) ||
(xfer_table[xf_linefetch] == op_zstepfetch) ||
(xfer_table[xf_linefetch] == op_zst_fet_over) ||
(xfer_table[xf_linefetch] == op_mproflinefetch));
assert((xfer_table[xf_linestart] == op_linestart) ||
(xfer_table[xf_linestart] == op_zstepstart) ||
(xfer_table[xf_linestart] == op_zst_st_over) ||
(xfer_table[xf_linestart] == op_mproflinestart));
assert((xfer_table[xf_zbfetch] == op_zbfetch) ||
(xfer_table[xf_zbfetch] == op_zstzb_fet_over) ||
(xfer_table[xf_zbfetch] == op_zstzbfetch));
assert((xfer_table[xf_zbstart] == op_zbstart) ||
(xfer_table[xf_zbstart] == op_zstzb_st_over) ||
(xfer_table[xf_zbstart] == op_zstzbstart));
assert((xfer_table[xf_forchk1] == op_forchk1) ||
(xfer_table[xf_forchk1] == op_mprofforchk1));
assert((xfer_table[xf_forloop] == op_forloop));
assert(xfer_table[xf_ret] == opp_ret ||
xfer_table[xf_ret] == opp_zst_over_ret ||
xfer_table[xf_ret] == opp_zstepret);
assert(xfer_table[xf_retarg] == op_retarg ||
xfer_table[xf_retarg] == opp_zst_over_retarg ||
xfer_table[xf_retarg] == opp_zstepretarg);
# endif /* !IA64 */
/* -----------------------------------------------
* Now call the specified set function to swap in
* the desired handlers (and set flags or whatever).
* -----------------------------------------------
*/
DBGDFRDEVNT((stderr, "xfer_set_handlers: Driving event setup handler\n"));
set_fn(param_val);
}
#ifdef DEBUG_DEFERRED
# ifdef DEBUG_DEFERRED_EVENT
else if (0 != fast_lock_count)
{
(void) FPRINTF(stderr,
"\n---Multiple deferred events---\n"
"Event type %d occurred while type %d was pending\n",
event_type,
first_event);
DBGDFRDEVNT((stderr, "xfer_set_handlers: ---Multiple deferred events---\n"
"Event type %d occurred while type %d was pending\n", event_type, first_event));
} else
{
DBGDFRDEVNT((stderr, "xfer_set_handlers: Event bypassed -- was not first event\n"));
}
#endif
# endif
assert(no_event != first_event);
return is_first_event;
}
@ -253,28 +227,20 @@ boolean_t xfer_reset_if_setter(int4 event_type)
{
if (event_type == first_event)
{
DBGDFRDEVNT((stderr, "xfer_reset_if_setter: event_type is first_event\n"));
/* Still have to synchronize the same way... */
if (TRUE == xfer_reset_handlers(event_type))
{ /* *********************************
* Check for and activate any
* other pending events before
* returning success:
* *********************************
*/
if (xfer_reset_handlers(event_type))
{ /* Check for and activate any other pending events before returning success */
/* (Not implemented) */
return TRUE;
} else
{ /* ---------------------------------
* Would require interleaved resets
* to get here, e.g. due to
* rts_error from interrupt level.
* ---------------------------------
*/
{ /* Would require interleaved resets to get here, e.g. due to rts_error from interrupt level */
assert(FALSE);
return FALSE;
}
} else
return FALSE;
}
DBGDFRDEVNT((stderr, "xfer_reset_if_setter: event_type is NOT first_event\n"));
return FALSE;
}
/* ------------------------------------------------------------------
@ -322,8 +288,7 @@ boolean_t xfer_reset_handlers(int4 event_type)
int4 e_type;
boolean_t reset_type_is_set_type;
int4 status;
int e, ei, e_tot=0;
int e, ei, e_tot = 0;
/* ------------------------------------------------------------------
* Note: If reset routine can preempt path from handler to
@ -334,7 +299,6 @@ boolean_t xfer_reset_handlers(int4 event_type)
*/
assert(0 < num_deferred);
assert(0 < xfer_table_events[event_type]);
if (is_tracing_on)
{
FIX_XFER_ENTRY(xf_linefetch, op_mproflinefetch);
@ -351,45 +315,27 @@ boolean_t xfer_reset_handlers(int4 event_type)
FIX_XFER_ENTRY(xf_zbstart, op_zbstart);
FIX_XFER_ENTRY(xf_ret, opp_ret);
FIX_XFER_ENTRY(xf_retarg, op_retarg);
#ifdef DEBUG_DEFERRED
(void) FPRINTF(stderr,"Reset xfer_table for event type %d.\n",event_type);
#endif
DBGDFRDEVNT((stderr, "xfer_reset_handlers: Reset xfer_table for event type %d.\n", event_type));
reset_type_is_set_type = (event_type == first_event);
#ifdef DEBUG
# ifdef DEBUG
if (!reset_type_is_set_type)
{
rts_error(VARLSTCNT(4) ERR_DEFEREVENT,
2,
event_type,
first_event);
}
#endif
rts_error(VARLSTCNT(4) ERR_DEFEREVENT, 2, event_type, first_event);
# endif
#ifdef DEBUG_DEFERRED
/*--------------------------------------------=---------------------------------
* Note: concurrent modification of array elements means events that occur
* during this section will cause inconsistent totals.
*-----------------------------------------------------------------------------
*/
for (ei=no_event; ei<DEFERRED_EVENTS; ei++)
{
# ifdef DEBUG_DEFERRED_EVENT
/* Note: concurrent modification of array elements means events that occur during this section will
* cause inconsistent totals.
*/
for (ei = no_event; ei < DEFERRED_EVENTS; ei++)
e_tot += xfer_table_events[ei];
}
if (e_tot >1)
if (1 < e_tot)
{
(void) FPRINTF(stderr,"Event Log:\n");
DBGDFRDEVNT((stderr, "xfer_reset_handlers: Event Log:\n"));
for (ei=no_event; ei<DEFERRED_EVENTS; ei++)
{
(void) FPRINTF(stderr,
" Event type %d: count was %d.\n",
ei,
xfer_table_events[ei]);
}
DBGDFRDEVNT((stderr, "xfer_reset_handlers: Event type %d: count was %d.\n",
ei, xfer_table_events[ei]));
}
#endif
# endif
/* -------------------------------------------------------------------------
* Kluge(?): set all locations to nonzero value to
@ -419,12 +365,11 @@ boolean_t xfer_reset_handlers(int4 event_type)
num_deferred = 0;
ctrap_action_is = 0;
outofband = 0;
VMS_ONLY(
status = sys$clref(efn_outofband);
assert(SS$_WASSET == status);
if ((SS$_WASSET != status) && (SS$_WASCLR != status))
GTMASSERT;
)
# ifdef VMS
status = sys$clref(efn_outofband);
assert(SS$_WASSET == status);
assertpro((SS$_WASSET == status) || (SS$_WASCLR == status));
# endif
/* ******************************************************************
* There is a race here:
* If a new event interrupts after previous line and before
@ -446,9 +391,7 @@ boolean_t xfer_reset_handlers(int4 event_type)
*/
/* Clear to allow new events to be reset only after we're all done. */
for (e_type = 1; DEFERRED_EVENTS > e_type; e_type++)
{
xfer_table_events[e_type] = FALSE;
}
return reset_type_is_set_type;
}
@ -464,9 +407,8 @@ void async_action(bool lnfetch_or_start)
switch(first_event)
{
case (outofband_event):
if (0 == outofband)
{ /* This function can be invoked only by a op_*intrrpt* transfer table function. Those transfer table
case (outofband_event):
/* This function can be invoked only by a op_*intrrpt* transfer table function. Those transfer table
* functions should be active only for a short duration between the occurrence of an outofband event
* and the handling of it at a logical boundary (next M-line). We dont expect to be running with
* those transfer table functions for more than one M-line. If "outofband" is set to 0, the call to
@ -475,35 +417,33 @@ void async_action(bool lnfetch_or_start)
* might lead to application integrity issues. It is therefore considered safer to GTMASSERT as we
* will at least have the core for analysis.
*/
GTMASSERT;
}
outofband_action(lnfetch_or_start);
break;
case (tt_write_error_event):
UNIX_ONLY(
assertpro(0 != outofband);
outofband_action(lnfetch_or_start);
break;
case (tt_write_error_event):
# ifdef UNIX
xfer_reset_if_setter(tt_write_error_event);
iott_wrterr();
)
/* VMS tt error processing is done in op_*intrrpt */
break;
case (network_error_event):
/* -------------------------------------------------------
* Network error not implemented here yet. Need to move
* from mdb_condition_handler after review.
* -------------------------------------------------------
*/
case (zstp_or_zbrk_event):
/* -------------------------------------------------------
* ZStep/Zbreak events not implemented here yet. Need to
* move here after review.
* -------------------------------------------------------
*/
default:
GTMASSERT; /* see above GTMASSERT for comment as to why this is needed */
# endif
/* VMS tt error processing is done in op_*intrrpt */
break;
case (network_error_event):
/* -------------------------------------------------------
* Network error not implemented here yet. Need to move
* from mdb_condition_handler after review.
* -------------------------------------------------------
*/
case (zstp_or_zbrk_event):
/* -------------------------------------------------------
* ZStep/Zbreak events not implemented here yet. Need to
* move here after review.
* -------------------------------------------------------
*/
default:
assertpro(FALSE); /* see above assertpro() for comment as to why this is needed */
}
}
/* ------------------------------------------------------------------
* Indicate whether an xfer_table change is pending.
* Only works for changes made using routines in this module

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -9,6 +9,14 @@
* *
****************************************************************/
/* Uncomment below to enable tracing of deferred events */
/* #define DEBUG_DEFERRED_EVENT */
#ifdef DEBUG_DEFERRED_EVENT
# define DBGDFRDEVNT(x) DBGFPF(x)
#else
# define DBGDFRDEVNT(x)
#endif
/* --------------------------------------------
* Async. events that can be deferred
* --------------------------------------------
@ -90,13 +98,8 @@ boolean_t xfer_reset_if_setter(int4 event_type);
*/
void ctrap_set(int4);
void ctrlc_set(int4);
void ctrly_set(int4);
void tp_timeout_defer(int4);
void tt_write_error_set(int4);
/* ------------------------------------------------------------------

View File

@ -24,14 +24,10 @@
#include "cvtparm.h"
#include "deviceparameters.h"
GBLREF char window_token;
GBLREF mident window_ident;
GBLREF triple *curtchain;
error_def(ERR_RPARENMISSING);
error_def(ERR_DEVPARUNK);
error_def(ERR_DEVPARINAP);
error_def(ERR_DEVPARUNK);
error_def(ERR_DEVPARVALREQ);
error_def(ERR_RPARENMISSING);
LITREF unsigned char io_params_size[];
LITREF dev_ctl_struct dev_param_control[];
@ -523,9 +519,9 @@ int deviceparameters(oprtype *c, char who_calls)
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(dev_param_index[26] == (SIZEOF(dev_param_names)/SIZEOF(nametabent)));
assert(dev_param_index[26] == (SIZEOF(dev_param_data)/SIZEOF(unsigned char)));
is_parm_list = (window_token == TK_LPAREN);
assert((SIZEOF(dev_param_names) / SIZEOF(nametabent) == dev_param_index[26]));
assert((SIZEOF(dev_param_data) / SIZEOF(unsigned char)) == dev_param_index[26]);
is_parm_list = (TK_LPAREN == TREF(window_token));
if (is_parm_list)
advancewindow();
cat_cnt = 0;
@ -533,9 +529,10 @@ int deviceparameters(oprtype *c, char who_calls)
parse_warn = FALSE;
for (;;)
{
if ((window_token != TK_IDENT)
|| ((n = namelook(dev_param_index, dev_param_names, window_ident.addr, window_ident.len)) < 0))
{
if ((TK_IDENT != TREF(window_token))
|| (0
> (n = namelook(dev_param_index, dev_param_names, (TREF(window_ident)).addr, (TREF(window_ident)).len))))
{ /* NOTE assignment above */
STX_ERROR_WARN(ERR_DEVPARUNK); /* sets "parse_warn" to TRUE */
break;
}
@ -549,16 +546,16 @@ int deviceparameters(oprtype *c, char who_calls)
*parptr++ = n;
if (io_params_size[n])
{
if (window_token != TK_EQUAL)
if (TK_EQUAL != TREF(window_token))
{
STX_ERROR_WARN(ERR_DEVPARVALREQ); /* sets "parse_warn" to TRUE */
break;
}
advancewindow();
if (!expr(&x))
if (EXPR_FAIL == expr(&x, MUMPS_EXPR))
return FALSE;
assert(x.oprclass == TRIP_REF);
if (x.oprval.tref->opcode == OC_LIT)
assert(TRIP_REF == x.oprclass);
if (OC_LIT == x.oprval.tref->opcode)
{
/* check to see if this string could overflow (5 is a int4 word plus a parameter code for
safety) Must check before cvtparm, due to the fact that tmpmval could otherwise
@ -569,7 +566,7 @@ int deviceparameters(oprtype *c, char who_calls)
cat_list[cat_cnt++] = put_str(parstr, INTCAST(parptr - parstr));
parptr = parstr;
}
assert(x.oprval.tref->operand[0].oprclass == MLIT_REF);
assert(MLIT_REF == x.oprval.tref->operand[0].oprclass);
status = cvtparm(n, &x.oprval.tref->operand[0].oprval.mlit->v, &tmpmval);
if (status)
{
@ -593,12 +590,12 @@ int deviceparameters(oprtype *c, char who_calls)
}
if (!is_parm_list)
break;
if (window_token == TK_COLON)
if (TK_COLON == TREF(window_token))
{
advancewindow();
continue;
}
else if (window_token == TK_RPAREN)
else if (TK_RPAREN == TREF(window_token))
{
advancewindow();
break;
@ -610,7 +607,7 @@ int deviceparameters(oprtype *c, char who_calls)
{ /* Parse the remaining arguments until the corresponding RIGHT-PAREN or SPACE or EOL is reached */
if (!parse_until_rparen_or_space())
return FALSE;
if (window_token == TK_RPAREN)
if (TK_RPAREN == TREF(window_token))
advancewindow();
}
*parptr++ = iop_eol;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2004 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -42,20 +42,77 @@ int do_indir_do(mval *v, unsigned char argcode)
label.str.len = v->str.len;
label.str.addr = &ident.c[0];
addr = op_labaddr(frame_pointer->rvector, &label, 0);
if (argcode == indir_do)
{
if (is_tracing_on)
exfun_frame_sp();
else
exfun_frame();
}
current_rhead = CURRENT_RHEAD_ADR(frame_pointer->rvector);
frame_pointer->mpc = LINE_NUMBER_ADDR(current_rhead, USHBIN_ONLY(*)addr);
#ifdef HAS_LITERAL_SECT
if (argcode == indir_do)
{ /* If we aren't in an indirect, exfun_frame() is the best way to copy the stack frame as it does not
* require re-allocation of the various tables (temps, linkage, literals, etc). But if we are in an
* indirect, the various stackframe fields cannot be copied as the indirect has different values so
* re-create the frame from the values in the routine header via new_stack_frame().
*/
if (!(frame_pointer->flags & SFF_INDCE))
{
if (!is_tracing_on)
exfun_frame();
else
exfun_frame_sp();
} else
{
if (!is_tracing_on)
{
new_stack_frame(CURRENT_RHEAD_ADR(frame_pointer->rvector),
# ifdef HAS_LITERAL_SECT
(unsigned char *)LINKAGE_ADR(current_rhead),
# else
PTEXT_ADR(current_rhead),
# endif
USHBIN_ONLY(LINE_NUMBER_ADDR(current_rhead, *addr))
/* On non-shared binary calculate the transfer address to be passed to
* new_stack_frame as follows:
* 1) get the number stored at addr; this is the offset to the line number
* entry
* 2) add the said offset to the address of the routine header; this is the
* address of line number entry
* 3) dereference the said address to get the line number of the actual
* program
* 4) add the said line number to the address of the routine header
*/
NON_USHBIN_ONLY((unsigned char *)((char *)current_rhead
+ *(int4 *)((char *)current_rhead + *addr))));
} else
{
new_stack_frame_sp(CURRENT_RHEAD_ADR(frame_pointer->rvector),
# ifdef HAS_LITERAL_SECT
(unsigned char *)LINKAGE_ADR(current_rhead),
# else
PTEXT_ADR(current_rhead),
# endif
USHBIN_ONLY(LINE_NUMBER_ADDR(current_rhead, *addr))
/* On non-shared binary calculate the transfer address to be passed to
* new_stack_frame as follows:
* 1) get the number stored at addr; this is the offset to the line
* number entry
* 2) add the said offset to the address of the routine header; this is
* the address of line number entry
* 3) dereference the said address to get the line number of the actual
* program
* 4) add the said line number to the address of the routine header
*/
NON_USHBIN_ONLY((unsigned char *)((char *)current_rhead
+ *(int4 *)((char *)current_rhead + *addr))));
}
return TRUE;
}
}
/* On non-shared binary calculate the mpc pointer similarly to the descriptions above. */
frame_pointer->mpc =
USHBIN_ONLY(LINE_NUMBER_ADDR(current_rhead, *addr))
NON_USHBIN_ONLY((unsigned char *)((char *)current_rhead + *(int4 *)((char *)current_rhead + *addr)));
# ifdef HAS_LITERAL_SECT
frame_pointer->ctxt = (unsigned char *)LINKAGE_ADR(current_rhead);
#else
# else
frame_pointer->ctxt = PTEXT_ADR(current_rhead);
#endif
# endif
return TRUE;
} else
return FALSE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2010, 2011 Fidelity Information Services, Inc *
* Copyright 2010, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -35,16 +35,16 @@ GBLREF int process_exiting;
*
* 0 - no return value requested
* 1 - non-alias return value requested
* 3 - alias return value requrested
* 11 - alias return value requested
*
* Determination of parm/no-parm is made by calling get_ret_targ() which searches the mv_stents
* on the stack back to a counted frame to see of an MVST_PARM block containg a return mval was pushed
* onto the stack signifying a return value is required. If a return value is required, determination of
* the type of return value is made by examining the generated instruction stream at the return point
* and checking for an OC_EXFUNRET or OC_EXFUNRETALS (non-alias and alias type return var processor
* respectively) opcode following the return point. This is done by isolating the instruction that
* indexes into the transfer table, extracting the xfer-table index and checking against known values
* for op_exfunret and op_exfunretals to determine type of return. No match means no return value.
* Determination of parm/no-parm is made by calling get_ret_targ() which checks the stack frames back to
* a counted frame whether the ret_value field has a return mval, signifying that a return value is required.
* If a return value is required, determination of the type of return value is made by examining the
* generated instruction stream at the return point and checking for an OC_EXFUNRET or OC_EXFUNRETALS
* (non-alias and alias type return var processor respectively) opcode following the return point. This is
* done by isolating the instruction that indexes into the transfer table, extracting the xfer-table index
* and checking against known values for op_exfunret and op_exfunretals to determine type of return. No match
* means no return value.
*
* Because this routine looks at the generated code stream at the return point, it is highly platform
* dependent.
@ -54,8 +54,6 @@ GBLREF int process_exiting;
int dollar_quit(void)
{
stack_frame *sf;
mval *parm_blk;
int retval;
int xfer_index;
union
@ -68,204 +66,199 @@ int dollar_quit(void)
int *xfer_offset_32;
} ptrs;
parm_blk = get_ret_targ(&sf);
if (NULL == parm_blk)
/* There was no parm block - return 0 */
retval = 0;
else
{ /* There is a parm block - see if they want a "regular" or alias type return argument */
sf = sf->old_frame_pointer; /* Caller's frame */
# ifdef __i386
/* There was no return value - return 0 */
if (NULL == get_ret_targ(&sf))
return 0;
/* There is a return value - see if they want a "regular" or alias type return argument */
sf = sf->old_frame_pointer; /* Caller's frame */
# ifdef __i386
{
ptrs.instr = sf->mpc;
/* First figure out the potential length of the lea* instruction loading compiler temp offset */
if (0x078d == *ptrs.instr_type)
ptrs.instr += 3; /* Past the 2 byte lea plus 1 byte push */
else if (0x478d == *ptrs.instr_type)
ptrs.instr += 4; /* Past the 3 byte lea plus 1 byte push */
else if (0x878d == *ptrs.instr_type)
ptrs.instr += 7; /* Past the 6 byte lea plus 1 byte push */
else
ptrs.instr = NULL;
/* Note the "long format call opcode" check below assumes that both of the EXFUNRET[ALS] calls remain at a
* greater-than-128 byte offset in the transfer table (which they currently are).
*/
if ((NULL != ptrs.instr) && (0x93FF == *ptrs.instr_type))
{
ptrs.instr = sf->mpc;
/* First figure out the potential length of the lea* instruction loading compiler temp offset */
if (0x078d == *ptrs.instr_type)
ptrs.instr += 3; /* Past the 2 byte lea plus 1 byte push */
else if (0x478d == *ptrs.instr_type)
ptrs.instr += 4; /* Past the 3 byte lea plus 1 byte push */
else if (0x878d == *ptrs.instr_type)
ptrs.instr += 7; /* Past the 6 byte lea plus 1 byte push */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_32 / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__x86_64__)
{
ptrs.instr = sf->mpc;
if (0x8d49 == *ptrs.instr_type)
{
ptrs.instr += 2; /* Past first part of instruction type */
if (0x7e == *ptrs.instr_type_8)
ptrs.instr += 2; /* past last byte of instruction type plus 1 byte offset */
else if (0xbe == *ptrs.instr_type_8)
ptrs.instr += 5; /* past last byte of instruction type plus 4 byte offset */
else
ptrs.instr = NULL;
/* Note the "long format call opcode" check below assumes that both of the EXFUNRET[ALS] calls remain at a
* greater-than-128 byte offset in the transfer table (which they currently are).
*/
if ((NULL != ptrs.instr) && (0x93FF == *ptrs.instr_type))
{
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_32 / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__x86_64__)
{
ptrs.instr = sf->mpc;
if (0x8d49 == *ptrs.instr_type)
{
ptrs.instr += 2; /* Past first part of instruction type */
if (0x7e == *ptrs.instr_type_8)
ptrs.instr += 2; /* past last byte of instruction type plus 1 byte offset */
else if (0xbe == *ptrs.instr_type_8)
ptrs.instr += 5; /* past last byte of instruction type plus 4 byte offset */
else
ptrs.instr = NULL;
} else
ptrs.instr_type = NULL;
if ((NULL != ptrs.instr) && (0x93FF == *ptrs.instr_type))
{ /* Long format CALL */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_32 / SIZEOF(void *);
} else
xfer_index = -1; /* Not an xfer index */
}
# elif defined(_AIX)
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (0xE97C == *ptrs.instr_type)
{ /* ld of descriptor address from xfer table */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_16 / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__alpha) /* Applies to both VMS and Tru64 as have same codegen */
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (UNIX_ONLY(0xA36C) VMS_ONLY(0xA36B) == *(ptrs.instr_type + 1)) /* Different code for reg diff */
/* ldl of descriptor address from xfer table - little endian - offset prior to opcode */
xfer_index = *ptrs.xfer_offset_16 / SIZEOF(void *);
else
xfer_index = -1;
}
# elif defined(__sparc)
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (0xC85C == *ptrs.instr_type)
{ /* ldx of rtn address from xfer table */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = (*ptrs.xfer_offset_16 & SPARC_MASK_OFFSET) / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__s390__) || defined(__MVS__)
{
format_RXY instr_LG;
ZOS_ONLY(format_RR instr_RR;)
union
{
int offset;
struct
{ /* Used to reassemble the offset in the LG instruction */
int offset_unused:12;
int offset_hi:8;
int offset_low:12;
} instr_LG_bits;
} RXY;
/* Need to forward space past address load of compiler temp arg. On zOS, the position of the mpc can
* differ. If the origin point is an external call, we have to forward space past the BCR following
* the call point. If the origin point is an internal call, the call point is a branch with no
* following BCR. So zOS needs to determine if it has to jump over a BCR call first.
*/
ZOS_ONLY(memcpy(&instr_RR, sf->mpc, SIZEOF(instr_RR)));
ptrs.instr = sf->mpc;
ZOS_ONLY(if ((S390_OPCODE_RR_BCR == instr_RR.opcode)
&& (0 == instr_RR.r1) && (0 == instr_RR.r2))
ptrs.instr += 2); /* Past BCR 0,0 from external call */
ptrs.instr += 6; /* Past address load of compiler temp arg */
memcpy(&instr_LG, ptrs.instr, SIZEOF(instr_LG));
if ((S390_OPCODE_RXY_LG == instr_LG.opcode) && (S390_SUBCOD_RXY_LG == instr_LG.opcode2)
&& (GTM_REG_SAVE_RTN_ADDR == instr_LG.r1) && (GTM_REG_XFER_TABLE == instr_LG.b2))
{ /* LG of rtn address from xfer table */
RXY.offset = 0;
RXY.instr_LG_bits.offset_hi = instr_LG.dh2;
RXY.instr_LG_bits.offset_low = instr_LG.dl2;
xfer_index = RXY.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__hppa)
{
hppa_fmt_1 instr_LDX;
union
{
int offset;
struct
{
signed int high:19;
unsigned int low:13;
} instr_offset;
} fmt_1;
ptrs.instr = sf->mpc + 8; /* Past address load of compiler temp arg plus rtn call to load of xfer
* table call with offset in delay slot */
memcpy(&instr_LDX, ptrs.instr, SIZEOF(instr_LDX));
if (((HPPA_INS_LDW >> HPPA_SHIFT_OP) == instr_LDX.pop) && (GTM_REG_XFER_TABLE == instr_LDX.b)
&& (R22 == instr_LDX.t))
{ /* ldx of rtn address from xfer table */
fmt_1.instr_offset.low = instr_LDX.im14a;
fmt_1.instr_offset.high = instr_LDX.im14b;
xfer_index = fmt_1.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__ia64)
{
ia64_bundle xfer_ref_inst; /* Buffer to put built instruction into */
ia64_fmt_A4 adds_inst; /* The actual adds instruction computing xfer reference */
union
{
int offset;
struct
{
# ifdef BIGENDIAN
signed int sign:19;
unsigned int imm6d:6;
unsigned int imm7b:7;
# else
unsigned int imm7b:7;
unsigned int imm6d:6;
signed int sign:19;
# endif
} instr_offset;
} imm14;
ptrs.instr = sf->mpc + 16; /* Past address load of compiler temp arg */
# ifdef BIGENDIAN
xfer_ref_inst.hexValue.aValue = GTM_BYTESWAP_64(((ia64_bundle *)ptrs.instr)->hexValue.aValue);
xfer_ref_inst.hexValue.bValue = GTM_BYTESWAP_64(((ia64_bundle *)ptrs.instr)->hexValue.bValue);
# else
xfer_ref_inst.hexValue.aValue = ((ia64_bundle *)ptrs.instr)->hexValue.aValue;
xfer_ref_inst.hexValue.bValue = ((ia64_bundle *)ptrs.instr)->hexValue.bValue;
# endif
adds_inst.hexValue = xfer_ref_inst.format.inst3; /* Extract instruction from bundle */
if ((8 == adds_inst.format.pop) && (2 == adds_inst.format.x2a)
&& (GTM_REG_XFER_TABLE == adds_inst.format.r3) && (IA64_REG_SCRATCH1 == adds_inst.format.r1))
{ /* We have an xfer computation instruction. Find the offset to find which opcode */
imm14.instr_offset.imm7b = adds_inst.format.imm7b; /* Low order bits */
imm14.instr_offset.imm6d = adds_inst.format.imm6d; /* upper bits minus sign */
imm14.instr_offset.sign = adds_inst.format.sb; /* Sign bit propagated */
xfer_index = imm14.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# else
# error Unsupported Platform
# endif
if (xf_exfunret == xfer_index)
/* Need a QUIT with a non-alias return value */
retval = 1;
else if (xf_exfunretals == xfer_index)
/* Need a QUIT with an alias return value */
retval = 11;
else
{ /* Something weird afoot - had parm block can can't locate EXFUNRET[ALS] opcode. This can happen if
* a fatal error occurs during a call before the callee stack frame is actually pushed and we are
* called during GTM_FATAL_ERROR.* file creation. Assert that this is the case, else, we just pretend
* we didn't find a parm block..
*/
assert(process_exiting);
retval = 0;
}
} else
ptrs.instr_type = NULL;
if ((NULL != ptrs.instr) && (0x93FF == *ptrs.instr_type))
{ /* Long format CALL */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_32 / SIZEOF(void *);
} else
xfer_index = -1; /* Not an xfer index */
}
# elif defined(_AIX)
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (0xE97C == *ptrs.instr_type)
{ /* ld of descriptor address from xfer table */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = *ptrs.xfer_offset_16 / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__alpha) /* Applies to both VMS and Tru64 as have same codegen */
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (UNIX_ONLY(0xA36C) VMS_ONLY(0xA36B) == *(ptrs.instr_type + 1)) /* Different code for reg diff */
/* ldl of descriptor address from xfer table - little endian - offset prior to opcode */
xfer_index = *ptrs.xfer_offset_16 / SIZEOF(void *);
else
xfer_index = -1;
}
# elif defined(__sparc)
{
ptrs.instr = sf->mpc + 4; /* Past address load of compiler temp arg */
if (0xC85C == *ptrs.instr_type)
{ /* ldx of rtn address from xfer table */
ptrs.instr += SIZEOF(*ptrs.instr_type);
xfer_index = (*ptrs.xfer_offset_16 & SPARC_MASK_OFFSET) / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__s390__) || defined(__MVS__)
{
format_RXY instr_LG;
ZOS_ONLY(format_RR instr_RR;)
union
{
int offset;
struct
{ /* Used to reassemble the offset in the LG instruction */
int offset_unused:12;
int offset_hi:8;
int offset_low:12;
} instr_LG_bits;
} RXY;
/* Need to forward space past address load of compiler temp arg. On zOS, the position of the mpc can
* differ. If the origin point is an external call, we have to forward space past the BCR following
* the call point. If the origin point is an internal call, the call point is a branch with no
* following BCR. So zOS needs to determine if it has to jump over a BCR call first.
*/
ZOS_ONLY(memcpy(&instr_RR, sf->mpc, SIZEOF(instr_RR)));
ptrs.instr = sf->mpc;
ZOS_ONLY(if ((S390_OPCODE_RR_BCR == instr_RR.opcode) && (0 == instr_RR.r1) && (0 == instr_RR.r2))
ptrs.instr += 2); /* Past BCR 0,0 from external call */
ptrs.instr += 6; /* Past address load of compiler temp arg */
memcpy(&instr_LG, ptrs.instr, SIZEOF(instr_LG));
if ((S390_OPCODE_RXY_LG == instr_LG.opcode) && (S390_SUBCOD_RXY_LG == instr_LG.opcode2)
&& (GTM_REG_SAVE_RTN_ADDR == instr_LG.r1) && (GTM_REG_XFER_TABLE == instr_LG.b2))
{ /* LG of rtn address from xfer table */
RXY.offset = 0;
RXY.instr_LG_bits.offset_hi = instr_LG.dh2;
RXY.instr_LG_bits.offset_low = instr_LG.dl2;
xfer_index = RXY.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__hppa)
{
hppa_fmt_1 instr_LDX;
union
{
int offset;
struct
{
signed int high:19;
unsigned int low:13;
} instr_offset;
} fmt_1;
ptrs.instr = sf->mpc + 8; /* Past address load of compiler temp arg plus rtn call to load of xfer
* table call with offset in delay slot */
memcpy(&instr_LDX, ptrs.instr, SIZEOF(instr_LDX));
if (((HPPA_INS_LDW >> HPPA_SHIFT_OP) == instr_LDX.pop) && (GTM_REG_XFER_TABLE == instr_LDX.b)
&& (R22 == instr_LDX.t))
{ /* ldx of rtn address from xfer table */
fmt_1.instr_offset.low = instr_LDX.im14a;
fmt_1.instr_offset.high = instr_LDX.im14b;
xfer_index = fmt_1.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# elif defined(__ia64)
{
ia64_bundle xfer_ref_inst; /* Buffer to put built instruction into */
ia64_fmt_A4 adds_inst; /* The actual adds instruction computing xfer reference */
union
{
int offset;
struct
{
# ifdef BIGENDIAN
signed int sign:19;
unsigned int imm6d:6;
unsigned int imm7b:7;
# else
unsigned int imm7b:7;
unsigned int imm6d:6;
signed int sign:19;
# endif
} instr_offset;
} imm14;
ptrs.instr = sf->mpc + 16; /* Past address load of compiler temp arg */
# ifdef BIGENDIAN
xfer_ref_inst.hexValue.aValue = GTM_BYTESWAP_64(((ia64_bundle *)ptrs.instr)->hexValue.aValue);
xfer_ref_inst.hexValue.bValue = GTM_BYTESWAP_64(((ia64_bundle *)ptrs.instr)->hexValue.bValue);
# else
xfer_ref_inst.hexValue.aValue = ((ia64_bundle *)ptrs.instr)->hexValue.aValue;
xfer_ref_inst.hexValue.bValue = ((ia64_bundle *)ptrs.instr)->hexValue.bValue;
# endif
adds_inst.hexValue = xfer_ref_inst.format.inst3; /* Extract instruction from bundle */
if ((8 == adds_inst.format.pop) && (2 == adds_inst.format.x2a)
&& (GTM_REG_XFER_TABLE == adds_inst.format.r3) && (IA64_REG_SCRATCH1 == adds_inst.format.r1))
{ /* We have an xfer computation instruction. Find the offset to find which opcode */
imm14.instr_offset.imm7b = adds_inst.format.imm7b; /* Low order bits */
imm14.instr_offset.imm6d = adds_inst.format.imm6d; /* upper bits minus sign */
imm14.instr_offset.sign = adds_inst.format.sb; /* Sign bit propagated */
xfer_index = imm14.offset / SIZEOF(void *);
} else
xfer_index = -1;
}
# else
# error Unsupported Platform
# endif
if (xf_exfunret == xfer_index)
/* Need a QUIT with a non-alias return value */
return 1;
else if (xf_exfunretals == xfer_index)
/* Need a QUIT with an alias return value */
return 11;
else
{ /* Something weird afoot - had parm block can can't locate EXFUNRET[ALS] opcode. This can happen if
* a fatal error occurs during a call before the callee stack frame is actually pushed and we are
* called during GTM_FATAL_ERROR.* file creation. Assert that this is the case, else, we just pretend
* we didn't find a parm block..
*/
assert(process_exiting);
return 0;
}
return retval;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -12,6 +12,8 @@
#ifndef __DSE_H__
#define __DSE_H__
error_def(ERR_DSEWCREINIT);
#define PATCH_SAVE_SIZE 128
#define DSE_DMP_TIME_FMT "DD-MON-YEAR 24:60:SS"
@ -58,26 +60,76 @@ enum dse_fmt
};
/* Grab crit for dse* functions taking into account -nocrit if specified */
#define DSE_GRAB_CRIT_AS_APPROPRIATE(WAS_CRIT, NOCRIT_PRESENT, CS_ADDRS, GV_CUR_REGION) \
{ \
if (!WAS_CRIT) \
{ \
if (NOCRIT_PRESENT) \
CS_ADDRS->now_crit = TRUE; \
else \
grab_crit(GV_CUR_REGION); \
} \
#define DSE_GRAB_CRIT_AS_APPROPRIATE(WAS_CRIT, WAS_HOLD_ONTO_CRIT, NOCRIT_PRESENT, CS_ADDRS, GV_CUR_REGION) \
{ \
if (!WAS_CRIT) \
{ \
if (NOCRIT_PRESENT) \
CS_ADDRS->now_crit = TRUE; \
else \
grab_crit(GV_CUR_REGION); \
WAS_HOLD_ONTO_CRIT = CS_ADDRS->hold_onto_crit; \
CS_ADDRS->hold_onto_crit = TRUE; \
} \
}
/* Rel crit for dse* functions taking into account -nocrit if specified */
#define DSE_REL_CRIT_AS_APPROPRIATE(WAS_CRIT, NOCRIT_PRESENT, CS_ADDRS, GV_CUR_REGION) \
#define DSE_REL_CRIT_AS_APPROPRIATE(WAS_CRIT, WAS_HOLD_ONTO_CRIT, NOCRIT_PRESENT, CS_ADDRS, GV_CUR_REGION) \
{ \
if (!WAS_CRIT) \
{ \
assert(CS_ADDRS->hold_onto_crit); \
assert((TRUE == WAS_HOLD_ONTO_CRIT) || (FALSE == WAS_HOLD_ONTO_CRIT)); \
CS_ADDRS->hold_onto_crit = WAS_HOLD_ONTO_CRIT; \
if (NOCRIT_PRESENT) \
CS_ADDRS->now_crit = FALSE; \
else \
rel_crit(GV_CUR_REGION); \
} \
}
#ifdef UNIX
# define GET_CONFIRM(X, Y) \
{ \
if (!WAS_CRIT) \
PRINTF("CONFIRMATION: "); \
FGETS((X), (Y), stdin, fgets_res); \
Y = strlen(X); \
}
#else
# define GET_CONFIRM(X, Y) \
{ \
if(!cli_get_str("CONFIRMATION",(X),&(Y))) \
{ \
if (NOCRIT_PRESENT) \
CS_ADDRS->now_crit = FALSE; \
else \
rel_crit(GV_CUR_REGION); \
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON); \
return; \
} \
}
#endif
#define GET_CONFIRM_AND_HANDLE_NEG_RESPONSE \
{ \
int len; \
char confirm[256]; \
\
len = SIZEOF(confirm); \
GET_CONFIRM(confirm, len); \
if (confirm[0] != 'Y' && confirm[0] != 'y') \
{ \
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON); \
return; \
} \
}
#define DSE_WCREINIT(CS_ADDRS) \
{ \
assert(CS_ADDRS->now_crit); \
bt_init(CS_ADDRS); \
if (CS_ADDRS->hdr->acc_meth == dba_bg) \
{ \
bt_refresh(CS_ADDRS, TRUE); \
db_csh_ini(CS_ADDRS); \
db_csh_ref(CS_ADDRS, TRUE); \
send_msg(VARLSTCNT(4) ERR_DSEWCREINIT, 2, DB_LEN_STR(gv_cur_region)); \
} \
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -21,16 +21,8 @@
#include "gtmmsg.h"
#if defined(UNIX)
#define GET_CONFIRM(X,Y) {PRINTF("CONFIRMATION: ");FGETS((X), (Y), stdin, fgets_res);Y = strlen(X);}
#include "gtm_ipc.h"
GBLREF uint4 user_id;
#elif defined(VMS)
#define GET_CONFIRM(X,Y) {if(!cli_get_str("CONFIRMATION",(X),&(Y))) {rts_error(VARLSTCNT(1) ERR_DSEWCINITCON); \
return;}}
#else
#error UNSUPPORTED PLATFORM
#endif
#include "gdsblk.h"
@ -65,6 +57,11 @@ GBLREF uint4 process_id;
GBLREF gd_addr *original_header;
GBLREF boolean_t dse_all_dump; /* TRUE if DSE ALL -DUMP is specified */
error_def(ERR_DBRDONLY);
error_def(ERR_DSEWCINITCON);
error_def(ERR_FREEZE);
error_def(ERR_FREEZECTRL);
void dse_all(void)
{
gd_region *ptr;
@ -74,8 +71,6 @@ void dse_all(void)
gd_region *old_region;
block_id old_block;
int4 stat;
char confirm[256];
unsigned short len;
boolean_t ref = FALSE;
boolean_t crit = FALSE;
boolean_t wc = FALSE;
@ -89,14 +84,7 @@ void dse_all(void)
boolean_t was_crit;
gd_addr *temp_gdaddr;
gd_binding *map;
#ifdef UNIX
char *fgets_res;
#endif
error_def(ERR_DSEWCINITCON);
error_def(ERR_FREEZE);
error_def(ERR_DBRDONLY);
error_def(ERR_FREEZECTRL);
UNIX_ONLY(char *fgets_res;)
old_addrs = cs_addrs;
old_region = gv_cur_region;
@ -106,13 +94,7 @@ void dse_all(void)
if (cli_present("RENEW") == CLI_PRESENT)
{
crit = ref = wc = nofreeze = TRUE;
len = SIZEOF(confirm);
GET_CONFIRM(confirm,len);
if (confirm[0] != 'Y' && confirm[0] != 'y')
{
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON);
return;
}
GET_CONFIRM_AND_HANDLE_NEG_RESPONSE;
} else
{
if (cli_present("CRITINIT") == CLI_PRESENT)
@ -121,14 +103,8 @@ void dse_all(void)
ref = TRUE;
if (cli_present("WCINIT") == CLI_PRESENT)
{
GET_CONFIRM_AND_HANDLE_NEG_RESPONSE;
wc = TRUE;
len = SIZEOF(confirm);
GET_CONFIRM(confirm,len);
if (confirm[0] != 'Y' && confirm[0] != 'y')
{
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON);
return;
}
}
if (cli_present("BUFFER_FLUSH") == CLI_PRESENT)
flush = TRUE;
@ -224,19 +200,14 @@ void dse_all(void)
{
if (!was_crit)
grab_crit(gv_cur_region); /* no point seizing crit if WE already have it held */
cs_addrs->hold_onto_crit = TRUE; /* need to do this AFTER grab_crit */
cs_addrs->hold_onto_crit = TRUE; /* need to do this AFTER grab_crit */
cs_addrs->dse_crit_seize_done = TRUE;
}
if (wc)
{
if (!was_crit && !seize)
grab_crit(gv_cur_region);
bt_init(cs_addrs);
if (cs_addrs->hdr->acc_meth == dba_bg)
{
bt_refresh(cs_addrs);
db_csh_ini(cs_addrs);
db_csh_ref(cs_addrs);
}
DSE_WCREINIT(cs_addrs);
if (!was_crit && (!seize || release))
rel_crit(gv_cur_region);
}
@ -244,12 +215,18 @@ void dse_all(void)
wcs_flu(WCSFLU_FLUSH_HDR | WCSFLU_WRITE_EPOCH | WCSFLU_SYNC_EPOCH);
if (release)
{ /* user wants crit to be released unconditionally so "was_crit" not checked like everywhere else */
cs_addrs->hold_onto_crit = FALSE; /* need to do this BEFORE rel_crit */
if (cs_addrs->now_crit)
{
cs_addrs->dse_crit_seize_done = FALSE;
cs_addrs->hold_onto_crit = FALSE; /* need to do this BEFORE rel_crit */
rel_crit(gv_cur_region);
}
else
{
assert(!cs_addrs->hold_onto_crit && !cs_addrs->dse_crit_seize_done);
util_out_print("Current process does not own the Region: !AD.",
TRUE, REG_LEN_STR(gv_cur_region));
}
}
if (nofreeze)
{

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -44,20 +44,20 @@ GBLREF int patch_fdmp_recs;
GBLREF int patch_rec_counter;
LITREF char *gtm_dbversion_table[];
error_def(ERR_BITMAPSBAD);
error_def(ERR_CTRLC);
error_def(ERR_DSEBLKRDFAIL);
boolean_t dse_b_dmp(void)
{
int4 util_len, head, lmap_num, iter1, iter2, mapsize, bplmap, nocrit_present, dummy_int, len, count;
unsigned char util_buff[MAX_UTIL_LEN], mask;
boolean_t free, was_crit, invalid_bitmap = FALSE, is_mm;
boolean_t free, was_crit, was_hold_onto_crit, invalid_bitmap = FALSE, is_mm;
block_id blk;
sm_uc_ptr_t bp, b_top, rp, mb, dump_record(sm_uc_ptr_t rp, block_id blk, sm_uc_ptr_t bp, sm_uc_ptr_t b_top);
cache_rec_ptr_t cr;
enum db_ver ondsk_blkver;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
error_def(ERR_BITMAPSBAD);
head = cli_present("HEADER");
if (CLI_PRESENT == cli_present("BLOCK"))
{
@ -87,19 +87,19 @@ boolean_t dse_b_dmp(void)
patch_rec_counter = 1;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
for ( ; ; )
{
if (blk / bplmap * bplmap != blk)
{
if (!(bp = t_qread(blk, &dummy_int, &cr)))
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
}
if (((blk_hdr_ptr_t) bp)->levl && patch_is_fdmp)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
util_out_print("Error: cannot perform GLO/ZWR dump on index block.", TRUE);
return FALSE;
}
@ -138,7 +138,7 @@ boolean_t dse_b_dmp(void)
}
if (util_interrupt)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
rts_error(VARLSTCNT(1) ERR_CTRLC);
break;
}
@ -148,7 +148,7 @@ boolean_t dse_b_dmp(void)
{
if (!(bp = t_qread(blk, &dummy_int, &cr)))
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
}
if (CLI_NEGATED != head)
@ -235,7 +235,8 @@ boolean_t dse_b_dmp(void)
util_out_print("|", TRUE);
if (util_interrupt)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs,
gv_cur_region);
rts_error(VARLSTCNT(1) ERR_CTRLC);
}
}
@ -243,7 +244,8 @@ boolean_t dse_b_dmp(void)
TRUE,1, BUSY_CHAR, 1, FREE_CHAR, 1, REUSABLE_CHAR, 1, CORRUPT_CHAR);
if (invalid_bitmap)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs,
gv_cur_region);
rts_error(VARLSTCNT(1) ERR_BITMAPSBAD);
}
}
@ -256,6 +258,6 @@ boolean_t dse_b_dmp(void)
blk = 0;
}
patch_curr_blk = blk;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return TRUE;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2003, 2010 Fidelity Information Services, Inc *
* Copyright 2003, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -33,6 +33,8 @@
GBLREF gd_region *gv_cur_region;
GBLREF gd_addr *original_header;
error_def(ERR_SIZENOTVALID4);
#define DB_ABS2REL(X) ((sm_uc_ptr_t)(X) - (sm_uc_ptr_t)csa->nl)
#define MAX_UTIL_LEN 40
#define CLEAN_VERIFY "verification is clean"
@ -54,9 +56,7 @@ void dse_cache(void)
sm_uc_ptr_t chng_ptr;
cache_rec_ptr_t cr_que_lo;
mmblk_rec_ptr_t mr_que_lo;
boolean_t is_mm;
error_def(ERR_SIZENOTVALID4);
boolean_t is_mm, was_hold_onto_crit;
all_present = (CLI_PRESENT == cli_present("ALL"));
@ -93,8 +93,7 @@ void dse_cache(void)
csa = &FILE_INFO(reg)->s_addrs;
assert(is_mm || (csa->db_addrs[0] == (sm_uc_ptr_t)csa->nl));
was_crit = csa->now_crit;
if (!was_crit && !nocrit_present)
grab_crit(reg);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, csa, reg);
if (verify_present || recover_present)
{
GET_CURR_TIME_IN_DOLLARH_AND_ZDATE(dollarh_mval, dollarh_buffer, zdate_mval, zdate_buffer);
@ -226,8 +225,7 @@ void dse_cache(void)
util_out_print("Region !AD : db_file_header = 0x!XJ", TRUE, REG_LEN_STR(reg), csa->hdr);
}
}
if (!was_crit && !nocrit_present)
rel_crit(reg);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, csa, reg);
}
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -56,6 +56,10 @@ GBLREF boolean_t unhandled_stale_timer_pop;
GBLREF unsigned char *non_tp_jfb_buff_ptr;
GBLREF cw_set_element cw_set[];
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEFAIL);
error_def(ERR_DBRDONLY);
void dse_chng_bhead(void)
{
block_id blk;
@ -79,10 +83,6 @@ void dse_chng_bhead(void)
blk_hdr_ptr_t bp, save_bp, save_old_block;
# endif
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEFAIL);
error_def(ERR_DBRDONLY);
if (gv_cur_region->read_only)
rts_error(VARLSTCNT(4) ERR_DBRDONLY, 2, DB_LEN_STR(gv_cur_region));
CHECK_AND_RESET_UPDATE_ARRAY; /* reset update_array_ptr to update_array */
@ -201,7 +201,7 @@ void dse_chng_bhead(void)
/* Pass the desired tn as argument to bg_update/mm_update below */
BUILD_AIMG_IF_JNL_ENABLED(csd, non_tp_jfb_buff_ptr, tn);
was_hold_onto_crit = csa->hold_onto_crit;
csa->hold_onto_crit = TRUE;
csa->hold_onto_crit = TRUE; /* need this so t_end doesn't release crit (see below comment for why) */
t_end(&dummy_hist, NULL, tn);
# ifdef GTM_CRYPT
if (csd->is_encrypted && (tn < csa->ti->curr_tn))
@ -219,7 +219,8 @@ void dse_chng_bhead(void)
* buffer and therefore use that to write the pblk, which is incorrect since it does not yet contain the
* tn update. The consequence of this is would be writing an older before-image PBLK) record to the
* journal file. To prevent this situation, we update the encryption buffer here (before releasing crit)
* using logic like that in wcs_wtstart to ensure it is in sync with the regular global buffer.
* using logic like that in wcs_wtstart to ensure it is in sync with the regular global buffer. To ensure
* that t_end doesn't release crit, we set csa->hold_onto_crit to TRUE
* Note:
* Although we use cw_set[0] to access the global buffer corresponding to the block number being updated,
* cw_set_depth at this point is 0 because t_end resets it. This is considered safe since cw_set is a
@ -244,8 +245,7 @@ void dse_chng_bhead(void)
memcpy(save_bp, bp, bp->bsiz);
}
# endif
if (!was_hold_onto_crit)
csa->hold_onto_crit = FALSE;
csa->hold_onto_crit = was_hold_onto_crit;
if (!was_crit)
rel_crit(gv_cur_region);
if (unhandled_stale_timer_pop)

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -62,22 +62,11 @@ error_def(ERR_DBRDONLY);
error_def(ERR_SIZENOTVALID8);
error_def(ERR_FREEZECTRL);
#define CLNUP_CRIT \
{ \
if (!was_crit) \
{ \
if (nocrit_present) \
cs_addrs->now_crit = FALSE; \
else \
rel_crit(gv_cur_region); \
} \
}
void dse_chng_fhead(void)
{
int4 x, index_x, save_x;
unsigned short buf_len;
bool was_crit;
boolean_t was_crit, was_hold_onto_crit;
boolean_t override = FALSE;
int4 nocrit_present;
int4 location_present, value_present, size_present, size;
@ -103,13 +92,7 @@ void dse_chng_fhead(void)
memset(buf, 0, MAX_LINE);
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
if (!was_crit)
{
if (nocrit_present)
cs_addrs->now_crit = TRUE;
else
grab_crit(gv_cur_region);
}
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (CLI_PRESENT == cli_present("OVERRIDE"))
override = TRUE;
#ifdef VMS
@ -121,7 +104,7 @@ void dse_chng_fhead(void)
&& !override)
#endif
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
util_out_print("Region: !AD is frozen by another user, not releasing freeze.",
TRUE, REG_LEN_STR(gv_cur_region));
rts_error(VARLSTCNT(4) ERR_FREEZE, 2, REG_LEN_STR(gv_cur_region));
@ -135,7 +118,7 @@ void dse_chng_fhead(void)
location_present = TRUE;
if (!cli_get_hex("LOCATION", &location))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -144,7 +127,7 @@ void dse_chng_fhead(void)
location_present = TRUE;
if (!cli_get_hex("HEXLOCATION", &location))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -153,7 +136,7 @@ void dse_chng_fhead(void)
location_present = TRUE;
if (!cli_get_int("DECLOCATION", (int4 *)&location))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -163,7 +146,7 @@ void dse_chng_fhead(void)
size_present = TRUE;
if (!cli_get_int("SIZE", &size))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -173,7 +156,7 @@ void dse_chng_fhead(void)
value_present = TRUE;
if (!cli_get_hex64("VALUE", (gtm_uint64_t *)&value))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -182,7 +165,7 @@ void dse_chng_fhead(void)
value_present = TRUE;
if (!cli_get_hex64("HEXVALUE", &value))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -191,7 +174,7 @@ void dse_chng_fhead(void)
value_present = TRUE;
if (!cli_get_uint64("DECVALUE", (gtm_uint64_t *)&value))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
}
@ -202,7 +185,7 @@ void dse_chng_fhead(void)
if (!((SIZEOF(char) == size) || (SIZEOF(short) == size) || (SIZEOF(int4) == size) ||
(SIZEOF(gtm_int64_t) == size)))
{
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
rts_error(VARLSTCNT(1) ERR_SIZENOTVALID8);
}
if ((0 > (int4)size) || ((uint4)SGMNT_HDR_LEN < (uint4)location)
@ -267,8 +250,7 @@ void dse_chng_fhead(void)
else
{
cs_addrs->hdr->blk_size = ((x/DISK_BLOCK_SIZE) + 1) * DISK_BLOCK_SIZE;
CLNUP_CRIT;
rts_error(VARLSTCNT(4) ERR_BLKSIZ512, 2, x, cs_addrs->hdr->blk_size);
gtm_putmsg(VARLSTCNT(4) ERR_BLKSIZ512, 2, x, cs_addrs->hdr->blk_size);
}
}
if ((CLI_PRESENT == cli_present("RECORD_MAX_SIZE")) && (cli_get_int("RECORD_MAX_SIZE", &x)))
@ -422,6 +404,16 @@ void dse_chng_fhead(void)
/* ---------- End ------ CURRENT_TN/MAX_TN/WARN_MAX_TN processing -------- */
if (CLI_PRESENT == cli_present("REG_SEQNO") && cli_get_hex64("REG_SEQNO", (gtm_uint64_t *)&seq_no))
cs_addrs->hdr->reg_seqno = seq_no;
UNIX_ONLY(
if (CLI_PRESENT == cli_present("STRM_NUM"))
{
assert(CLI_PRESENT == cli_present("STRM_REG_SEQNO"));
if (cli_get_int("STRM_NUM", &x) && (0 <= x) && (MAX_SUPPL_STRMS > x)
&& (CLI_PRESENT == cli_present("STRM_REG_SEQNO"))
&& cli_get_hex64("STRM_REG_SEQNO", (gtm_uint64_t *)&seq_no))
cs_addrs->hdr->strm_reg_seqno[x] = seq_no;
}
)
VMS_ONLY(
if (CLI_PRESENT == cli_present("RESYNC_SEQNO") && cli_get_hex64("RESYNC_SEQNO", (gtm_uint64_t *)&seq_no))
cs_addrs->hdr->resync_seqno = seq_no;
@ -433,8 +425,6 @@ void dse_chng_fhead(void)
cs_addrs->hdr->zqgblmod_seqno = seq_no;
if (CLI_PRESENT == cli_present("ZQGBLMOD_TN") && cli_get_hex64("ZQGBLMOD_TN", &tn))
cs_addrs->hdr->zqgblmod_tn = tn;
if (CLI_PRESENT == cli_present("DUALSITE_RESYNC_SEQNO") && cli_get_hex64("DUALSITE_RESYNC_SEQNO", &seq_no))
cs_addrs->hdr->dualsite_resync_seqno = seq_no;
)
if (CLI_PRESENT == cli_present("STDNULLCOLL"))
{
@ -764,6 +754,6 @@ void dse_chng_fhead(void)
else
cs_addrs->hdr->writer_trigger_factor = x;
}
CLNUP_CRIT;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -35,6 +35,8 @@ GBLREF uint4 process_id;
GBLREF short crash_count;
GBLREF gd_addr *original_header;
error_def(ERR_DBRDONLY);
#define MAX_UTIL_LEN 80
void dse_crit(void)
@ -44,8 +46,6 @@ void dse_crit(void)
boolean_t crash = FALSE, cycle = FALSE, owner = FALSE;
gd_region *save_region, *r_local, *r_top;
error_def(ERR_DBRDONLY);
crash = ((cli_present("CRASH") == CLI_PRESENT) || (cli_present("RESET") == CLI_PRESENT));
cycle = (CLI_PRESENT == cli_present("CYCLE"));
if (cli_present("SEIZE") == CLI_PRESENT || cycle)
@ -60,6 +60,7 @@ void dse_crit(void)
crash_count = cs_addrs->critical->crashcnt;
grab_crit(gv_cur_region);
cs_addrs->hold_onto_crit = TRUE; /* need to do this AFTER grab_crit */
cs_addrs->dse_crit_seize_done = TRUE;
util_out_print("!/Seized write critical section.!/", TRUE);
if (!cycle)
return;
@ -76,10 +77,16 @@ void dse_crit(void)
crash_count = cs_addrs->critical->crashcnt;
if (cs_addrs->now_crit)
{ /* user wants crit to be released unconditionally so "was_crit" not checked like everywhere else */
assert(cs_addrs->hold_onto_crit && cs_addrs->dse_crit_seize_done);
cs_addrs->dse_crit_seize_done = FALSE;
cs_addrs->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
rel_crit(gv_cur_region);
util_out_print("!/Released write critical section.!/", TRUE);
}
# ifdef DEBUG
else
assert(!cs_addrs->hold_onto_crit && !cs_addrs->dse_crit_seize_done);
# endif
return;
}
if (cli_present("INIT") == CLI_PRESENT)
@ -116,6 +123,7 @@ void dse_crit(void)
* TRUE. Set that back to FALSE now that we are going to release control of crit.
*/
cs_addrs->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
cs_addrs->dse_crit_seize_done = FALSE;
rel_crit(gv_cur_region);
util_out_print("!/Removed owner of write critical section!/", TRUE);
} else
@ -124,6 +132,7 @@ void dse_crit(void)
* TRUE. Set that back to FALSE now that we are going to release control of crit.
*/
cs_addrs->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
cs_addrs->dse_crit_seize_done = FALSE;
rel_crit(gv_cur_region);
util_out_print("!/Removed owner of write critical section!/", TRUE);
util_out_print("!/WARNING: No recovery because database is MM.!/", TRUE);

View File

@ -88,7 +88,7 @@ void dse_dmp_fhead (void)
{
boolean_t jnl_buff_open;
unsigned char util_buff[MAX_UTIL_LEN], buffer[MAXNUMLEN];
int util_len, rectype, time_len, index, idx;
int util_len, rectype, time_len, index;
uint4 jnl_status;
enum jnl_state_codes jnl_state;
gds_file_id zero_fid;
@ -255,8 +255,7 @@ void dse_dmp_fhead (void)
if (CLI_PRESENT == cli_present("ALL"))
{ /* Only dump if -/ALL as if part of above display */
util_out_print(0, TRUE);
UNIX_ONLY(util_out_print(" Dualsite Resync Seqno 0x!16@XQ", FALSE, &csd->dualsite_resync_seqno);)
VMS_ONLY(util_out_print(" ", FALSE);)
util_out_print(" ", FALSE);
util_out_print(" DB Current Minor Version !4UL", TRUE, csd->minor_dbver);
util_out_print(" Blks Last Record Backup 0x!XL", FALSE, csd->last_rec_bkup_last_blk);
util_out_print(" Last GT.M Minor Version !4UL", TRUE, csd->last_mdb_ver);
@ -299,6 +298,18 @@ void dse_dmp_fhead (void)
GET_HASH_IN_HEX(csd->encryption_hash, outbuf, GTMCRYPT_HASH_HEX_LEN);
util_out_print(" Database file encryption hash !AD", TRUE, GTMCRYPT_HASH_HEX_LEN, outbuf);
}
# ifdef UNIX
if (NEED_TO_DUMP("SUPPLEMENTARY"))
{
util_out_print(0, TRUE);
assert(MAX_SUPPL_STRMS == ARRAYSIZE(csd->strm_reg_seqno));
for (index = 0; index < MAX_SUPPL_STRMS; index++)
{
if (csd->strm_reg_seqno[index])
util_out_print(" Stream !2UL: Reg Seqno 0x!16@XQ", TRUE, index, &csd->strm_reg_seqno[index]);
}
}
# endif
if (NEED_TO_DUMP("ENVIRONMENT"))
{
util_out_print(0, TRUE);
@ -398,22 +409,35 @@ void dse_dmp_fhead (void)
util_out_print(" jnl solid tn 0x!16@XQ", TRUE, &csd->jnl_eovtn);
for (rectype = JRT_BAD + 1; rectype < JRT_RECTYPES - 1; rectype++)
{
util_out_print(" Jnl Rec Type !5AZ !7UL ", FALSE, jrt_label[rectype],
util_out_print(" Jnl Rec Type !5AZ 0x!XL ", FALSE, jrt_label[rectype],
jb->reccnt[rectype]);
rectype++;
util_out_print(" Jnl Rec Type !5AZ !7UL", TRUE, jrt_label[rectype], jb->reccnt[rectype]);
util_out_print(" Jnl Rec Type !5AZ 0x!XL", TRUE, jrt_label[rectype], jb->reccnt[rectype]);
}
if (rectype != JRT_RECTYPES)
util_out_print(" Jnl Rec Type !5AZ !7UL", TRUE, jrt_label[rectype], jb->reccnt[rectype]);
util_out_print(" Jnl Rec Type !5AZ 0x!XL", TRUE, jrt_label[rectype], jb->reccnt[rectype]);
util_out_print(0, TRUE);
util_out_print(" Recover interrupted !AD", FALSE, 5, (csd->recov_interrupted ? " TRUE" : "FALSE"));
util_out_print(" ", FALSE);
util_out_print(" INTRPT resolve time !12UL", TRUE, csd->intrpt_recov_tp_resolve_time);
util_out_print(" INTRPT seqno 0x!16@XQ", FALSE, &csd->intrpt_recov_resync_seqno);
util_out_print(" INTRPT jnl_state !12UL", FALSE, csd->intrpt_recov_jnl_state);
util_out_print(" ", FALSE);
util_out_print(" INTRPT jnl_state !12UL", TRUE, csd->intrpt_recov_jnl_state);
util_out_print(" INTRPT repl_state !12UL", FALSE, csd->intrpt_recov_repl_state);
util_out_print(0, TRUE);
util_out_print(" INTRPT repl_state !12UL", TRUE, csd->intrpt_recov_repl_state);
util_out_print(" INTRPT seqno 0x!16@XQ", TRUE, &csd->intrpt_recov_resync_seqno);
UNIX_ONLY(
for (index = 0; index < MAX_SUPPL_STRMS; index++)
{
if (csd->intrpt_recov_resync_strm_seqno[index])
util_out_print(" INTRPT strm_seqno : Stream # !2UL Stream Seqno 0x!16@XQ",
TRUE, index, &csd->intrpt_recov_resync_strm_seqno[index]);
}
for (index = 0; index < MAX_SUPPL_STRMS; index++)
{
if (csd->intrpt_recov_resync_strm_seqno[index])
util_out_print(" SAVE strm_seqno : Stream # !2UL Region Seqno 0x!16@XQ",
TRUE, index, &csd->save_strm_reg_seqno[index]);
}
)
}
if (NEED_TO_DUMP("BACKUP"))
{

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -31,183 +31,164 @@
#define MAX_UTIL_LEN 32
GBLDEF short int patch_path_count;
GBLDEF short int patch_path_count;
GBLREF global_root_list *global_roots_head;
GBLREF block_id patch_find_blk, patch_left_sib, patch_path[MAX_BT_DEPTH + 1], patch_right_sib;
GBLREF bool patch_exh_found;
GBLREF bool patch_find_sibs;
GBLREF bool patch_find_root_search;
GBLREF bool patch_exh_found;
GBLREF block_id patch_path[MAX_BT_DEPTH + 1];
GBLREF global_root_list *global_roots_head;
GBLREF int4 patch_offset[MAX_BT_DEPTH + 1];
GBLREF block_id patch_left_sib,patch_right_sib,patch_find_blk;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF VSIG_ATOMIC_T util_interrupt;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
void dse_exhaus(int4 pp, int4 op)
{
sm_uc_ptr_t bp, np, b_top, rp, r_top, nrp, nr_top, ptr;
char util_buff[MAX_UTIL_LEN];
block_id last;
short temp_short;
int count, util_len;
int4 dummy_int;
cache_rec_ptr_t dummy_cr;
global_dir_path *d_ptr, *temp;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
block_id last;
cache_rec_ptr_t dummy_cr;
char util_buff[MAX_UTIL_LEN];
int count, util_len;
int4 dummy_int;
global_dir_path *d_ptr, *temp;
short temp_short;
sm_uc_ptr_t bp, b_top, np, nrp, nr_top, ptr, rp, r_top;
last = 0;
patch_path_count++;
if(!(bp = t_qread(patch_path[pp - 1],&dummy_int,&dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
b_top = bp + cs_addrs->hdr->blk_size;
else if (((blk_hdr_ptr_t) bp)->bsiz < SIZEOF(blk_hdr))
b_top = bp + SIZEOF(blk_hdr);
else
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz;
for (rp = bp + SIZEOF(blk_hdr); rp < b_top ;rp = r_top)
{
if (util_interrupt)
{
rts_error(VARLSTCNT(1) ERR_CTRLC);
break;
}
if (!(np = t_qread(patch_path[pp - 1],&dummy_int,&dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (np != bp)
{
b_top = np + (b_top - bp);
rp = np + (rp - bp);
r_top = np + (r_top - bp);
bp = np;
}
GET_SHORT(temp_short,&((rec_hdr_ptr_t) rp)->rsiz);
r_top = rp + temp_short;
if (r_top > b_top)
r_top = b_top;
if (r_top - rp < SIZEOF(block_id))
break;
if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_path[pp],(r_top - SIZEOF(block_id)));
last = 0;
patch_path_count++;
if(!(bp = t_qread(patch_path[pp - 1], &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
b_top = bp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t) bp)->bsiz)
b_top = bp + SIZEOF(blk_hdr);
else
b_top = bp + ((blk_hdr_ptr_t)bp)->bsiz;
for (rp = bp + SIZEOF(blk_hdr); rp < b_top; rp = r_top)
{
for (ptr = rp + SIZEOF(rec_hdr); ; )
{
if (*ptr++ == 0 && *ptr++ ==0)
break;
}
GET_LONG(patch_path[pp],ptr);
}
patch_offset[op] = (int4)(rp - bp);
if (patch_path[pp] == patch_find_blk)
{
if (!patch_exh_found)
{
if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings",TRUE);
patch_exh_found = TRUE;
}
if (patch_find_sibs)
{
patch_left_sib = last;
if (r_top < b_top)
if (util_interrupt)
{
nrp = r_top;
GET_SHORT(temp_short,&((rec_hdr_ptr_t) rp)->rsiz);
nr_top = nrp + temp_short;
if (nr_top > b_top)
nr_top = b_top;
if (nr_top - nrp >= SIZEOF(block_id))
{
if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_right_sib,(nr_top - SIZEOF(block_id)));
else
rts_error(VARLSTCNT(1) ERR_CTRLC);
break;
}
if (!(np = t_qread(patch_path[pp - 1], &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (np != bp)
{
b_top = np + (b_top - bp);
rp = np + (rp - bp);
r_top = np + (r_top - bp);
bp = np;
}
GET_SHORT(temp_short, &((rec_hdr_ptr_t)rp)->rsiz);
r_top = rp + temp_short;
if (r_top > b_top)
r_top = b_top;
if (SIZEOF(block_id) > (r_top - rp))
break;
if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_path[pp], (r_top - SIZEOF(block_id)));
else
{
for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= r_top);)
;
GET_LONG(patch_path[pp], ptr);
}
patch_offset[op] = (int4)(rp - bp);
if (patch_path[pp] == patch_find_blk)
{
if (!patch_exh_found)
{
for (ptr = rp + SIZEOF(rec_hdr); ;)
{
if (*ptr++ == 0 && *ptr++ == 0)
break;
}
GET_LONG(patch_right_sib,ptr);
if (patch_find_sibs)
util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
patch_exh_found = TRUE;
}
if (patch_find_sibs)
{
patch_left_sib = last;
if (r_top < b_top)
{
nrp = r_top;
GET_SHORT(temp_short, &((rec_hdr_ptr_t)rp)->rsiz);
nr_top = nrp + temp_short;
if (nr_top > b_top)
nr_top = b_top;
if (SIZEOF(block_id) <= (nr_top - nrp))
{
if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_right_sib, (nr_top - SIZEOF(block_id)));
else
{
for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= nr_top);)
;
GET_LONG(patch_right_sib, ptr);
}
}
} else
patch_right_sib = 0;
if (patch_left_sib)
util_out_print("!_0x!XL", FALSE, patch_left_sib);
else
util_out_print("!_none!_", FALSE);
util_out_print("!_0x!XL!_", FALSE, patch_find_blk);
if (patch_right_sib)
util_out_print("0x!XL!/", TRUE, patch_right_sib);
else
util_out_print("none!/", TRUE);
} else /* !patch_find_sibs */
{
patch_path_count--;
util_out_print(" Directory path!/ Path--blk:off", TRUE);
if (!patch_find_root_search)
{
d_ptr = global_roots_head->link->dir_path;
while (d_ptr)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(d_ptr->block, (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(d_ptr->offset, (uchar_ptr_t)&util_buff[util_len], 4);
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
temp = d_ptr;
d_ptr = d_ptr->next;
free(temp);
}
global_roots_head->link->dir_path = 0;
util_out_print("!/!/ Global paths!/ Path--blk:off", TRUE);
}
for (count = 0; count < patch_path_count; count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4);
util_buff[util_len] = 0;
util_out_print(util_buff,FALSE);
}
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
patch_path_count++;
}
}
}
else
patch_right_sib = 0;
if (patch_left_sib)
if ((0 < patch_path[pp]) && (patch_path[pp] < cs_addrs->ti->total_blks) && (patch_path[pp] % cs_addrs->hdr->bplmap))
{
memcpy(util_buff," ",1);
util_len = 1;
util_len += i2hex_nofill(patch_left_sib,(uchar_ptr_t)&util_buff[util_len],8);
memcpy(&util_buff[util_len]," ",1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff,FALSE);
}else
util_out_print(" none ",FALSE);
if (patch_right_sib)
{
memcpy(util_buff," ",1);
util_len = 1;
util_len += i2hex_nofill(patch_right_sib,(uchar_ptr_t)&util_buff[util_len],8);
util_buff[util_len] = 0;
util_out_print(util_buff,FALSE);
if (1 < ((blk_hdr_ptr_t)bp)->levl)
dse_exhaus(pp + 1, op + 1);
else if ((1 == ((blk_hdr_ptr_t)bp)->levl) && patch_find_root_search)
dse_find_roots(patch_path[pp]);
}
else
util_out_print(" none",TRUE);
}
else /* !patch_find_sibs */
{
patch_path_count--;
util_out_print(" Directory path!/ Path--blk:off",TRUE);
if (!patch_find_root_search)
{
d_ptr = global_roots_head->link->dir_path;
while(d_ptr)
{
memcpy(util_buff," ",1);
util_len = 1;
util_len += i2hex_nofill(d_ptr->block,(uchar_ptr_t)&util_buff[util_len],8);
memcpy(&util_buff[util_len],":",1);
util_len += 1;
util_len += i2hex_nofill(d_ptr->offset,(uchar_ptr_t)&util_buff[util_len],4);
util_buff[util_len] = 0;
util_out_print(util_buff,FALSE);
temp = d_ptr;
d_ptr = d_ptr->next;
free(temp);
}
global_roots_head->link->dir_path = 0;
util_out_print("!/!/ Global paths!/ Path--blk:off",TRUE);
}
for (count = 0; count < patch_path_count ;count++)
{
memcpy(util_buff," ",1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count],(uchar_ptr_t)&util_buff[util_len],8);
memcpy(&util_buff[util_len],":",1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count],(uchar_ptr_t)&util_buff[util_len],4);
util_buff[util_len] = 0;
util_out_print(util_buff,FALSE);
}
memcpy(util_buff," ",1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count],(uchar_ptr_t)&util_buff[util_len],8);
util_buff[util_len] = 0;
util_out_print(util_buff,TRUE);
patch_path_count++;
}
last = patch_path[pp];
}
if (patch_path[pp] > 0 && patch_path[pp] < cs_addrs->ti->total_blks
&& (patch_path[pp] % cs_addrs->hdr->bplmap))
if (((blk_hdr_ptr_t) bp)->levl > 1)
dse_exhaus(pp + 1,op + 1);
else if (((blk_hdr_ptr_t)bp)->levl == 1 && patch_find_root_search)
dse_find_roots(patch_path[pp]);
last = patch_path[pp];
}
patch_path_count--;
return;
patch_path_count--;
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2008 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -13,18 +13,28 @@
#include "gtm_stdlib.h" /* for exit() */
#ifdef DEBUG
#include "gdsroot.h"
#include "gdsbt.h"
#include "gtm_facility.h"
#include "gdsfhead.h"
#endif
#include "error.h"
#include "iosp.h"
#include "util.h"
#include "dse_exit.h"
GBLREF unsigned int t_tries;
#ifdef DEBUG
GBLREF sgmnt_addrs *cs_addrs;
#endif
void dse_exit(void)
{
/* reset t_tries (from CDB_STAGNATE to 0) as we are exiting and no longer going to be running transactions
* and an assert in wcs_recover relies on this */
t_tries = 0;
assert((NULL == cs_addrs) || !cs_addrs->now_crit || cs_addrs->hold_onto_crit);
util_out_close();
EXIT(SS_NORMAL);
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -31,332 +31,462 @@
/* Include prototypes*/
#include "t_qread.h"
GBLDEF bool patch_exh_found, patch_find_root_search, patch_find_sibs;
GBLDEF block_id patch_find_blk, patch_left_sib, patch_right_sib;
GBLDEF block_id patch_path[MAX_BT_DEPTH + 1], patch_path1[MAX_BT_DEPTH + 1];
GBLDEF global_root_list *global_roots_head, *global_roots_tail;
GBLDEF block_id patch_left_sib, patch_right_sib, patch_find_blk;
GBLDEF block_id patch_path[MAX_BT_DEPTH + 1];
GBLDEF block_id patch_path1[MAX_BT_DEPTH + 1];
GBLDEF int4 patch_offset[MAX_BT_DEPTH + 1];
GBLDEF int4 patch_offset1[MAX_BT_DEPTH + 1];
GBLDEF bool patch_find_sibs;
GBLDEF bool patch_exh_found;
GBLDEF bool patch_find_root_search;
GBLDEF int4 patch_offset[MAX_BT_DEPTH + 1], patch_offset1[MAX_BT_DEPTH + 1];
GBLDEF short int patch_dir_path_count;
GBLREF block_id patch_curr_blk;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk;
GBLREF short int patch_path_count;
#define MAX_UTIL_LEN 33
static boolean_t was_crit;
static int4 nocrit_present;
static boolean_t was_crit, was_hold_onto_crit, nocrit_present;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
void dse_f_blk(void)
{
global_root_list *temp;
global_dir_path *d_ptr, *dtemp;
block_id blk;
bool exhaust;
char targ_key[256], util_buff[MAX_UTIL_LEN];
sm_uc_ptr_t bp, b_top, rp, r_top, key_top, blk_id;
short int size, count, rsize;
int util_len;
int4 dummy_int;
cache_rec_ptr_t dummy_cr;
block_id blk, last, look;
boolean_t exhaust;
cache_rec_ptr_t dummy_cr;
char targ_key[MAX_KEY_SZ + 1], util_buff[MAX_UTIL_LEN];
global_root_list *temp;
global_dir_path *d_ptr, *dtemp;
int util_len;
int4 dummy_int;
sm_uc_ptr_t blk_id, bp, b_top, key_top, rp, r_top, sp, srp, s_top;
short int count, rsize, size;
char lvl;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
if (cli_present("BLOCK") == CLI_PRESENT)
{
if(!cli_get_hex("BLOCK", (uint4 *)&blk))
return;
if (blk < 0 || blk >= cs_addrs->ti->total_blks
|| !(blk % cs_addrs->hdr->bplmap))
if (CLI_PRESENT == cli_present("BLOCK"))
{
util_out_print("Error: invalid block number.", TRUE);
return;
}
patch_curr_blk = blk;
}
patch_find_sibs = (cli_present("SIBLINGS") == CLI_PRESENT);
patch_find_blk = patch_curr_blk;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
/* ESTABLISH is done here because dse_f_blk_ch() assumes we already
* have crit.
*/
ESTABLISH(dse_f_blk_ch);
if(!(bp = t_qread(patch_find_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
b_top = bp + cs_addrs->hdr->blk_size;
else if (((blk_hdr_ptr_t) bp)->bsiz < SIZEOF(blk_hdr))
b_top = bp + SIZEOF(blk_hdr);
else
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz;
rp = bp + SIZEOF(blk_hdr);
GET_SHORT(rsize, &((rec_hdr_ptr_t) rp)->rsiz);
if (rsize < SIZEOF(rec_hdr))
r_top = rp + SIZEOF(rec_hdr);
else
r_top = rp + rsize;
if (r_top > b_top)
r_top = b_top;
for (key_top = rp + SIZEOF(rec_hdr); key_top < r_top ; )
{
if (!*key_top++)
break;
}
if (((blk_hdr_ptr_t)bp)->levl && key_top > (blk_id = r_top - SIZEOF(block_id)))
key_top = blk_id;
patch_path_count = 1;
patch_path[0] = get_dir_root();
patch_left_sib = patch_right_sib = 0;
size = key_top - rp - SIZEOF(rec_hdr);
if (size > SIZEOF(targ_key))
size = SIZEOF(targ_key);
patch_find_root_search = TRUE;
if ((exhaust = (cli_present("EXHAUSTIVE") == CLI_PRESENT)) || size <= 0)
{
if (size < 0)
{
util_out_print("No keys in block, cannot perform ordered search.", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
if (patch_exh_found = (patch_find_blk == patch_path[0]))
{
if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings!/ none none", TRUE);
else
{
memcpy(util_buff, "!/ Paths--blk:off!/ ", 24);
util_len = 24;
util_len += i2hex_nofill(patch_find_blk, (uchar_ptr_t)&util_buff[util_len],
8);
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
}
}
else
{
global_roots_head = (global_root_list *)malloc(SIZEOF(global_root_list));
global_roots_tail = global_roots_head;
global_roots_head->link = (global_root_list *)0;
global_roots_head->dir_path = (global_dir_path *)0;
dse_exhaus(1, 0);
patch_find_root_search = FALSE;
while (!patch_exh_found && global_roots_head->link)
{
patch_path[0] = global_roots_head->link->root;
patch_path_count = 1;
patch_left_sib = patch_right_sib = 0;
if (patch_exh_found = (patch_find_blk == patch_path[0]))
if (!cli_get_hex("BLOCK", (uint4 *)&blk))
return;
if ((0 > blk) || (blk >= cs_addrs->ti->total_blks) || !(blk % cs_addrs->hdr->bplmap))
{
if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings!/ none none", TRUE);
else
{
patch_path_count--;
util_out_print(" Directory path!/ Path--blk:off", TRUE);
if (!patch_find_root_search)
util_out_print("Error: invalid block number.", TRUE);
return;
}
patch_curr_blk = blk;
}
patch_find_sibs = (CLI_PRESENT == cli_present("SIBLINGS"));
patch_find_blk = patch_curr_blk;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
/* ESTABLISH is done here because dse_f_blk_ch() assumes we already have crit. */
ESTABLISH(dse_f_blk_ch);
if (!(bp = t_qread(patch_find_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
b_top = bp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t) bp)->bsiz)
b_top = bp + SIZEOF(blk_hdr);
else
b_top = bp + ((blk_hdr_ptr_t)bp)->bsiz;
rp = bp + SIZEOF(blk_hdr);
GET_SHORT(rsize, &((rec_hdr_ptr_t) rp)->rsiz);
if (SIZEOF(rec_hdr) > rsize)
r_top = rp + SIZEOF(rec_hdr);
else
r_top = rp + rsize;
if (r_top > b_top)
r_top = b_top;
for (key_top = rp + SIZEOF(rec_hdr); (key_top < r_top) && *key_top++; )
;
if (((blk_hdr_ptr_t)bp)->levl && key_top > (blk_id = r_top - SIZEOF(block_id))) /* NOTE assignment */
key_top = blk_id;
patch_path_count = 1;
patch_path[0] = get_dir_root();
patch_left_sib = patch_right_sib = 0;
size = key_top - rp - SIZEOF(rec_hdr);
if (SIZEOF(targ_key) < size)
size = SIZEOF(targ_key);
patch_find_root_search = TRUE;
if ((exhaust = (cli_present("EXHAUSTIVE") == CLI_PRESENT)) || (0 >= size)) /* NOTE assignment */
{
if (size < 0)
{
util_out_print("No keys in block, cannot perform ordered search.", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
if (patch_exh_found = (patch_find_blk == patch_path[0])) /* NOTE assignment */
{
if (patch_find_sibs)
{
d_ptr = global_roots_head->link->dir_path;
while(d_ptr)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(d_ptr->block,
(uchar_ptr_t)&util_buff[util_len],
8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(d_ptr->offset,
(uchar_ptr_t)&util_buff[util_len],
4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
temp = (global_root_list *)d_ptr;
d_ptr = d_ptr->next;
util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
util_out_print("!_none!_!_0x!XL!_none",TRUE, patch_find_blk);
} else
{
assert(1 == patch_path[0]); /* OK to assert because pro prints */
util_out_print("!/ Directory path!/ Path--blk:off!/!_1", TRUE);
}
} else
{
global_roots_head = (global_root_list *)malloc(SIZEOF(global_root_list));
global_roots_tail = global_roots_head;
global_roots_head->link = NULL;
global_roots_head->dir_path = NULL;
dse_exhaus(1, 0);
patch_find_root_search = FALSE;
while (!patch_exh_found && global_roots_head->link)
{
patch_path[0] = global_roots_head->link->root;
patch_path_count = 1;
patch_left_sib = patch_right_sib = 0;
if (patch_exh_found = (patch_find_blk == patch_path[0])) /* NOTE assignment */
{
if (patch_find_sibs)
{
util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
util_out_print("!_none!_!_0x!XL!_none",TRUE, patch_find_blk);
} else
{
patch_path_count--;
util_out_print("!/ Directory path!/ Path--blk:off", TRUE);
if (!patch_find_root_search)
{
d_ptr = global_roots_head->link->dir_path;
while (d_ptr)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(d_ptr->block,
(uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(d_ptr->offset,
(uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
temp = (global_root_list *)d_ptr;
d_ptr = d_ptr->next;
free(temp);
}
global_roots_head->link->dir_path = 0;
util_out_print("!/ Global tree path!/ Path--blk:off", TRUE);
}
for (count = 0; count < patch_path_count; count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count],
(uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count],
(uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
}
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
}
} else
dse_exhaus(1, 0);
temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path;
while (d_ptr)
{
dtemp = d_ptr;
d_ptr = d_ptr->next;
free(dtemp);
}
global_roots_head = global_roots_head->link;
free(temp);
}
global_roots_head->link->dir_path = 0;
util_out_print("!/!/ Global paths!/ Path--blk:off", TRUE);
}
for (count = 0; count < patch_path_count ;count++)
while (global_roots_head->link)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count],
(uchar_ptr_t)&util_buff[util_len],
8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path;
while (d_ptr)
{
dtemp = d_ptr;
d_ptr = d_ptr->next;
free(dtemp);
}
global_roots_head = global_roots_head->link;
free(temp);
}
}
if (!patch_exh_found)
{
if (exhaust)
util_out_print("Error: exhaustive search fail.", TRUE);
else
util_out_print("Error: ordered search fail.", TRUE);
} else
util_out_print(0, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
} else /* !exhaust && size > 0 */
{
if (!dse_is_blk_in(rp, r_top, size))
{
util_out_print("Error: ordered search fail.", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
}
if (patch_find_sibs)
{ /* the cross-branch sib action could logically go in dse_order but is here 'cause it only gets used when needed */
util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
if (!patch_left_sib)
{
for (last = 0, lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count) - 1; 0 <= --lvl;)
{
if (!(sp = t_qread(patch_find_root_search ? patch_path[lvl] : patch_path1[lvl], &dummy_int,
&dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t)sp)->bsiz > cs_addrs->hdr->blk_size)
s_top = sp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)sp)->bsiz)
{
util_out_print("Error: sibling search hit problem blk 0x!XL",
TRUE, patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]);
lvl = -1;
break;
} else
s_top = sp + ((blk_hdr_ptr_t)sp)->bsiz;
srp = sp + SIZEOF(blk_hdr);
GET_SHORT(rsize, &((rec_hdr_ptr_t)srp)->rsiz);
srp += rsize;
GET_LONG(look, srp - SIZEOF(block_id));
if ((patch_find_root_search ? patch_path[lvl + 1] : patch_path1[lvl + 1]) != look)
break;
}
if (0 <= lvl)
{
for (lvl++; (srp < s_top)
&& ((patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]) != look);)
{
last = look;
GET_SHORT(rsize, &((rec_hdr_ptr_t)srp)->rsiz);
srp += rsize;
if (srp > s_top)
break;
GET_LONG(look, srp - SIZEOF(block_id));
}
if ((patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]) != look)
{
util_out_print("Error: sibling search hit problem blk 0x!XL",
TRUE, patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]);
last = 0;
lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count);
} else if (last >= cs_addrs->ti->total_blks)
{ /* should never come here as block was previously OK, but this is dse so be careful */
util_out_print("Error: sibling search got 0x!XL which exceeds total blocks 0x!XL",
TRUE, last, cs_addrs->ti->total_blks);
last = 0;
lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count);
}
for (lvl++; lvl < (patch_find_root_search ? patch_dir_path_count : patch_path_count); lvl++)
{
if (!(sp = t_qread(last, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t)sp)->bsiz > cs_addrs->hdr->blk_size)
s_top = sp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)sp)->bsiz)
{
util_out_print("Error: sibling search hit problem blk 0x!XL", TRUE, last);
last = 0;
break;
} else
s_top = sp + ((blk_hdr_ptr_t)sp)->bsiz;
if (0 >= (signed char)(((blk_hdr_ptr_t)sp)->levl))
{
util_out_print("Error: sibling search reached level 0", TRUE);
last = 0;
break;
}
GET_LONG(last, s_top - SIZEOF(block_id));
if (last >= cs_addrs->ti->total_blks)
{
util_out_print("Error: sibling search got 0x!XL which exceeds total blocks 0x!XL",
TRUE, last, cs_addrs->ti->total_blks);
break;
}
}
}
patch_left_sib = last;
}
if (patch_left_sib)
util_out_print("!_0x!XL", FALSE, patch_left_sib);
else
util_out_print("!_none!_", FALSE);
util_out_print("!_0x!XL!_", FALSE, patch_find_blk);
if (!patch_right_sib)
{
for (lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count) - 1; 0 <= --lvl;)
{
if (!(sp = t_qread(patch_find_root_search ? patch_path[lvl] : patch_path1[lvl], &dummy_int,
&dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t)sp)->bsiz > cs_addrs->hdr->blk_size)
s_top = sp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)sp)->bsiz)
{
util_out_print("Error: sibling search hit problem blk 0x!XL",
TRUE, patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]);
lvl = -1;
break;
} else
s_top = sp + ((blk_hdr_ptr_t)sp)->bsiz;
GET_LONG(look, s_top - SIZEOF(block_id));
if (look >= cs_addrs->ti->total_blks)
{
util_out_print("Error: sibling search got 0x!XL which exceeds total blocks 0x!XL",
TRUE, look, cs_addrs->ti->total_blks);
lvl = -1;
break;
}
if ((patch_find_root_search ? patch_path[lvl + 1] : patch_path1[lvl + 1]) != look)
break;
}
if (0 <= lvl)
{
srp = sp + SIZEOF(blk_hdr);
for (lvl++; (srp < s_top)
&& ((patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]) != last);)
{
last = look;
GET_SHORT(rsize, &((rec_hdr_ptr_t)srp)->rsiz);
srp += rsize;
if (srp > s_top)
break;
GET_LONG(look, srp - SIZEOF(block_id));
if (look >= cs_addrs->ti->total_blks)
{
util_out_print("Error: sibling search got 0x!XL which exceeds total blocks 0x!XL",
TRUE, look, cs_addrs->ti->total_blks);
break;
}
}
if ((patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]) != last)
{
util_out_print("Error: sibling search hit problem blk 0x!XL",
TRUE, patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]);
look = 0;
lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count);
}
for (lvl++; lvl < (patch_find_root_search ? patch_dir_path_count : patch_path_count); lvl++)
{
if (!(sp = t_qread(look, &dummy_int, &dummy_cr))) /* NOTE assignment */
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t)sp)->bsiz > cs_addrs->hdr->blk_size)
s_top = sp + cs_addrs->hdr->blk_size;
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)sp)->bsiz)
{
util_out_print("Error: sibling search hit problem blk 0x!XL", TRUE, look);
look = 0;
break;
} else
s_top = sp + ((blk_hdr_ptr_t)sp)->bsiz;
if (0 >= (signed char)(((blk_hdr_ptr_t)sp)->levl))
{
util_out_print("Error: sibling search reached level 0", TRUE);
look = 0;
break;
}
srp = sp + SIZEOF(blk_hdr);
GET_SHORT(rsize, &((rec_hdr_ptr_t)srp)->rsiz);
srp += rsize;
GET_LONG(look, srp - SIZEOF(block_id));
if (look >= cs_addrs->ti->total_blks)
{
util_out_print("Error: sibling search got 0x!XL which exceeds total blocks 0x!XL",
TRUE, look, cs_addrs->ti->total_blks);
look = 0;
break;
}
}
} else
look = 0;
patch_right_sib = look;
}
if (patch_right_sib)
util_out_print("0x!XL!/", TRUE, patch_right_sib);
else
util_out_print("none!/", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
util_out_print("!/ Directory path!/ Path--blk:off", TRUE);
patch_dir_path_count--;
for (count = 0; count < patch_dir_path_count; count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
}
if (!patch_find_root_search)
{
assert(patch_path_count); /* OK to assert since pro works as desired */
util_out_print("!/ Global tree path!/ Path--blk:off", TRUE);
}
if (patch_path_count)
{
patch_path_count--;
for (count = 0; count < patch_path_count; count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count],
(uchar_ptr_t)&util_buff[util_len], 8);
util_len += i2hex_nofill(patch_path1[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset1[count], (uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
}
util_out_print(util_buff, FALSE);
}
else
dse_exhaus(1, 0);
temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path;
while(d_ptr)
{
dtemp = d_ptr;
d_ptr = d_ptr->next;
free(dtemp);
}
global_roots_head = global_roots_head->link;
free(temp);
}
while (global_roots_head->link)
{
temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path;
while(d_ptr)
{
dtemp = d_ptr;
d_ptr = d_ptr->next;
free(dtemp);
}
global_roots_head = global_roots_head->link;
free(temp);
}
}
if (!patch_exh_found)
{
if (exhaust)
{
util_out_print("Error: exhaustive search fail.", TRUE);
}
else
{
util_out_print("Error: ordered search fail.", TRUE);
}
}
else
util_out_print(0, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
else /* !exhaust && size > 0 */
{
if (!dse_is_blk_in(rp, r_top, size))
{
util_out_print("Error: ordered search fail.", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
}
if (patch_find_sibs)
{
util_out_print("!/!_Left sibling!_Right sibling", TRUE);
if (patch_left_sib)
{
memcpy(util_buff, "!_", 2);
util_len = 2;
util_len += i2hex_nofill(patch_left_sib, (uchar_ptr_t)&util_buff[util_len], 8);
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
}
else
util_out_print("!_none", FALSE);
if (patch_right_sib)
{
memcpy(util_buff, "!_!_", 4);
util_len = 4;
util_len += i2hex_nofill(patch_right_sib, (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], "!/", 2);
util_len += 2;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
} else
util_out_print("!_!_none!/", TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
assert(patch_find_root_search); /* OK to assert since pro works as desired */
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_find_root_search ? patch_path[count] : patch_path1[count],
(uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], "!/", 2);
util_len += 2;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
util_out_print("!/ Directory path!/ Path--blk:off", TRUE);
patch_dir_path_count--;
for (count = 0; count < patch_dir_path_count ;count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
}
util_out_print("!/ Global tree path!/ Path--blk:off", TRUE);
if (patch_path_count)
{
patch_path_count--;
for (count = 0; count < patch_path_count ;count++)
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path1[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], ":", 1);
util_len += 1;
util_len += i2hex_nofill(patch_offset1[count], (uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1);
util_len += 1;
util_buff[util_len] = 0;
util_out_print(util_buff, FALSE);
}
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path1[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], "!/", 2);
util_len += 2;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
}
else
{
memcpy(util_buff, " ", 1);
util_len = 1;
util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len], "!/", 2);
util_len += 2;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
}
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT;
return;
}
/* Control-C condition handler */
CONDITION_HANDLER(dse_f_blk_ch)
{
error_def(ERR_CTRLC);
START_CH;
START_CH;
if (SIGNAL == ERR_CTRLC)
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
NEXTCH;
if (ERR_CTRLC == SIGNAL)
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
NEXTCH;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -31,6 +31,8 @@
GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region;
error_def(ERR_DSEBLKRDFAIL);
#define MAX_UTIL_LEN 80
void dse_f_free(void)
@ -41,10 +43,9 @@ void dse_f_free(void)
sm_uc_ptr_t lmap_base;
int4 bplmap, total_blks;
int4 util_len, master_bit, lmap_bit, hint_over_bplmap, hint_mod_bplmap;
boolean_t was_crit;
boolean_t was_crit, was_hold_onto_crit;
int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
if (cs_addrs->hdr->bplmap == 0)
{ util_out_print("Cannot perform free block search: bplmap field of file header is zero.", TRUE);
@ -68,7 +69,7 @@ void dse_f_free(void)
in_last_bmap = (master_bit == (cs_addrs->ti->total_blks / bplmap));
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if(!(lmap_base = t_qread(master_bit * bplmap, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (master_bit == hint_over_bplmap)
@ -88,7 +89,7 @@ void dse_f_free(void)
util_len += 39;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
memcpy(util_buff, "!/Next free block is ", 21);
@ -98,6 +99,6 @@ void dse_f_free(void)
util_len += 3;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -36,7 +36,7 @@ void dse_f_key(void)
int4 offset[MAX_BT_DEPTH + 1], root_offset[MAX_BT_DEPTH + 1], nocrit_present;
char targ_key[MAX_KEY_SZ + 1], targ_key_root[MAX_KEY_SZ + 1], *key_top, util_buff[MAX_UTIL_LEN];
int size, size_root, root_path_count, count, util_len;
bool found, was_crit;
boolean_t found, was_crit, was_hold_onto_crit;
if (!dse_getki(&targ_key[0],&size,LIT_AND_LEN("KEY")))
return;
@ -51,11 +51,11 @@ void dse_f_key(void)
patch_find_root_search = TRUE;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (!dse_ksrch(root_path[0],&root_path[1],&root_offset[0],&targ_key_root[0],size_root))
{
util_out_print("!/Key not found, no root present.!/",TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}
root_path_count = patch_path_count;
@ -117,6 +117,6 @@ void dse_f_key(void)
util_buff[util_len] = 0;
util_out_print(util_buff,TRUE);
}
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -31,6 +31,8 @@ GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk;
error_def(ERR_DSEBLKRDFAIL);
#define MAX_UTIL_LEN 40
void dse_integ(void)
@ -41,9 +43,7 @@ void dse_integ(void)
int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr;
int util_len;
boolean_t was_crit;
error_def(ERR_DSEBLKRDFAIL);
boolean_t was_crit, was_hold_onto_crit;
if (CLI_PRESENT == cli_present("BLOCK"))
{
@ -65,13 +65,13 @@ void dse_integ(void)
util_out_print(util_buff, TRUE);
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (!(bp = t_qread(patch_curr_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (TRUE == cert_blk(gv_cur_region, patch_curr_blk, (blk_hdr_ptr_t)bp, 0, FALSE))
util_out_print("!/ No errors detected.!/", TRUE);
else
util_out_print(NULL, TRUE);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -23,49 +23,45 @@
#include "dse.h"
GBLREF sgmnt_addrs *cs_addrs;
GBLREF short int patch_dir_path_count;
GBLREF block_id patch_find_blk;
GBLREF block_id patch_path[MAX_BT_DEPTH + 1];
GBLREF block_id patch_path1[MAX_BT_DEPTH + 1];
GBLREF bool patch_find_root_search;
GBLREF int4 patch_offset[MAX_BT_DEPTH + 1];
GBLREF int4 patch_offset1[MAX_BT_DEPTH + 1];
GBLREF block_id patch_path[MAX_BT_DEPTH + 1];
GBLREF block_id patch_path1[MAX_BT_DEPTH + 1];
GBLREF short int patch_path_count;
GBLREF short int patch_dir_path_count;
GBLREF bool patch_find_root_search;
int dse_is_blk_in(sm_uc_ptr_t rp, sm_uc_ptr_t r_top, short size)
{
sm_uc_ptr_t key_top;
char targ_key[256];
char targ_key[MAX_KEY_SZ + 1];
memcpy(&targ_key[0], rp + SIZEOF(rec_hdr), size);
if ( patch_find_blk != patch_path[0]
&& !dse_order(patch_path[0], &patch_path[1], &patch_offset[0],
&targ_key[0], size, 0))
memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
if ((patch_find_blk != patch_path[0])
&& !dse_order(patch_path[0], &patch_path[1], patch_offset, targ_key, size, 0))
return FALSE;
patch_dir_path_count = patch_path_count;
if (patch_find_blk != patch_path[patch_path_count - 1])
if (!patch_find_root_search || (patch_find_blk != patch_path[patch_path_count - 1]))
{
if (patch_path[patch_path_count - 1] <= 0
|| patch_path[patch_path_count] > cs_addrs->ti->total_blks)
return FALSE;
patch_find_root_search = FALSE;
for (key_top = rp + SIZEOF(rec_hdr); key_top < r_top ; )
if (!*key_top++ && !*key_top++)
break;
size = key_top - rp - SIZEOF(rec_hdr);
if (size < 0)
size = 0;
else if (size > SIZEOF(targ_key))
size = SIZEOF(targ_key);
memcpy(&targ_key[0], rp + SIZEOF(rec_hdr), size);
patch_path1[0] = patch_path[patch_path_count - 1];
patch_path[patch_path_count - 1] = 0;
patch_path_count = 1;
if (patch_find_blk != patch_path1[0]
&& !dse_order(patch_path1[0],&patch_path1[1],&patch_offset1[0],
&targ_key[0], size, 0))
if ((0 >= patch_path[patch_path_count - 1]) || (patch_path[patch_path_count] > cs_addrs->ti->total_blks))
return FALSE;
patch_find_root_search = FALSE;
for (key_top = rp + SIZEOF(rec_hdr); (*key_top++ || *key_top++) && (key_top < r_top);)
;
size = key_top - rp - SIZEOF(rec_hdr);
if (0 > size)
size = 0;
else if (SIZEOF(targ_key) < size)
size = SIZEOF(targ_key);
memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
patch_path1[0] = patch_path[patch_path_count - 1];
patch_path[patch_path_count - 1] = 0;
patch_path_count = 1;
if ((patch_find_blk != patch_path1[0])
&& !dse_order(patch_path1[0], &patch_path1[1], patch_offset1, targ_key, size, 0))
return FALSE;
} else
patch_path_count = 0;
patch_path_count = 0;
return TRUE;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -26,12 +26,15 @@
#include "t_qread.h"
#include "mmemory.h"
GBLREF short int patch_path_count;
GBLREF block_id patch_left_sib,patch_right_sib,patch_find_blk;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF char patch_comp_key[MAX_KEY_SZ + 1];
GBLREF unsigned char patch_comp_count;
GBLREF block_id patch_find_blk, patch_left_sib, patch_right_sib;
GBLREF block_id patch_path[MAX_BT_DEPTH + 1], patch_path1[MAX_BT_DEPTH + 1];
GBLREF bool patch_find_root_search;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF short int patch_path_count;
GBLREF unsigned char patch_comp_count;
error_def(ERR_DSEBLKRDFAIL);
int dse_order(block_id srch,
block_id_ptr_t pp,
@ -40,98 +43,98 @@ int dse_order(block_id srch,
short int targ_len,
bool dir_data_blk)
{
sm_uc_ptr_t bp, b_top, rp, r_top, key_top, c1, ptr;
sm_uc_ptr_t bp, b_top, key_top, ptr, rp, r_top;
unsigned char cc;
block_id last;
short int size, rsize;
short int rsize, size;
int4 dummy_int;
cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
last = 0;
patch_path_count++;
if(!(bp = t_qread(srch, &dummy_int, &dummy_cr)))
if (!(bp = t_qread(srch, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
if (((blk_hdr_ptr_t)bp)->bsiz > cs_addrs->hdr->blk_size)
b_top = bp + cs_addrs->hdr->blk_size;
else if (((blk_hdr_ptr_t) bp)->bsiz < SIZEOF(blk_hdr))
else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)bp)->bsiz)
b_top = bp + SIZEOF(blk_hdr);
else
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz;
b_top = bp + ((blk_hdr_ptr_t)bp)->bsiz;
patch_comp_count = 0;
patch_comp_key[0] = patch_comp_key[1] = 0;
for (rp = bp + SIZEOF(blk_hdr); rp < b_top ;rp = r_top, last = *pp)
{
GET_SHORT(rsize,&((rec_hdr_ptr_t)rp)->rsiz);
if (rsize < SIZEOF(rec_hdr))
GET_SHORT(rsize, &((rec_hdr_ptr_t)rp)->rsiz);
if (SIZEOF(rec_hdr) > rsize)
r_top = rp + SIZEOF(rec_hdr);
else
r_top = rp + rsize;
if (r_top > b_top || (r_top == b_top && ((blk_hdr*)bp)->levl))
if ((r_top > b_top) || (r_top == b_top && ((blk_hdr*)bp)->levl))
{
if (b_top - rp != SIZEOF(rec_hdr) + SIZEOF(block_id) || ((rec_hdr *) rp)->cmpc)
if ((SIZEOF(rec_hdr) + SIZEOF(block_id) != (b_top - rp)) || ((rec_hdr *)rp)->cmpc)
return FALSE;
if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl)
{
for (ptr = rp + SIZEOF(rec_hdr); ;)
if (*ptr++ == 0 && *ptr++ == 0)
break;
GET_LONGP(pp,ptr);
for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= b_top);)
;
GET_LONGP(pp, ptr);
} else
GET_LONGP(pp,b_top - SIZEOF(block_id));
GET_LONGP(pp, b_top - SIZEOF(block_id));
break;
} else
{
if (r_top - rp < SIZEOF(block_id) + SIZEOF(rec_hdr))
if ((SIZEOF(block_id) + SIZEOF(rec_hdr)) > (r_top - rp))
break;
if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl)
{
for (ptr = rp + SIZEOF(rec_hdr); ;)
if (*ptr++ == 0 && *ptr++ == 0)
break;
for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= r_top);)
;
key_top = ptr;
} else
key_top = r_top - SIZEOF(block_id);
if (((rec_hdr_ptr_t) rp)->cmpc > patch_comp_count)
if (((rec_hdr_ptr_t)rp)->cmpc > patch_comp_count)
cc = patch_comp_count;
else
cc = ((rec_hdr_ptr_t) rp)->cmpc;
cc = ((rec_hdr_ptr_t)rp)->cmpc;
size = key_top - rp - SIZEOF(rec_hdr);
if (size > SIZEOF(patch_comp_key) - 2 - cc)
if ((SIZEOF(patch_comp_key) - 2 - cc) < size)
size = SIZEOF(patch_comp_key) - 2 - cc;
if (size < 0)
if (0 > size)
size = 0;
memcpy(&patch_comp_key[cc], rp + SIZEOF(rec_hdr), size);
patch_comp_count = cc + size;
GET_LONGP(pp,key_top);
if (memvcmp(targ_key,targ_len,&patch_comp_key[0],patch_comp_count) <= 0)
GET_LONGP(pp, key_top);
if (0 >= memvcmp(targ_key, targ_len, patch_comp_key, patch_comp_count))
break;
}
}
*op = (int4)(rp - bp);
if (*pp == patch_find_blk && !dir_data_blk)
if ((*pp == patch_find_blk) && !dir_data_blk)
{
patch_left_sib = last;
if (r_top < b_top)
{
rp = r_top;
GET_SHORT(rsize,&((rec_hdr_ptr_t)r_top)->rsiz);
GET_SHORT(rsize, &((rec_hdr_ptr_t)r_top)->rsiz);
r_top = rp + rsize;
if (r_top > b_top)
r_top = b_top;
if (r_top - rp >= SIZEOF(block_id))
GET_LONG(patch_right_sib,r_top - SIZEOF(block_id));
if (SIZEOF(block_id) <= (r_top - rp))
GET_LONG(patch_right_sib, r_top - SIZEOF(block_id));
}
return TRUE;
}
if ( *pp > 0 && *pp < cs_addrs->ti->total_blks && (*pp % cs_addrs->hdr->bplmap))
if ((*pp > 0) && (*pp < cs_addrs->ti->total_blks) && (*pp % cs_addrs->hdr->bplmap))
{
if (((blk_hdr_ptr_t) bp)->levl > 1 && dse_order(*pp,pp + 1,op + 1,targ_key,targ_len, 0))
if ((1 < ((blk_hdr_ptr_t)bp)->levl) && dse_order(*pp, pp + 1, op + 1, targ_key, targ_len, 0))
return TRUE;
else if (((blk_hdr_ptr_t)bp)->levl == 1 && patch_find_root_search)
return dse_order( *pp,pp + 1,op + 1, targ_key, targ_len, 1);
else if (((blk_hdr_ptr_t)bp)->levl == 0 && patch_find_root_search)
else if ((1 == ((blk_hdr_ptr_t)bp)->levl) && patch_find_root_search)
return dse_order(*pp, pp + 1, op + 1, targ_key, targ_len, 1);
else if ((0 == ((blk_hdr_ptr_t)bp)->levl) && patch_find_root_search)
{
patch_find_root_search = FALSE;
return TRUE;
}
}
patch_path_count--;
return FALSE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -36,6 +36,9 @@ GBLREF int patch_fdmp_recs;
GBLREF int patch_rec_counter;
GBLREF VSIG_ATOMIC_T util_interrupt;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
boolean_t dse_r_dmp(void)
{
block_id blk;
@ -44,12 +47,9 @@ boolean_t dse_r_dmp(void)
int4 dummy_int;
cache_rec_ptr_t dummy_cr;
short record, size;
boolean_t was_crit;
boolean_t was_crit, was_hold_onto_crit;
int4 nocrit_present;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
if (cli_present("BLOCK") == CLI_PRESENT)
{
uint4 tmp_blk;
@ -72,7 +72,7 @@ boolean_t dse_r_dmp(void)
count = 1;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (!(bp = t_qread(patch_curr_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (((blk_hdr_ptr_t) bp)->bsiz > cs_addrs->hdr->blk_size)
@ -83,7 +83,7 @@ boolean_t dse_r_dmp(void)
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz;
if (((blk_hdr_ptr_t) bp)->levl && patch_is_fdmp)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
util_out_print("Error: cannot perform GLO/ZWR dump on index block.", TRUE);
return FALSE;
}
@ -91,12 +91,12 @@ boolean_t dse_r_dmp(void)
{
if (!(rp = skan_rnum (bp, FALSE)))
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return FALSE;
}
} else if (!(rp = skan_offset (bp, FALSE)))
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
return FALSE;
}
util_out_print(0, TRUE);
@ -106,7 +106,7 @@ boolean_t dse_r_dmp(void)
break;
patch_rec_counter += 1;
}
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (util_interrupt)
rts_error(VARLSTCNT(1) ERR_CTRLC);
else if (cli_present("HEADER") == CLI_NEGATED)

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -40,6 +40,9 @@ GBLREF block_id patch_path[MAX_BT_DEPTH + 1];
GBLREF short int patch_path_count;
GBLREF bool patch_find_root_search;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
void dse_range(void)
{
char lower[256], targ_key[256], upper[256], util_buff[MAX_UTIL_LEN];
@ -50,10 +53,7 @@ void dse_range(void)
cache_rec_ptr_t dummy_cr;
short int rsize, size, size1;
int cnt, dummy, lower_len, util_len, upper_len;
boolean_t busy_matters, free, got_lonely_star, index, low, lost, star, up, was_crit;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
boolean_t busy_matters, free, got_lonely_star, index, low, lost, star, up, was_crit, was_hold_onto_crit;
if (cli_present("FROM") == CLI_PRESENT)
{
@ -113,12 +113,12 @@ void dse_range(void)
cnt = 0;
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
for (blk = from; blk <= to ;blk++)
{
if (util_interrupt)
{
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
rts_error(VARLSTCNT(1) ERR_CTRLC);
break;
}
@ -229,7 +229,7 @@ void dse_range(void)
util_out_print("!/Blocks in the specified key range:", TRUE);
util_out_print("Block: !8XL Level: !2UL", TRUE, blk, level);
}
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (cnt)
util_out_print("Found !UL blocks", TRUE, cnt);
else

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -32,19 +32,19 @@ GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk;
error_def(ERR_DSEBLKRDFAIL);
void dse_save(void)
{
block_id blk;
unsigned i, j, util_len;
unsigned short buff_len;
boolean_t was_block, was_crit;
boolean_t was_block, was_crit, was_hold_onto_crit;
char buff[100], *ptr, util_buff[MAX_UTIL_LEN];
sm_uc_ptr_t bp;
int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
memset(util_buff, 0, MAX_UTIL_LEN);
if (was_block = (cli_present("BLOCK") == CLI_PRESENT))
@ -129,11 +129,11 @@ void dse_save(void)
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
if (!(bp = t_qread(blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
memcpy(patch_save_set[patch_save_count].bp, bp, cs_addrs->hdr->blk_size);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region);
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
buff_len = SIZEOF(buff);
if ((cli_present("COMMENT") == CLI_PRESENT) && cli_get_str("COMMENT", buff, &buff_len))
{

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -21,37 +21,28 @@
#include "filestruct.h"
#include "cli.h"
#include "dse.h"
#ifdef VMS
#define GET_CONFIRM(X,Y) {if(!cli_get_str("CONFIRMATION",(X),&(Y))) {rts_error(VARLSTCNT(1) ERR_DSEWCINITCON); \
return;}}
#endif
#ifdef UNIX
#include "gtm_stdio.h"
#define GET_CONFIRM(X,Y) {PRINTF("CONFIRMATION: ");FGETS((X), (Y), stdin, fgets_res);Y = strlen(X);}
# include "gtm_stdio.h"
#endif
GBLREF gd_region *gv_cur_region;
GBLREF sgmnt_addrs *cs_addrs;
GBLREF short crash_count;
error_def(ERR_DBRDONLY);
error_def(ERR_DSEINVLCLUSFN);
error_def(ERR_DSEONLYBGMM);
error_def(ERR_DSEWCINITCON);
void dse_wcreinit (void)
{
unsigned char *c;
char confirm[256];
uint4 large_block;
short len;
boolean_t was_crit;
# ifdef UNIX
char *fgets_res;
# endif
error_def(ERR_DSEWCINITCON);
error_def(ERR_DSEINVLCLUSFN);
error_def(ERR_DSEONLYBGMM);
error_def(ERR_DBRDONLY);
if (gv_cur_region->read_only)
rts_error(VARLSTCNT(4) ERR_DBRDONLY, 2, DB_LEN_STR(gv_cur_region));
@ -62,13 +53,7 @@ void dse_wcreinit (void)
}
if (cs_addrs->critical)
crash_count = cs_addrs->critical->crashcnt;
len = SIZEOF(confirm);
GET_CONFIRM(confirm,len);
if (confirm[0] != 'Y' && confirm[0] != 'y')
{
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON);
return;
}
GET_CONFIRM_AND_HANDLE_NEG_RESPONSE
if (cs_addrs->hdr->acc_meth != dba_bg && cs_addrs->hdr->acc_meth != dba_mm)
{
rts_error(VARLSTCNT(4) ERR_DSEONLYBGMM, 2, LEN_AND_LIT("WCINIT"));
@ -77,13 +62,7 @@ void dse_wcreinit (void)
was_crit = cs_addrs->now_crit;
if (!was_crit)
grab_crit(gv_cur_region);
bt_init(cs_addrs);
if (cs_addrs->hdr->acc_meth == dba_bg)
{
bt_refresh(cs_addrs);
db_csh_ini(cs_addrs);
db_csh_ref(cs_addrs);
}
DSE_WCREINIT(cs_addrs);
if (!was_crit)
rel_crit (gv_cur_region);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -20,6 +20,8 @@
#include "gdsblk.h"
#include "gdsfhead.h"
#include "filestruct.h"
#include "gtmio.h"
#include "have_crit.h"
GBLREF gd_region *gv_cur_region;
GBLREF int process_id;
@ -54,6 +56,6 @@ void dump_lockhist(void)
break; /* Completed the loop */
}
FPRINTF(stderr,"\0");
fflush(stderr);
FFLUSH(stderr);
#endif
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2007 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -26,6 +26,8 @@
#define ECODE_MAX_LEN ((2 * MAX_DIGITS_IN_INT) + STR_LIT_LEN(",M,Z,"))
#define ECODE_MAX_LEN_WITH_BUFFER ((ECODE_MAX_LEN) + (BUFFER_FOR_OVERFLOW))
error_def(ERR_SETECODE);
void ecode_set(int errnum)
{
mval tmpmval;
@ -36,20 +38,18 @@ void ecode_set(int errnum)
int ansi_error;
int severity;
error_def(ERR_SETECODE);
/* If this routine was called with error code SETECODE,
* an end-user just put a correct value into $ECODE,
* and it shouldn't be replaced by this routine.
*/
if (ERR_SETECODE == errnum)
return;
/* When the value of $ECODE is non-empty, error trapping
* will be invoked. When the severity level does not warrant
* error trapping, no value should be copied into $ECODE
*/
/* When the value of $ECODE is non-empty, error trapping is invoked. When the severity level does not warrant
* error trapping, no value should be copied into $ECODE. Note: the message is verified it IS a GTM message before
* checking the severity code so system error numbers aren't misinterpreted.
*/
severity = errnum & SEV_MSK;
if ((INFO == severity) || (SUCCESS == severity))
if ((NULL != err_check(errnum)) && ((INFO == severity) || (SUCCESS == severity)))
return;
/* Get ECODE string from error-number. If the error has an ANSI standard code, return ,Mnnn, (nnn is ANSI code).
* Always return ,Zxxx, (xxx is GT.M code). Note that the value of $ECODE must start and end with a comma
@ -59,9 +59,8 @@ void ecode_set(int errnum)
if (ectl = err_check(errnum))
{
ansi_error = ((errnum & FACMASK(ectl->facnum)) && (MSGMASK(errnum, ectl->facnum) <= ectl->msg_cnt))
? error_ansi[MSGMASK(errnum, ectl->facnum) - 1]
: 0;
if (ansi_error > 0)
? error_ansi[MSGMASK(errnum, ectl->facnum) - 1] : 0;
if (0 < ansi_error)
{
*ecode_ptr++ = 'M';
ecode_ptr = (char *)i2asc((unsigned char *)ecode_ptr, ansi_error);
@ -74,7 +73,6 @@ void ecode_set(int errnum)
ecode_mstr.addr = &ecode_buff[0];
ecode_mstr.len = INTCAST(ecode_ptr - ecode_mstr.addr);
assert(ecode_mstr.len <= ECODE_MAX_LEN);
if (ecode_mstr.len > ECODE_MAX_LEN_WITH_BUFFER)
GTMASSERT;
assertpro(ECODE_MAX_LEN_WITH_BUFFER >= ecode_mstr.len);
ecode_add(&ecode_mstr);
}

View File

@ -21,6 +21,15 @@
#include <sys/types.h>
#include <errno.h>
#include "have_crit.h"
#include "gt_timer.h"
#if defined(DEBUG) && defined(UNIX)
#include "io.h"
#include "gtm_stdio.h"
#include "wcs_sleep.h"
#include "deferred_signal_handler.h"
#include "wbox_test_init.h"
#endif
#define ACCEPT_SOCKET(SOCKET, ADDR, LEN, RC) \
{ \
@ -278,4 +287,27 @@
} while (-1 == RC && EINTR == errno); \
}
#if defined(DEBUG) && defined(UNIX)
#define SYSCONF(PARM, RC) \
{ \
DEFER_INTERRUPTS(INTRPT_IN_SYSCONF); \
if (gtm_white_box_test_case_enabled \
&& (WBTEST_SYSCONF_WRAPPER == gtm_white_box_test_case_number)) \
{ \
DBGFPF((stderr, "will sleep indefinitely now\n")); \
while (TRUE) \
LONG_SLEEP(60); \
} \
RC = sysconf(PARM); \
ENABLE_INTERRUPTS(INTRPT_IN_SYSCONF); \
}
#else
#define SYSCONF(PARM, RC) \
{ \
DEFER_INTERRUPTS(INTRPT_IN_SYSCONF); \
RC = sysconf(PARM); \
ENABLE_INTERRUPTS(INTRPT_IN_SYSCONF); \
}
#endif
#endif

View File

@ -25,8 +25,6 @@
GBLREF stack_frame *frame_pointer;
GBLREF mident routine_name;
GBLREF char window_token;
GBLREF mident window_ident;
error_def(ERR_LABELEXPECTED);
error_def(ERR_RTNNAME);
@ -39,7 +37,9 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
mstr rtn_str, lbl_str;
triple *ref, *next, *rettrip;
boolean_t same_rout;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
rtnname.len = labname.len = 0;
rtnname.addr = &rtn_text[0];
labname.addr = &lab_text[0];
@ -49,136 +49,135 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
* known use of textname TRUE - in m_zgoto).
*/
assert(!(can_commarg && textname));
switch (window_token)
switch (TREF(window_token))
{
case TK_INTLIT:
int_label();
/* caution: fall through */
case TK_IDENT:
memcpy(labname.addr, window_ident.addr, window_ident.len);
labname.len = window_ident.len;
advancewindow();
if ((TK_PLUS != window_token) && (TK_CIRCUMFLEX != window_token) && !IS_MCODE_RUNNING && can_commarg)
{
rettrip = newtriple(op1);
rettrip->operand[0] = put_mlab(&labname);
return rettrip;
}
label.oprclass = 0;
break;
case TK_ATSIGN:
if(!indirection(&label))
return NULL;
if ((TK_PLUS != window_token) && (TK_CIRCUMFLEX != window_token) && (TK_COLON != window_token)
&& can_commarg)
{
rettrip = ref = maketriple(OC_COMMARG);
ref->operand[0] = label;
ref->operand[1] = put_ilit(commargcode);
ins_triple(ref);
return rettrip;
}
labname.len = 0;
break;
case TK_PLUS:
stx_error(ERR_LABELEXPECTED);
case TK_INTLIT:
int_label();
/* caution: fall through */
case TK_IDENT:
memcpy(labname.addr, (TREF(window_ident)).addr, (TREF(window_ident)).len);
labname.len = (TREF(window_ident)).len;
advancewindow();
if ((TK_PLUS != TREF(window_token)) && (TK_CIRCUMFLEX != TREF(window_token)) && !IS_MCODE_RUNNING && can_commarg)
{
rettrip = newtriple(op1);
rettrip->operand[0] = put_mlab(&labname);
return rettrip;
}
label.oprclass = 0;
break;
case TK_ATSIGN:
if(!indirection(&label))
return NULL;
default:
labname.len = 0;
label.oprclass = 0;
break;
if ((TK_PLUS != TREF(window_token)) && (TK_CIRCUMFLEX != TREF(window_token)) && (TK_COLON != TREF(window_token))
&& can_commarg)
{
rettrip = ref = maketriple(OC_COMMARG);
ref->operand[0] = label;
ref->operand[1] = put_ilit(commargcode);
ins_triple(ref);
return rettrip;
}
labname.len = 0;
break;
case TK_PLUS:
stx_error(ERR_LABELEXPECTED);
return NULL;
default:
labname.len = 0;
label.oprclass = 0;
break;
}
if (!labref && (TK_PLUS == window_token))
if (!labref && (TK_PLUS == TREF(window_token)))
{ /* Have line offset specified */
advancewindow();
if (!intexpr(&offset))
if (EXPR_FAIL == expr(&offset, MUMPS_INT))
return NULL;
} else
offset.oprclass = 0;
if (TK_CIRCUMFLEX == window_token)
if (TK_CIRCUMFLEX == TREF(window_token))
{ /* Have a routine name specified */
advancewindow();
switch(window_token)
switch (TREF(window_token))
{
case TK_IDENT:
MROUT2XTERN(window_ident.addr, rtnname.addr, window_ident.len);
rtn_str.len = rtnname.len = window_ident.len;
rtn_str.addr = rtnname.addr;
advancewindow();
if (!IS_MCODE_RUNNING)
{ /* Triples for indirect code */
same_rout = (MIDENT_EQ(&rtnname, &routine_name) && can_commarg);
if (!textname)
{ /* Resolve routine and label names to addresses for most calls */
if (!label.oprclass && !offset.oprclass)
{ /* Routine only (no label or offset) */
if (same_rout)
{
rettrip = newtriple(op1);
rettrip->operand[0] = put_mlab(&labname);
} else
{
rettrip = maketriple(op2);
if (rtnname.addr[0] == '%')
rtnname.addr[0] = '_';
rettrip->operand[0] = put_cdlt(&rtn_str);
mlabel2xtern(&lbl_str, &rtnname, &labname);
rettrip->operand[1] = put_cdlt(&lbl_str);
ins_triple(rettrip);
}
return rettrip;
} else if (!same_rout)
case TK_IDENT:
MROUT2XTERN((TREF(window_ident)).addr, rtnname.addr, (TREF(window_ident)).len);
rtn_str.len = rtnname.len = (TREF(window_ident)).len;
rtn_str.addr = rtnname.addr;
advancewindow();
if (!IS_MCODE_RUNNING)
{ /* Triples for indirect code */
same_rout = (MIDENT_EQ(&rtnname, &routine_name) && can_commarg);
if (!textname)
{ /* Resolve routine and label names to addresses for most calls */
if (!label.oprclass && !offset.oprclass)
{ /* Routine only (no label or offset) */
if (same_rout)
{
rte1 = put_str(rtn_str.addr, rtn_str.len);
rettrip = newtriple(op1);
rettrip->operand[0] = put_mlab(&labname);
} else
{
rettrip = maketriple(op2);
if (rtnname.addr[0] == '%')
rtnname.addr[0] = '_';
routine = put_cdlt(&rtn_str);
ref = newtriple(OC_RHDADDR);
ref->operand[0] = rte1;
ref->operand[1] = routine;
routine = put_tref(ref);
} else
routine = put_tref(newtriple(OC_CURRHD));
} else
{ /* Return the actual names used */
if (!label.oprclass && !offset.oprclass)
{ /* Routine only (no label or offset) */
rettrip = maketriple(op2);
rettrip->operand[0] = put_str(rtn_str.addr, rtn_str.len);
ref = newtriple(OC_PARAMETER);
ref->operand[0] = put_str(labname.addr, labname.len);
ref->operand[1] = put_ilit(0);
rettrip->operand[1] = put_tref(ref);
rettrip->operand[0] = put_cdlt(&rtn_str);
mlabel2xtern(&lbl_str, &rtnname, &labname);
rettrip->operand[1] = put_cdlt(&lbl_str);
ins_triple(rettrip);
return rettrip;
} else
routine = put_str(rtn_str.addr, rtn_str.len);
}
} else
{ /* Triples for normal compiled code */
routine = put_str(rtn_str.addr, rtn_str.len);
if (!textname)
{ /* If not returning text name, convert text name to routine header address */
ref = newtriple(OC_RHDADDR1);
ref->operand[0] = routine;
}
return rettrip;
} else if (!same_rout)
{
rte1 = put_str(rtn_str.addr, rtn_str.len);
if (rtnname.addr[0] == '%')
rtnname.addr[0] = '_';
routine = put_cdlt(&rtn_str);
ref = newtriple(OC_RHDADDR);
ref->operand[0] = rte1;
ref->operand[1] = routine;
routine = put_tref(ref);
}
} else
routine = put_tref(newtriple(OC_CURRHD));
} else
{ /* Return the actual names used */
if (!label.oprclass && !offset.oprclass)
{ /* Routine only (no label or offset) */
rettrip = maketriple(op2);
rettrip->operand[0] = put_str(rtn_str.addr, rtn_str.len);
ref = newtriple(OC_PARAMETER);
ref->operand[0] = put_str(labname.addr, labname.len);
ref->operand[1] = put_ilit(0);
rettrip->operand[1] = put_tref(ref);
ins_triple(rettrip);
return rettrip;
} else
routine = put_str(rtn_str.addr, rtn_str.len);
}
break;
case TK_ATSIGN:
if (!indirection(&routine))
return NULL;
} else
{ /* Triples for normal compiled code */
routine = put_str(rtn_str.addr, rtn_str.len);
if (!textname)
{ /* If not returning text name, convert text name to routine header address */
ref = newtriple(OC_RHDADDR1);
ref->operand[0] = routine;
routine = put_tref(ref);
}
break;
default:
stx_error(ERR_RTNNAME);
}
break;
case TK_ATSIGN:
if (!indirection(&routine))
return NULL;
if (!textname)
{ /* If not returning text name, convert text name to routine header address */
ref = newtriple(OC_RHDADDR1);
ref->operand[0] = routine;
routine = put_tref(ref);
}
break;
default:
stx_error(ERR_RTNNAME);
return NULL;
}
} else
{

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2003 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -21,24 +21,25 @@ LITREF err_ctl laerrors_ctl; /* Roger thinks that this one is obsolete */
LITREF err_ctl lperrors_ctl; /* Roger thinks that this one may be obsolete */
#endif
const err_ctl *err_check(int errnum)
{
const err_ctl *all_errors[] = {&merrors_ctl, &gdeerrors_ctl, &cmierrors_ctl, &cmerrors_ctl,
STATICDEF const err_ctl *all_errors[] = {&merrors_ctl, &gdeerrors_ctl, &cmierrors_ctl, &cmerrors_ctl,
#ifdef VMS
&laerrors_ctl, &lperrors_ctl,
#endif
NULL};
const err_ctl *err_check(int errnum)
{
const err_ctl *fac;
int errtype;
int errtype;
if (0 > errnum)
return 0;
return NULL;
for (errtype = 0; all_errors[errtype]; errtype++)
{
fac = all_errors[errtype];
if ((errnum & FACMASK(fac->facnum)) &&
((MSGMASK(errnum, fac->facnum)) <= fac->msg_cnt))
if ((errnum & FACMASK(fac->facnum))
&& ((MSGMASK(errnum, fac->facnum)) <= fac->msg_cnt))
return fac;
}
return NULL;

View File

@ -1,5 +1,5 @@
/****************************************************************
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -12,6 +12,7 @@
#define ERROR_TRAP_H
#define IS_ETRAP (err_act == &dollar_etrap.str)
#define ETRAP_IN_EFFECT (!ztrap_explicit_null && (0 == dollar_ztrap.str.len))
#define DOLLAR_ECODE_MAXINDEX 32 /* maximum of 32 ecodes in $ECODE */
#define DOLLAR_STACK_MAXINDEX 256 /* maximum of 256 levels will be stored for $STACK(level) */
@ -85,11 +86,12 @@ typedef struct
}
/* nullify "error_frame" */
#define NULLIFY_ERROR_FRAME \
{ \
GBLREF stack_frame *error_frame; \
\
error_frame = NULL; \
#define NULLIFY_ERROR_FRAME \
{ \
GBLREF stack_frame *error_frame; \
\
error_frame = NULL; \
DBGEHND((stderr, "%s: Nullifying previous error_frame (was 0x"lvaddr")\n", __FILE__, error_frame)); \
}
/* Set "error_frame" to point to "frame_pointer" and mark it as an error frame type. This is an indication that
@ -97,13 +99,17 @@ typedef struct
*/
#define SET_ERROR_FRAME(fp) \
{ \
GBLREF stack_frame *error_frame; \
GBLREF stack_frame *error_frame; \
\
fp->flags |= SFF_ETRAP_ERR; \
error_frame = fp; \
DBGEHND((stderr, "%s: Setting error_frame as 0x"lvaddr"\n", __FILE__, fp)); \
}
/* invoke the function error_return() if the necessity of error-rethrow is detected */
/* invoke the function error_return() if the necessity of error-rethrow is detected. Note the extra
* "&" value on the various assert(FALSE) type statements. This allows us to know which of these asserts
* failed.
*/
#define INVOKE_ERROR_RET_IF_NEEDED \
{ \
GBLREF dollar_ecode_type dollar_ecode; \
@ -117,21 +123,22 @@ typedef struct
{ /* this is an error frame and $ECODE is non-NULL during QUIT out of this frame. \
* rethrow the error at lower level */ \
(*dollar_ecode.error_return_addr)(); \
/* We dont expect the above call to return in Unix since we either rethrow \
* the error or do a MUM_TSTART which unwinds the C-stack. But in VMS, we dont \
/* While error_return does not usually return in UNIX, it can if we are \
* unwinding a job-interrupt frame because error rethrowing terminates when a \
* job-interrupt frame is unwound which instead of re-throwing in the \
* interrupted frame sends an error to the operator log. But in VMS, we dont \
* do the latter so it is possible if the current frame is of type SFT_DM that \
* we dont rethrow and dont do a MUM_TSTART as well. Assert accordingly. \
* we don't rethrow and don't do a MUM_TSTART either. Assert accordingly. \
*/ \
UNIX_ONLY(assert(FALSE);) /* this should not return */ \
VMS_ONLY(assert(SFT_DM & frame_pointer->type);) \
} else \
{ \
assert(FALSE); \
assert(FALSE & 2); \
NULLIFY_ERROR_FRAME; /* don't know how we reached here. reset it in PRO */ \
} \
} else if (error_frame < frame_pointer) \
{ \
assert(FALSE); \
assert(FALSE & 3); \
NULLIFY_ERROR_FRAME; /* don't know how we reached here. reset it in PRO */ \
} \
} \

View File

@ -16,9 +16,6 @@
#include "advancewindow.h"
#include "compile_pattern.h"
GBLREF triple *curtchain;
GBLREF char director_token, window_token;
error_def(ERR_EXPR);
error_def(ERR_RHMISSING);
@ -32,38 +29,38 @@ int eval_expr(oprtype *a)
oprtype x1, x2;
opctype i;
unsigned short type;
bool ind_pat;
boolean_t ind_pat;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (!expratom(&x1))
{ /* If didn't already add an error of our own, do so now with catch all expression error */
if (OC_RTERROR != curtchain->exorder.bl->exorder.bl->exorder.bl->opcode)
if (OC_RTERROR != (TREF(curtchain))->exorder.bl->exorder.bl->exorder.bl->opcode)
stx_error(ERR_EXPR);
return EXPR_FAIL;
}
while (i = tokentable[window_token].bo_type)
while (i = tokentable[TREF(window_token)].bo_type) /* NOTE assignment NOT condition */
{
type = tokentable[window_token].opr_type;
type = tokentable[TREF(window_token)].opr_type;
if (oc_tab[i].octype & OCT_BOOL)
{
if (!TREF(shift_side_effects))
{
for (ref = curtchain->exorder.bl; oc_tab[ref->opcode].octype & OCT_BOOL; ref = ref->exorder.bl)
;
assert(FALSE == TREF(saw_side_effect));
for (ref = (TREF(curtchain))->exorder.bl; oc_tab[ref->opcode].octype & OCT_BOOL;
ref = ref->exorder.bl)
;
TREF(expr_start) = TREF(expr_start_orig) = ref;
}
switch (i)
{
case OC_NAND:
case OC_AND:
case OC_NOR:
case OC_OR:
TREF(shift_side_effects) = -TRUE; /* "special" TRUE triggers warning in expritem */
break;
default:
if (!TREF(shift_side_effects))
TREF(shift_side_effects) = TRUE;
case OC_NAND:
case OC_AND:
case OC_NOR:
case OC_OR:
TREF(shift_side_effects) = TRUE;
default:
break;
}
}
coerce(&x1, type);
@ -76,7 +73,7 @@ int eval_expr(oprtype *a)
ref1->operand[1] = put_tref(parm);
ref1 = parm;
ref1->operand[0] = x1;
if (TK_UNDERSCORE != window_token)
if (TK_UNDERSCORE != TREF(window_token))
{
assert(op_count > 1);
ref->operand[0] = put_ilit(op_count);
@ -93,10 +90,10 @@ int eval_expr(oprtype *a)
}
} else
{
if ((TK_QUESTION == window_token) || (TK_NQUESTION == window_token))
if ((TK_QUESTION == TREF(window_token)) || (TK_NQUESTION == TREF(window_token)))
{
ind_pat = FALSE;
if (TK_ATSIGN == director_token)
if (TK_ATSIGN == TREF(director_token))
{
ind_pat = TRUE;
advancewindow();
@ -120,5 +117,5 @@ int eval_expr(oprtype *a)
x1 = put_tref(ref);
}
*a = x1;
return (OC_INDGLVN == curtchain->exorder.bl->opcode) ? EXPR_INDR : EXPR_GOOD;
return (OC_INDGLVN == (TREF(curtchain))->exorder.bl->opcode) ? EXPR_INDR : EXPR_GOOD;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2009 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -24,26 +24,26 @@ void ex_tail(oprtype *opr)
opctype c;
unsigned short w;
assert(opr->oprclass == TRIP_REF);
assert(TRIP_REF == opr->oprclass);
t = opr->oprval.tref;
c = t->opcode;
w = oc_tab[c].octype;
if (w & OCT_EXPRLEAF)
return;
assert(t->operand[0].oprclass == TRIP_REF);
assert(t->operand[1].oprclass == TRIP_REF || t->operand[1].oprclass == 0);
assert(TRIP_REF == t->operand[0].oprclass);
assert((TRIP_REF == t->operand[1].oprclass) || (NOCLASS == t->operand[1].oprclass));
if (!(w & OCT_BOOL))
{
for (i = t->operand ; i < ARRAYTOP(t->operand); i++)
if (i->oprclass == TRIP_REF)
for (i = t->operand; ARRAYTOP(t->operand) > i; i++)
if (TRIP_REF == i->oprclass)
ex_tail(i);
if (c == OC_COMINT && (t1 = t->operand[0].oprval.tref)->opcode == OC_BOOLINIT)
if ((OC_COMINT == c) && (OC_BOOLINIT == (t1 = t->operand[0].oprval.tref)->opcode)) /* NOTE assignment */
opr->oprval.tref = t1;
} else
{
for (t1 = t ; ; t1 = t2)
for (t1 = t; ; t1 = t2)
{
assert(t1->operand[0].oprclass == TRIP_REF);
assert(TRIP_REF == t1->operand[0].oprclass);
t2 = t1->operand[0].oprval.tref;
if (!(oc_tab[t2->opcode].octype & OCT_BOOL))
break;
@ -52,15 +52,15 @@ void ex_tail(oprtype *opr)
dqins(t1->exorder.bl, exorder, bitrip);
t2 = t->exorder.fl;
assert(&t2->operand[0] == opr);
assert(t2->opcode == OC_COMVAL || t2->opcode == OC_COMINT);
if (t2->opcode == OC_COMINT)
dqdel(t2,exorder);
assert((OC_COMVAL == t2->opcode) || (OC_COMINT == t2->opcode));
if (OC_COMINT == t2->opcode)
dqdel(t2, exorder);
t1 = maketriple(OC_BOOLFINI);
t1->operand[0] = put_tref(bitrip);
opr->oprval.tref = bitrip;
dqins(t, exorder, t1);
i = (oprtype *) mcalloc(SIZEOF(oprtype));
bx_tail(t,(bool) FALSE, i);
i = (oprtype *)mcalloc(SIZEOF(oprtype));
bx_tail(t, FALSE, i);
*i = put_tnxt(t1);
}
return;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -56,9 +56,11 @@ void exfun_frame (void)
rts_error(VARLSTCNT(1) ERR_STACKCRIT);
}
sf->temps_ptr = msp;
assert (msp < stackbase);
memset (msp, 0, sf->rvector->temp_size);
assert(msp < stackbase);
memset(msp, 0, sf->rvector->temp_size);
sf->for_ctrl_stack = NULL;
sf->ret_value = NULL;
sf->dollar_test = -1;
sf->old_frame_pointer = frame_pointer;
frame_pointer = sf;
assert((frame_pointer < frame_pointer->old_frame_pointer) || (NULL == frame_pointer->old_frame_pointer));

View File

@ -18,8 +18,6 @@
#define INDIR_DUMMY -1
GBLREF char window_token;
error_def(ERR_ACTOFFSET);
int exfunc(oprtype *a, boolean_t alias_target)
@ -29,8 +27,10 @@ int exfunc(oprtype *a, boolean_t alias_target)
# if defined(USHBIN_SUPPORTED) || defined(VMS)
triple *tripsize;
# endif
DCL_THREADGBL_ACCESS;
assert(TK_DOLLAR == window_token);
SETUP_THREADGBL_ACCESS;
assert(TK_DOLLAR == TREF(window_token));
advancewindow();
dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain);
@ -100,7 +100,7 @@ int exfunc(oprtype *a, boolean_t alias_target)
ref0->operand[0] = calltrip->operand[1];
calltrip->operand[1] = put_tref(ref0);
}
if (TK_LPAREN != window_token)
if (TK_LPAREN != TREF(window_token))
{
masktrip = newtriple(OC_PARAMETER);
counttrip = newtriple(OC_PARAMETER);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -12,30 +12,35 @@
#include "mdef.h"
#include "compiler.h"
#include "opcode.h"
#include "fullbool.h"
int expr(oprtype *a)
int expr(oprtype *a, int m_type)
{
triple *triptr;
int4 rval;
int rval;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
if (!(TREF(expr_depth))++)
TREF(expr_start) = TREF(expr_start_orig) = NULL;
if (!(rval = eval_expr(a)))
if (EXPR_FAIL == (rval = eval_expr(a))) /* NOTE assignment */
{
TREF(expr_depth) = 0;
return FALSE;
}
coerce(a,OCT_MVAL);
coerce(a, (MUMPS_INT == m_type) ? OCT_MINT : OCT_MVAL);
ex_tail(a);
if (!(--(TREF(expr_depth))))
TREF(shift_side_effects) = FALSE;
if (TREF(expr_start) != TREF(expr_start_orig))
{
triptr = newtriple(OC_GVRECTARG);
triptr->operand[0] = put_tref(TREF(expr_start));
assert(TREF(shift_side_effects));
assert((OC_GVSAVTARG == (TREF(expr_start))->opcode));
if ((OC_GVSAVTARG == (TREF(expr_start))->opcode) && (GTM_BOOL == TREF(gtm_fullbool)))
{
if ((OC_GVRECTARG != (TREF(curtchain))->exorder.bl->opcode)
|| ((TREF(curtchain))->exorder.bl->operand[0].oprval.tref != TREF(expr_start)))
newtriple(OC_GVRECTARG)->operand[0] = put_tref(TREF(expr_start));
}
}
if (!(--(TREF(expr_depth))))
TREF(saw_side_effect) = TREF(shift_side_effects) = FALSE;
return rval;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -14,12 +14,12 @@
#include "opcode.h"
#include "toktyp.h"
GBLREF char window_token;
int expratom(oprtype *a)
{
DCL_THREADGBL_ACCESS;
switch(window_token)
SETUP_THREADGBL_ACCESS;
switch(TREF(window_token))
{
case TK_IDENT:
case TK_CIRCUMFLEX:

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* Copyright 2001, 2012 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -10,27 +10,21 @@
****************************************************************/
#include "mdef.h"
#include "compiler.h"
#include "svnames.h"
#include "mdq.h"
#include "opcode.h"
#include "toktyp.h"
#include "svnames.h"
#include "nametabtyp.h"
#include "funsvn.h"
#include "advancewindow.h"
#include "mdq.h"
#include "stringpool.h"
#include "namelook.h"
#include "fullbool.h"
#include "show_source_line.h"
GBLREF bool devctlexp;
GBLREF char director_token;
GBLREF triple *curtchain;
GBLREF boolean_t run_time;
GBLREF mident window_ident;
GBLREF mval window_mval;
GBLREF char window_token;
error_def(ERR_BOOLSIDEFFECT);
error_def(ERR_EXPR);
@ -48,6 +42,21 @@ LITREF mval literal_null;
#define f_char f_zchar
#endif
#define ENCOUNTERED_SIDE_EFFECT \
{ /* Needs #include "show_source_line" and #include "fullbool.h" */ \
char source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)]; \
\
if (TREF(shift_side_effects)) \
{ \
TREF(saw_side_effect) = TRUE; \
if (!run_time && (FULL_BOOL_WARN == TREF(gtm_fullbool))) \
{ /* warnings requested by by gtm_fullbool and enabled by eval_expr */ \
show_source_line(source_line_buff, SIZEOF(source_line_buff), TRUE); \
dec_err(VARLSTCNT(1) ERR_BOOLSIDEFFECT); \
} \
} \
}
/* note that svn_index array provides indexes into this array for each letter of the
* alphabet so changes here should be reflected there.
*/
@ -94,6 +103,7 @@ LITDEF nametabent svn_names[] =
,{ 2, "ZL*" }
,{ 8, "ZMAXTPTI*" }
,{ 3, "ZMO*" }
,{ 5, "ZONLN*"}
,{ 5, "ZPATN" }, {8, "ZPATNUME*" }
,{ 4, "ZPOS*" }
,{ 5, "ZPROC*" }
@ -126,7 +136,7 @@ LITDEF nametabent svn_names[] =
LITDEF unsigned char svn_index[27] = {
0, 0, 0, 0, 2, 8, 8, 8, 10, /* a b c d e f g h i */
12, 14 ,16, 16, 16, 16, 16, 18, 20, /* j k l m n o p q r */
22, 28, 34 ,34, 34, 34, 35, 36, 89 /* s t u v w x y z ~ */
22, 28, 34 ,34, 34, 34, 35, 36, 90 /* s t u v w x y z ~ */
};
/* These entries correspond to the entries in the svn_names array */
@ -173,6 +183,7 @@ LITDEF svn_data_type svn_data[] =
,{ SV_ZLEVEL, FALSE, ALL_SYS }
,{ SV_ZMAXTPTIME, TRUE, ALL_SYS }
,{ SV_ZMODE, FALSE, ALL_SYS }
,{ SV_ZONLNRLBK, FALSE, UNIX_OS }
,{ SV_ZPATNUMERIC, FALSE, ALL_SYS }, { SV_ZPATNUMERIC, FALSE, ALL_SYS }
,{ SV_ZPOS, FALSE, ALL_SYS }
,{ SV_ZPROC, FALSE, ALL_SYS }
@ -444,10 +455,9 @@ GBLDEF int (*fun_parse[])(oprtype *, opctype) = /* contains addresses so can't
int expritem(oprtype *a)
{
int i, index, sv_opcode;
triple *oldchain, *ref, tmpchain, *triptr;
boolean_t parse_warn, save_shift;
triple *oldchain, *ref, tmpchain;
boolean_t parse_warn;
oprtype x1;
char source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)];
unsigned char type;
DCL_THREADGBL_ACCESS;
@ -456,178 +466,147 @@ int expritem(oprtype *a)
assert(SIZEOF(svn_names)/SIZEOF(nametabent) == SIZEOF(svn_data)/SIZEOF(svn_data_type)); /* are all SVNs covered? */
assert(fun_index[26] == (SIZEOF(fun_names)/SIZEOF(nametabent)));
assert(SIZEOF(fun_names)/SIZEOF(nametabent) == SIZEOF(fun_data)/SIZEOF(fun_data_type)); /* are all functions covered? */
if (i = tokentable[window_token].uo_type) /* Note assignment */
if (i = tokentable[TREF(window_token)].uo_type) /* NOTE assignment */
{
type = tokentable[window_token].opr_type;
type = tokentable[TREF(window_token)].opr_type;
advancewindow();
if ((OC_NEG == i) && ((TK_NUMLIT == window_token) || (TK_INTLIT == window_token)))
if ((OC_NEG == i) && ((TK_NUMLIT == TREF(window_token)) || (TK_INTLIT == TREF(window_token))))
{
assert(MV_IS_NUMERIC(&window_mval));
if (window_mval.mvtype & MV_INT)
window_mval.m[1] = -window_mval.m[1];
assert(MV_IS_NUMERIC(&(TREF(window_mval))));
if ((TREF(window_mval)).mvtype & MV_INT)
(TREF(window_mval)).m[1] = -(TREF(window_mval)).m[1];
else
window_mval.sgn = 1;
if (TK_NUMLIT == window_token)
n2s(&window_mval);
(TREF(window_mval)).sgn = 1;
if (TK_NUMLIT == TREF(window_token))
n2s(&(TREF(window_mval)));
} else
{
if (!expratom(&x1))
return FALSE;
coerce(&x1,type);
ref = newtriple((opctype) i);
coerce(&x1, type);
ref = newtriple((opctype)i);
ref->operand[0] = x1;
*a = put_tref(ref);
return TRUE;
}
}
switch(i = window_token) /* Note assignment */
switch (i = TREF(window_token)) /* NOTE assignment */
{
case TK_INTLIT:
n2s(&window_mval);
case TK_NUMLIT:
case TK_STRLIT:
*a = put_lit(&window_mval);
case TK_INTLIT:
n2s(&(TREF(window_mval)));
case TK_NUMLIT:
case TK_STRLIT:
*a = put_lit(&(TREF(window_mval)));
advancewindow();
return TRUE;
case TK_LPAREN:
advancewindow();
if (eval_expr(a) && TK_RPAREN == TREF(window_token))
{
advancewindow();
return TRUE;
case TK_LPAREN:
}
stx_error(ERR_RPARENMISSING);
return FALSE;
case TK_DOLLAR:
if ((TK_DOLLAR == TREF(director_token)) || (TK_AMPERSAND == TREF(director_token)))
{
ENCOUNTERED_SIDE_EFFECT;
TREF(temp_subs) = TRUE;
advancewindow();
if (eval_expr(a) && TK_RPAREN == window_token)
if ((TK_DOLLAR == TREF(window_token)) ? (EXPR_FAIL == exfunc(a, FALSE))
: (EXPR_FAIL == extern_func(a)))
return FALSE;
} else
{
advancewindow();
if (TK_IDENT != TREF(window_token))
{
advancewindow();
return TRUE;
stx_error(ERR_FCNSVNEXPECTED);
return FALSE;
}
stx_error(ERR_RPARENMISSING);
return FALSE;
case TK_DOLLAR:
if ((TK_DOLLAR == director_token) || (TK_AMPERSAND == director_token))
parse_warn = FALSE;
if (TK_LPAREN == TREF(director_token))
{
if ((-TRUE == TREF(shift_side_effects)) && !run_time && (FULL_BOOL_WARN == TREF(gtm_fullbool)))
{ /* warnings requested by by gtm_fullbool and enabled by -TRUE from eval_expr */
show_source_line(source_line_buff, SIZEOF(source_line_buff), TRUE);
dec_err(VARLSTCNT(1) ERR_BOOLSIDEFFECT);
}
advancewindow();
dqinit(&tmpchain, exorder); /* a new chain in case we need to juggle things */
oldchain = setcurtchain(&tmpchain);
save_shift = TREF(shift_side_effects);
if (GTM_BOOL != TREF(gtm_fullbool)) /* if no short circuit, only the outermost should juggle */
TREF(shift_side_effects) = FALSE;
TREF(temp_subs) = TRUE;
if ((TK_DOLLAR == window_token) ? !exfunc(a, FALSE) : !extern_func(a))
index = namelook(fun_index, fun_names, (TREF(window_ident)).addr, (TREF(window_ident)).len);
if (index < 0)
{
setcurtchain(oldchain);
return FALSE;
}
TREF(shift_side_effects) = save_shift;
if (!save_shift || (GTM_BOOL == TREF(gtm_fullbool)))
{ /* put it on the end of the main chain as there's no reason to play with the ordering */
setcurtchain(oldchain);
triptr = curtchain->exorder.bl;
dqadd(triptr, &tmpchain, exorder); /* this is a violation of info hiding */
} else /* put on the shift chain to get side effects in boolean expression */
{ /* add the chain after "expr_start" which may be much before "curtchain" */
ref = newtriple(OC_GVSAVTARG);
dqadd(TREF(expr_start), &tmpchain, exorder); /* this is a violation of info hiding */
TREF(expr_start) = tmpchain.exorder.bl;
setcurtchain(oldchain);
triptr = newtriple(OC_GVRECTARG);
triptr->operand[0] = put_tref(ref);
}
} else
{
advancewindow();
if (TK_IDENT != window_token)
{
stx_error(ERR_FCNSVNEXPECTED);
return FALSE;
}
parse_warn = FALSE;
if (TK_LPAREN == director_token)
{
index = namelook(fun_index, fun_names, window_ident.addr, window_ident.len);
if (index < 0)
{
STX_ERROR_WARN(ERR_INVFCN); /* sets "parse_warn" to TRUE */
} else
{
assert(SIZEOF(fun_names) / SIZEOF(fun_data_type) > index);
if (!VALID_FUN(index))
{
STX_ERROR_WARN(ERR_FNOTONSYS); /* sets "parse_warn" to TRUE */
} else if (OC_FNINCR == fun_data[index].opcode)
{ /* $INCR is used. This can operate on undefined local variables
* and make them defined. If used in a SET where the left and right
* side of the = operator use this variable (as a subscript on the left
* and as input to the $INCR function on the right), we want an UNDEF
* error to show up which means we need to set "temp_subs" to TRUE.
*/
TREF(temp_subs) = TRUE;
if ((-TRUE == TREF(shift_side_effects)) && !run_time
&& (FULL_BOOL_WARN == TREF(gtm_fullbool))) /* warnings requested */
{ /* by gtm_fullbool and enabled by -TRUE from eval_expr */
show_source_line(source_line_buff, SIZEOF(source_line_buff), TRUE);
dec_err(VARLSTCNT(1) ERR_BOOLSIDEFFECT);
}
}
}
advancewindow();
advancewindow();
if (!parse_warn)
{
assert(OPCODE_COUNT > fun_data[index].opcode);
if (!(boolean_t)((*fun_parse[index])(a, fun_data[index].opcode)))
return FALSE;
} else
{
*a = put_lit((mval *)&literal_null);
/* Parse the remaining arguments until the corresponding RIGHT-PAREN/SPACE/EOL
is reached */
if (!parse_until_rparen_or_space())
return FALSE;
}
if (TK_RPAREN != window_token)
{
stx_error(ERR_RPARENMISSING);
return FALSE;
}
advancewindow();
STX_ERROR_WARN(ERR_INVFCN); /* sets "parse_warn" to TRUE */
} else
{
index = namelook(svn_index, svn_names, window_ident.addr, window_ident.len);
if (0 > index)
assert(SIZEOF(fun_names) / SIZEOF(fun_data_type) > index);
if (!VALID_FUN(index))
{
STX_ERROR_WARN(ERR_INVSVN); /* sets "parse_warn" to TRUE */
} else
{
assert(SIZEOF(svn_names) / SIZEOF(svn_data_type) > index);
if (!VALID_SVN(index))
{
STX_ERROR_WARN(ERR_FNOTONSYS); /* sets "parse_warn" to TRUE */
}
STX_ERROR_WARN(ERR_FNOTONSYS); /* sets "parse_warn" to TRUE */
} else if ((OC_FNINCR == fun_data[index].opcode) || (OC_FNZCALL == fun_data[index].opcode))
{ /* $INCR is used. This can operate on undefined local variables
* and make them defined. If used in a SET where the left and right
* side of the = operator use this variable (as a subscript on the left
* and as input to the $INCR function on the right), we want an UNDEF
* error to show up which means we need to set "temp_subs" to TRUE.
*/
TREF(temp_subs) = TRUE;
ENCOUNTERED_SIDE_EFFECT;
}
advancewindow();
if (!parse_warn)
{
sv_opcode = svn_data[index].opcode;
assert(SV_NUM_SV > sv_opcode);
if (SV_TEST == sv_opcode)
*a = put_tref(newtriple(OC_GETTRUTH));
else
{
if (sv_opcode == SV_X || sv_opcode == SV_Y)
devctlexp = TRUE;
ref = newtriple(OC_SVGET);
ref->operand[0] = put_ilit(sv_opcode);
*a = put_tref(ref);
}
} else
*a = put_lit((mval *)&literal_null);
}
advancewindow();
advancewindow();
if (!parse_warn)
{
assert(OPCODE_COUNT > fun_data[index].opcode);
if (!(boolean_t)((*fun_parse[index])(a, fun_data[index].opcode)))
return FALSE;
} else
{
*a = put_lit((mval *)&literal_null);
/* Parse the remaining arguments until the corresponding RIGHT-PAREN/SPACE/EOL
is reached */
if (!parse_until_rparen_or_space())
return FALSE;
}
if (TK_RPAREN != TREF(window_token))
{
stx_error(ERR_RPARENMISSING);
return FALSE;
}
advancewindow();
} else
{
index = namelook(svn_index, svn_names, (TREF(window_ident)).addr, (TREF(window_ident)).len);
if (0 > index)
{
STX_ERROR_WARN(ERR_INVSVN); /* sets "parse_warn" to TRUE */
} else
{
assert(SIZEOF(svn_names) / SIZEOF(svn_data_type) > index);
if (!VALID_SVN(index))
{
STX_ERROR_WARN(ERR_FNOTONSYS); /* sets "parse_warn" to TRUE */
}
}
advancewindow();
if (!parse_warn)
{
sv_opcode = svn_data[index].opcode;
assert(SV_NUM_SV > sv_opcode);
if (SV_TEST == sv_opcode)
*a = put_tref(newtriple(OC_GETTRUTH));
else
{
if (sv_opcode == SV_X || sv_opcode == SV_Y)
devctlexp = TRUE;
ref = newtriple(OC_SVGET);
ref->operand[0] = put_ilit(sv_opcode);
*a = put_tref(ref);
}
} else
*a = put_lit((mval *)&literal_null);
}
return TRUE;
case TK_COLON:
stx_error(ERR_EXPR);
return FALSE;
}
return TRUE;
case TK_COLON:
stx_error(ERR_EXPR);
return FALSE;
}
return FALSE;
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -72,7 +72,9 @@ char *ext2jnl(char *ptr, jnl_record *rec)
muextract_type exttype;
enum jnl_record_type rectype;
jrec_suffix *suffix;
seq_num strm_seqno;
uint4 nodeflags;
uint4 strm_num;
DEBUG_ONLY(uint4 tcom_num = 0;)
ext_stop = ptr + strlen(ptr) + 1;
@ -200,10 +202,17 @@ char *ext2jnl(char *ptr, jnl_record *rec)
assert(NULL != ptr);
ptr = strtok(NULL, "\\"); /* get the client pid field */
assert(NULL != ptr);
ptr = strtok(NULL, "\\"); /* get the token or jnl_seqno */
ptr = strtok(NULL, "\\"); /* get the token/jnl_seqno field */
assert(NULL != ptr);
rec->jrec_null.jnl_seqno = asc2l((uchar_ptr_t)ptr,STRLEN(ptr));
ptr = strtok(NULL, "\\"); /* get the strm_num field */
assert(NULL != ptr);
strm_num = asc2l((uchar_ptr_t)ptr,STRLEN(ptr));
ptr = strtok(NULL, "\\"); /* get the strm_seqno field */
assert(NULL != ptr);
strm_seqno = asc2l((uchar_ptr_t)ptr,STRLEN(ptr));
UNIX_ONLY(rec->jrec_null.strm_seqno = SET_STRM_INDEX(strm_seqno, strm_num);)
VMS_ONLY(rec->jrec_null.strm_seqno = strm_seqno;)
switch(exttype)
{
case MUEXT_NULL:
@ -246,7 +255,7 @@ char *ext2jnl(char *ptr, jnl_record *rec)
rec->jrec_set_kill.mumps_node.length = gv_currkey->end;
memcpy(rec->jrec_set_kill.mumps_node.text, gv_currkey->base, gv_currkey->end);
temp_reclen = (int)(FIXED_UPD_RECLEN + rec->jrec_set_kill.mumps_node.length + SIZEOF(jnl_str_len_t));
if (IS_KILL_ZKILL(rectype))
if (IS_KILL_ZKILL_ZTRIG(rectype))
{
temp_reclen += JREC_SUFFIX_SIZE;
reclen = ROUND_UP2(temp_reclen, JNL_REC_START_BNDRY);

View File

@ -19,10 +19,8 @@
#include "mmemory.h"
#endif
GBLREF char director_token;
GBLREF char *lexical_ptr;
GBLREF unsigned char *source_buffer;
GBLREF char window_token;
error_def(ERR_RTNNAME);
@ -34,12 +32,12 @@ error_def(ERR_RTNNAME);
/* compiler parse to AVT module for external functions ($&) */
int extern_func(oprtype *a)
{
boolean_t have_ident;
char *extref;
int cnt, actcnt;
mstr extentry, package;
oprtype *nxtopr;
triple *calltrip, *ref;
boolean_t have_ident;
int cnt, actcnt;
# ifdef VMS
char *extsym, *extern_symbol;
oprtype tabent;
@ -47,31 +45,31 @@ int extern_func(oprtype *a)
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert (TK_AMPERSAND == window_token);
assert (TK_AMPERSAND == TREF(window_token));
advancewindow();
cnt = 0;
extref = (char *)&source_buffer[TREF(last_source_column) - 1];
package.len = 0;
package.addr = NULL;
if (have_ident = (window_token == TK_IDENT)) /* assignment */
if (have_ident = (TK_IDENT == TREF(window_token))) /* NOTE assignment */
{
if (TK_PERIOD == director_token)
if (TK_PERIOD == TREF(director_token))
{ /* if ident is a package reference, then take it off */
package.addr = extref;
package.len = INTCAST(lexical_ptr - extref - 1);
VMS_ONLY(package.len = ((package.len > MAX_EXTREF) ? MAX_EXTREF : package.len));
VMS_ONLY(package.len = ((MAX_EXTREF < package.len) ? MAX_EXTREF : package.len));
extref = lexical_ptr;
advancewindow(); /* get to . */
advancewindow(); /* to next token */
if (have_ident = (TK_IDENT == window_token)) /* assignment */
if (have_ident = (TK_IDENT == TREF(window_token))) /* NOTE assignment */
advancewindow();
} else
advancewindow();
}
if (TK_CIRCUMFLEX == window_token)
if (TK_CIRCUMFLEX == TREF(window_token))
{
advancewindow();
if (TK_IDENT == window_token)
if (TK_IDENT == TREF(window_token))
{
have_ident = TRUE;
advancewindow();
@ -85,7 +83,7 @@ int extern_func(oprtype *a)
extentry.len = INTCAST((char *)&source_buffer[TREF(last_source_column) - 1] - extref);
extentry.len = INTCAST(extentry.len > MAX_EXTREF ? MAX_EXTREF : extentry.len);
extentry.addr = extref;
#ifdef VMS_CASE_SENSITIVE_MACROS
# ifdef VMS_CASE_SENSITIVE_MACROS
if (!run_time)
{ /* this code is disabled because the
* external call table macros are not case sensitive
@ -108,16 +106,16 @@ int extern_func(oprtype *a)
tabent = put_cdlt(&extentry);
} else
{
#endif
# endif
# ifdef VMS
ref = newtriple(OC_FGNLOOKUP);
ref->operand[0] = put_str(package.addr, package.len);
ref->operand[1] = put_str(extentry.addr, extentry.len);
tabent = put_tref(ref);
# endif
#ifdef VMS_CASE_SENSITIVE_MACROS
# ifdef VMS_CASE_SENSITIVE_MACROS
}
#endif
# endif
calltrip = maketriple(a ? OC_FNFGNCAL : OC_FGNCAL);
nxtopr = &calltrip->operand[1];
ref = newtriple(OC_PARAMETER);
@ -132,7 +130,7 @@ int extern_func(oprtype *a)
nxtopr = &ref->operand[1];
cnt++;
# endif
if (TK_LPAREN != window_token)
if (TK_LPAREN != TREF(window_token))
{
ref = newtriple(OC_PARAMETER);
ref->operand[0] = put_ilit(0);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -14,21 +14,21 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
int f_ascii(oprtype *a, opctype op)
{
triple *r;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!strexpr(&(r->operand[0])))
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
r->operand[1] = put_ilit(1);
else
{
advancewindow();
if (!intexpr(&(r->operand[1])))
if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT))
return FALSE;
}
ins_triple(r);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,61 +15,62 @@
#include "indir_enum.h"
#include "toktyp.h"
#include "mdq.h"
#include "fullbool.h"
GBLREF char window_token;
error_def(ERR_VAREXPECTED);
int f_data(oprtype *a, opctype op)
{
triple *oldchain, tmpchain, *r, *triptr;
error_def(ERR_VAREXPECTED);
triple *oldchain, *r, tmpchain, *triptr;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
assert(OC_FNDATA == op || OC_FNZDATA == op);
r = maketriple(op);
switch (window_token)
switch (TREF(window_token))
{
case TK_IDENT:
if (!lvn(&(r->operand[0]), OC_SRCHINDX, 0))
return FALSE;
ins_triple(r);
break;
case TK_CIRCUMFLEX:
if (!gvn())
return FALSE;
r->opcode = OC_GVDATA;
ins_triple(r);
break;
case TK_ATSIGN:
if (TREF(shift_side_effects))
{
dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain);
if (!indirection(&(r->operand[0])))
{
setcurtchain(oldchain);
return FALSE;
}
r->operand[1] = put_ilit((mint)(OC_FNDATA == op ? indir_fndata : indir_fnzdata));
ins_triple(r);
newtriple(OC_GVSAVTARG);
setcurtchain(oldchain);
dqadd(TREF(expr_start), &tmpchain, exorder);
TREF(expr_start) = tmpchain.exorder.bl;
triptr = newtriple(OC_GVRECTARG);
triptr->operand[0] = put_tref(TREF(expr_start));
} else
{
if (!indirection(&(r->operand[0])))
return FALSE;
r->operand[1] = put_ilit((mint)(OC_FNDATA == op ? indir_fndata : indir_fnzdata));
ins_triple(r);
}
r->opcode = OC_INDFUN;
break;
default:
stx_error(ERR_VAREXPECTED);
case TK_IDENT:
if (!lvn(&(r->operand[0]), OC_SRCHINDX, 0))
return FALSE;
ins_triple(r);
break;
case TK_CIRCUMFLEX:
if (!gvn())
return FALSE;
r->opcode = OC_GVDATA;
ins_triple(r);
break;
case TK_ATSIGN:
TREF(saw_side_effect) = TREF(shift_side_effects);
if (TREF(shift_side_effects) && (GTM_BOOL == TREF(gtm_fullbool)))
{
dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain);
if (!indirection(&(r->operand[0])))
{
setcurtchain(oldchain);
return FALSE;
}
r->operand[1] = put_ilit((mint)(OC_FNDATA == op ? indir_fndata : indir_fnzdata));
ins_triple(r);
newtriple(OC_GVSAVTARG);
setcurtchain(oldchain);
dqadd(TREF(expr_start), &tmpchain, exorder);
TREF(expr_start) = tmpchain.exorder.bl;
triptr = newtriple(OC_GVRECTARG);
triptr->operand[0] = put_tref(TREF(expr_start));
} else
{
if (!indirection(&(r->operand[0])))
return FALSE;
r->operand[1] = put_ilit((mint)(OC_FNDATA == op ? indir_fndata : indir_fnzdata));
ins_triple(r);
}
r->opcode = OC_INDFUN;
break;
default:
stx_error(ERR_VAREXPECTED);
return FALSE;
}
*a = put_tref(r);
return TRUE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001, 2010 Fidelity Information Services, Inc *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,38 +15,35 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
/* Note this function compiler routine is used for all of $EXTRACT,
$ZEXTRACT, and $ZSUBSTR since the format of the call is identical
in all instances as the function is similar.
*/
/* $EXTRACT, $ZEXTRACT, and $ZSUBSTR use this compiler routine as all have similar function and identical invocation signatures */
int f_extract(oprtype *a, opctype op)
{
triple *first, *last, *r;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!strexpr(&(r->operand[0])))
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
first = newtriple(OC_PARAMETER);
last = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(first);
first->operand[1] = put_tref(last);
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
first->operand[0] = put_ilit(1);
last->operand[0] = put_ilit((OC_FNZSUBSTR == op) ? MAXPOSINT4 : 1);
} else
{
advancewindow();
if (!intexpr(&(first->operand[0])))
if (EXPR_FAIL == expr(&(first->operand[0]), MUMPS_INT))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
last->operand[0] = (OC_FNZSUBSTR == op) ? put_ilit(MAXPOSINT4) : first->operand[0];
else
{
advancewindow();
if (!intexpr(&(last->operand[0])))
if (EXPR_FAIL == expr(&(last->operand[0]), MUMPS_INT))
return FALSE;
}
}

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
error_def(ERR_COMMA);
int f_find(oprtype *a, opctype op)
{
triple *delimiter, *start, *r;
error_def(ERR_COMMA);
triple *delimiter, *r, *start;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!strexpr(&(r->operand[0])))
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
@ -35,14 +36,14 @@ int f_find(oprtype *a, opctype op)
start = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(delimiter);
delimiter->operand[1] = put_tref(start);
if (!strexpr(&(delimiter->operand[0])))
if (EXPR_FAIL == expr(&(delimiter->operand[0]), MUMPS_STR))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
start->operand[0] = put_ilit(1);
else
{
advancewindow();
if (!intexpr(&(start->operand[0])))
if (EXPR_FAIL == expr(&(start->operand[0]), MUMPS_INT))
return FALSE;
}
ins_triple(r);

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -16,26 +16,27 @@
#include "mdq.h"
#include "advancewindow.h"
GBLREF char window_token;
error_def(ERR_COMMA);
int f_fnumber( oprtype *a, opctype op)
int f_fnumber(oprtype *a, opctype op)
{
triple *ref, *next, *r;
oprtype z;
error_def(ERR_COMMA);
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!numexpr(&r->operand[0]))
if (EXPR_FAIL == expr(&r->operand[0], MUMPS_NUM))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
}
advancewindow();
if (!strexpr(&r->operand[1]))
if (EXPR_FAIL == expr(&r->operand[1], MUMPS_STR))
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
ref = newtriple(OC_FORCENUM);
ref->operand[0] = r->operand[0];
@ -43,7 +44,7 @@ int f_fnumber( oprtype *a, opctype op)
} else
{
advancewindow();
if (!intexpr(&z))
if (EXPR_FAIL == expr(&z, MUMPS_INT))
return FALSE;
ref = newtriple(OC_FNJ3);
ref->operand[0] = r->operand[0];

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
error_def(ERR_COMMA);
int f_fnzbitfind( oprtype *a, opctype op)
int f_fnzbitfind(oprtype *a, opctype op)
{
triple *r, *parm;
error_def(ERR_COMMA);
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
@ -33,17 +34,16 @@ int f_fnzbitfind( oprtype *a, opctype op)
parm = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(parm);
advancewindow();
if (!intexpr(&(parm->operand[0]))) /* truthval */
if (EXPR_FAIL == expr(&(parm->operand[0]), MUMPS_INT)) /* truthval */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
parm->operand[1] = put_ilit(1);
else
{
advancewindow();
if (!intexpr(&(parm->operand[1]))) /* position */
if (EXPR_FAIL == expr(&(parm->operand[1]), MUMPS_INT)) /* position */
return FALSE;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -14,25 +14,25 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
error_def(ERR_COMMA);
int f_fnzbitget( oprtype *a, opctype op)
int f_fnzbitget(oprtype *a, opctype op)
{
triple *r;
error_def(ERR_COMMA);
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
}
advancewindow();
if (!intexpr(&(r->operand[1]))) /* position */
if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT)) /* position */
return FALSE;
ins_triple(r);
*a = put_tref(r);
return TRUE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
error_def(ERR_COMMA);
int f_fnzbitset( oprtype *a, opctype op)
int f_fnzbitset(oprtype *a, opctype op)
{
triple *r, *parm;
error_def(ERR_COMMA);
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
@ -33,17 +34,16 @@ int f_fnzbitset( oprtype *a, opctype op)
parm = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(parm);
advancewindow();
if (!intexpr(&(parm->operand[0]))) /* position */
if (EXPR_FAIL == expr(&(parm->operand[0]), MUMPS_INT)) /* position */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
{
stx_error(ERR_COMMA);
return FALSE;
}
advancewindow();
if (!intexpr(&(parm->operand[1]))) /* truthval */
if (EXPR_FAIL == expr(&(parm->operand[1]), MUMPS_INT)) /* truthval */
return FALSE;
ins_triple(r);
*a = put_tref(r);
return TRUE;

View File

@ -1,6 +1,6 @@
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* Copyright 2001, 2011 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
@ -14,24 +14,23 @@
#include "toktyp.h"
#include "advancewindow.h"
GBLREF char window_token;
int f_fnzbitstr( oprtype *a, opctype op )
int f_fnzbitstr(oprtype *a, opctype op)
{
triple *r, *parm;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op);
if (!intexpr(&(r->operand[0]))) /* size */
if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_INT)) /* size */
return FALSE;
if (window_token != TK_COMMA)
if (TK_COMMA != TREF(window_token))
r->operand[1] = put_ilit(0);
else
{
advancewindow();
if (!intexpr(&(r->operand[1]))) /* position */
if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT)) /* position */
return FALSE;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;

Some files were not shown because too many files have changed in this diff Show More