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 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 The prerequisites are GNU make, GT.M binary installation (which you can
download from http://sourceforge.net/projects/fis-gtm/), Linux x86, tcsh, 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -24,6 +24,9 @@
#define XFER_LONG_SZ 6 #define XFER_LONG_SZ 6
#define INST_SZ 1 #define INST_SZ 1
error_def(ERR_LABELUNKNOWN);
error_def(ERR_ROUTINEUNKNOWN);
rhdtyp *auto_zlink (unsigned char *pc, int4 **line) rhdtyp *auto_zlink (unsigned char *pc, int4 **line)
{ {
char *adj_pc; /* address of PEA rtnref offset */ char *adj_pc; /* address of PEA rtnref offset */
@ -32,61 +35,52 @@ rhdtyp *auto_zlink (unsigned char *pc, int4 **line)
urx_rtnref *rtnurx; urx_rtnref *rtnurx;
mval rtn; mval rtn;
rhdtyp *rhead; rhdtyp *rhead;
error_def (ERR_ROUTINEUNKNOWN);
error_def (ERR_LABELUNKNOWN);
union union
{ {
ModR_M modrm; ModR_M modrm;
unsigned char byte; unsigned char byte;
} modrm_byte_byte, modrm_byte_long; } modrm_byte_byte, modrm_byte_long;
/* ASSUMPTION -- The instruction previous to the current mpc is a transfer table jump. /* 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 * 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). * 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.reg_opcode = I386_INS_CALL_Ev;
modrm_byte_byte.modrm.mod = I386_MOD32_BASE_DISP_8; modrm_byte_byte.modrm.mod = I386_MOD32_BASE_DISP_8;
modrm_byte_byte.modrm.r_m = I386_REG_EBX; modrm_byte_byte.modrm.r_m = I386_REG_EBX;
modrm_byte_long.modrm.reg_opcode = I386_INS_CALL_Ev; modrm_byte_long.modrm.reg_opcode = I386_INS_CALL_Ev;
modrm_byte_long.modrm.mod = I386_MOD32_BASE_DISP_32; modrm_byte_long.modrm.mod = I386_MOD32_BASE_DISP_32;
modrm_byte_long.modrm.r_m = I386_REG_EBX; 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; 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; adj_pc = (char *)pc - XFER_LONG_SZ - PEA_SZ;
} } else
else
GTMASSERT; 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((0 <= rname.len) && (MAX_MIDENT_LEN >= rname.len));
assert (rname.addr); assert(rname.addr);
/* Copy rname into local storage because azl_geturxrtn sets /* Copy rname into local storage because azl_geturxrtn sets rname.addr to an address that is
rname.addr to an address that is freed during op_zlink * freed during op_zlink and before the call to find_rtn_hdr.
and before the call to find_rtn_hdr.
*/ */
memcpy(rname_local.c, rname.addr, rname.len); memcpy(rname_local.c, rname.addr, rname.len);
rname.addr = rname_local.c; rname.addr = rname_local.c;
assert (rtnurx); assert(rtnurx);
assert (*(adj_pc - PEA_SZ) == I386_INS_PUSH_Iv); assert(*(adj_pc - PEA_SZ) == I386_INS_PUSH_Iv);
assert (azl_geturxlab (adj_pc - PEA_SZ + INST_SZ, rtnurx)); assert(azl_geturxlab(adj_pc - PEA_SZ + INST_SZ, rtnurx));
assert (!find_rtn_hdr (&rname)); assert(!find_rtn_hdr(&rname));
rtn.mvtype = MV_STR; rtn.mvtype = MV_STR;
rtn.str.len = rname.len; rtn.str.len = rname.len;
rtn.str.addr = rname.addr; rtn.str.addr = rname.addr;
op_zlink (&rtn, 0); 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)) if (!(*line))
rts_error(VARLSTCNT(1) ERR_LABELUNKNOWN); rts_error(VARLSTCNT(1) ERR_LABELUNKNOWN);
return rhead; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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; call_addr = (unsigned char *)addr;
modrm_byte.byte = *(call_addr + 1); 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++; call_addr++;
assert (modrm_byte.modrm.r_m == I386_REG_EBX); assert(I386_REG_EBX == modrm_byte.modrm.r_m);
call_addr++; 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) || if ((xf_linestart * SIZEOF(int4) == *call_addr) ||
*call_addr == xf_zbstart * SIZEOF(int4)) (xf_zbstart * SIZEOF(int4) == *call_addr))
return (zb_code *)call_addr; return (zb_code *)call_addr;
call_addr++; call_addr++;
} } else
else
{ {
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32); assert (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod);
if (*((int4 *)call_addr) != xf_isformal * SIZEOF(int4))
return (zb_code *)addr; return (zb_code *)addr;
call_addr += SIZEOF(int4);
} }
} }
modrm_byte.byte = *(call_addr + 1); 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); call_addr += 1 + SIZEOF(unsigned char);
else else
{ {
assert (*call_addr == I386_INS_PUSH_Iv); assert(I386_INS_PUSH_Iv == *call_addr);
call_addr += 1 + SIZEOF(int4); call_addr += 1 + SIZEOF(int4);
} }
} }
modrm_byte.byte = *(call_addr + 1); 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; return (zb_code *)addr;
assert((I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod) || (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod));
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8 || modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32); assert(I386_REG_EBX == modrm_byte.modrm.r_m);
assert (modrm_byte.modrm.r_m == I386_REG_EBX);
call_addr++; 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) && if ((xf_linefetch * SIZEOF(int4) != *call_addr) && (xf_zbfetch * SIZEOF(int4) != *call_addr))
*call_addr != xf_zbfetch * SIZEOF(int4))
return (zb_code *)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++; call_addr++;
assert (modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_8 || modrm_byte.modrm.mod == I386_MOD32_BASE_DISP_32); assert((I386_MOD32_BASE_DISP_8 == modrm_byte.modrm.mod) || (I386_MOD32_BASE_DISP_32 == modrm_byte.modrm.mod));
assert (modrm_byte.modrm.r_m == I386_REG_EBX); assert(I386_REG_EBX == modrm_byte.modrm.r_m);
call_addr++; 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) && if ((xf_linestart * SIZEOF(int4) != *call_addr) && (xf_zbstart * SIZEOF(int4) != *call_addr))
*call_addr != xf_zbstart * SIZEOF(int4))
return (zb_code *)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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -28,7 +28,7 @@ msf_typ_off = 32
msf_flags_off = 34 msf_flags_off = 34
msf_for_ctrl_stack = 36 msf_for_ctrl_stack = 36
msf_frame_size = 40 msf_frame_size = 44
SFT_COUNT = 0x01 SFT_COUNT = 0x01
SFT_DM = 0x02 SFT_DM = 0x02
@ -36,7 +36,6 @@ SFT_REP_OP = 0x04
SFT_ZBRK_ACT = 0x08 SFT_ZBRK_ACT = 0x08
SFT_DEV_ACT = 0x10 SFT_DEV_ACT = 0x10
SFT_ZTRAP = 0x20 SFT_ZTRAP = 0x20
SFT_EXTFUN = 0x40
SFT_ZSTEP_ACT = 0x80 SFT_ZSTEP_ACT = 0x80
SFT_ZINTR = 0x100 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -27,17 +27,19 @@
#include "cmd_qlf.h" /* needed for CQ_UTF8 */ #include "cmd_qlf.h" /* needed for CQ_UTF8 */
#include "gtm_text_alloc.h" #include "gtm_text_alloc.h"
/* INCR_LINK - read and process a mumps object module. Link said module to /* INCR_LINK - read and process a mumps object module. Link said module to currently executing image */
currently executing image */
LITREF char gtm_release_name[]; LITREF char gtm_release_name[];
LITREF int4 gtm_release_name_len; LITREF int4 gtm_release_name_len;
static char *code; static char *code;
GBLREF mident_fixed zlink_mname; GBLREF mident_fixed zlink_mname;
GBLREF unsigned char *zl_lab_err;
GBLREF boolean_t gtm_utf8_mode; 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 */ #define RELREAD 50 /* number of relocation entries to buffer */
typedef struct res_list_struct typedef struct res_list_struct
{ {
@ -53,7 +55,7 @@ bool incr_link(int file_desc)
{ {
rhdtyp *hdr, *old_rhead; rhdtyp *hdr, *old_rhead;
int code_size, save_errno, cnt; 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; char *literal_ptr;
var_tabent *curvar; var_tabent *curvar;
char module_name[SIZEOF(mident_fixed)]; char module_name[SIZEOF(mident_fixed)];
@ -62,16 +64,11 @@ bool incr_link(int file_desc)
int order; int order;
struct exec file_hdr; struct exec file_hdr;
error_def(ERR_INVOBJ);
error_def(ERR_LOADRUNNING);
error_def(ERR_TEXT);
urx_lcl_anchor.len = 0; urx_lcl_anchor.len = 0;
urx_lcl_anchor.addr = 0; urx_lcl_anchor.addr = 0;
urx_lcl_anchor.lab = 0; urx_lcl_anchor.lab = 0;
urx_lcl_anchor.next = 0; urx_lcl_anchor.next = 0;
code = NULL; code = NULL;
DOREADRL(file_desc, &file_hdr, SIZEOF(file_hdr), read_size); DOREADRL(file_desc, &file_hdr, SIZEOF(file_hdr), read_size);
if (read_size != SIZEOF(file_hdr)) if (read_size != SIZEOF(file_hdr))
{ {
@ -80,16 +77,13 @@ bool incr_link(int file_desc)
save_errno = errno; save_errno = errno;
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)), zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)),
STRERROR(save_errno)); STRERROR(save_errno));
} } else
else
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("reading file header")); 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")); zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("bad magic"));
else if (OBJ_LABEL != file_hdr.a_stamp) else if (OBJ_LABEL != file_hdr.a_stamp)
return FALSE; /* wrong version */ return FALSE; /* wrong version */
assert(0 == file_hdr.a_bss);
assert (file_hdr.a_bss == 0);
code_size = file_hdr.a_text + file_hdr.a_data; code_size = file_hdr.a_text + file_hdr.a_data;
code = GTM_TEXT_ALLOC(code_size); code = GTM_TEXT_ALLOC(code_size);
DOREADRL(file_desc, code, code_size, read_size); DOREADRL(file_desc, code, code_size, read_size);
@ -98,10 +92,8 @@ bool incr_link(int file_desc)
if (-1 == read_size) if (-1 == read_size)
{ {
save_errno = errno; save_errno = errno;
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)), zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, strlen(STRERROR(save_errno)), STRERROR(save_errno)); /* BYPASSOK */
STRERROR(save_errno)); } else
}
else
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("reading code")); zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("reading code"));
} }
hdr = (rhdtyp *)code; hdr = (rhdtyp *)code;
@ -120,38 +112,30 @@ bool incr_link(int file_desc)
curvar->var_name.addr += (uint4)literal_ptr; curvar->var_name.addr += (uint4)literal_ptr;
} }
for (cnt = hdr->labtab_len, curlab = LABTAB_ADR(hdr); cnt; --cnt, ++curlab) 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; curlab->lab_name.addr += (uint4)literal_ptr;
}
if (!addr_fix(file_desc, &file_hdr, &urx_lcl_anchor, hdr)) if (!addr_fix(file_desc, &file_hdr, &urx_lcl_anchor, hdr))
{ {
urx_free(&urx_lcl_anchor); urx_free(&urx_lcl_anchor);
zl_error(file_desc, ERR_INVOBJ, ERR_TEXT, RTS_ERROR_TEXT("address fixup failure")); 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); urx_free(&urx_lcl_anchor);
/* Copy routine name to local variable because zl_error free's it. */ /* Copy routine name to local variable because zl_error free's it. */
memcpy(&module_name[0], hdr->routine_name.addr, hdr->routine_name.len); 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]); zl_error(file_desc, 0, ERR_LOADRUNNING, hdr->routine_name.len, &module_name[0]);
} }
urx_add (&urx_lcl_anchor); urx_add(&urx_lcl_anchor);
old_rhead = (rhdtyp *)hdr->old_rhead_ptr;
old_rhead = (rhdtyp *) hdr->old_rhead_ptr; lbt_bot = (lab_tabent *)((char *)hdr + hdr->labtab_ptr);
lbt_bot = (lab_tabent *) ((char *)hdr + hdr->labtab_ptr);
lbt_top = lbt_bot + hdr->labtab_len; lbt_top = lbt_bot + hdr->labtab_len;
while (old_rhead) 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; lbt_ent = lbt_bot;
olnt_ent = (int4 *)((char *) old_rhead + old_rhead->lnrtab_ptr); olbt_bot = (lab_tabent *)((char *)old_rhead + old_rhead->labtab_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_top = olbt_bot + old_rhead->labtab_len; 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++) for (; lbt_ent < lbt_top; lbt_ent++)
{ {
@ -161,11 +145,12 @@ bool incr_link(int file_desc)
} }
if ((lbt_ent < lbt_top) && !order) if ((lbt_ent < lbt_top) && !order)
{ {
olnt_ent = (int4 *)((char *) old_rhead + olbt_ent->lab_ln_ptr); olbt_ent->lab_ln_ptr = lbt_ent->lab_ln_ptr;
assert(*olnt_ent == lab_miss_off); olbt_ent->has_parms = lbt_ent->has_parms;
*olnt_ent = *((int4 *) (code + lbt_ent->lab_ln_ptr)); } 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->src_full_name = hdr->src_full_name;
old_rhead->routine_name = hdr->routine_name; old_rhead->routine_name = hdr->routine_name;
old_rhead->vartab_len = hdr->vartab_len; 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->temp_size = hdr->temp_size;
old_rhead = (rhdtyp *) old_rhead->old_rhead_ptr; old_rhead = (rhdtyp *) old_rhead->old_rhead_ptr;
} }
urx_resolve (hdr, lbt_bot, lbt_top); urx_resolve(hdr, lbt_bot, lbt_top);
return TRUE; 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); numrel = (fhead->a_trsize + fhead->a_drsize) / SIZEOF(struct relocation_info);
if (numrel * SIZEOF(struct relocation_info) != fhead->a_trsize + fhead->a_drsize) if (numrel * SIZEOF(struct relocation_info) != fhead->a_trsize + fhead->a_drsize)
return FALSE; return FALSE;
for ( ; numrel;) for ( ; numrel;)
{ {
rel_read = numrel < RELREAD ? numrel : RELREAD; 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; numrel -= rel_read;
for (i = 0; i < rel_read; i++) 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->symnum = rel[i].r_symbolnum;
new_res->addr = rel[i].r_address; new_res->addr = rel[i].r_address;
new_res->next = new_res->list = 0; 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_temp = res_root;
res_temp1 = 0; res_temp1 = 0;
while (res_temp) while (res_temp)
{ if (res_temp->symnum >= new_res->symnum) {
if (res_temp->symnum >= new_res->symnum)
break; break;
res_temp1 = res_temp; res_temp1 = res_temp;
res_temp = res_temp->next; res_temp = res_temp->next;
} }
if (res_temp) if (res_temp)
{ if (res_temp->symnum == new_res->symnum) { if (res_temp->symnum == new_res->symnum)
{ new_res->list = res_temp->list; {
new_res->list = res_temp->list;
res_temp->list = new_res; res_temp->list = new_res;
} } else
else
{ if (res_temp1) { if (res_temp1)
{ new_res->next = res_temp1->next; {
new_res->next = res_temp1->next;
res_temp1->next = new_res; res_temp1->next = new_res;
} } else
else {
{ assert(res_temp == res_root); assert(res_temp == res_root);
new_res->next = res_root; new_res->next = res_root;
res_root = new_res; res_root = new_res;
} }
} }
} } else
else
res_temp1->next = new_res; res_temp1->next = new_res;
} }
} } else
else
*(unsigned int *)(((char *)code) + rel[i].r_address) += (unsigned int)code; *(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; zlink_mname.c[code->routine_name.len] = 0;
if (!res_root) if (!res_root)
return TRUE; return TRUE;
if ((off_t)-1 == lseek(file, (off_t)fhead->a_syms, SEEK_CUR)) if ((off_t)-1 == lseek(file, (off_t)fhead->a_syms, SEEK_CUR))
{ res_free(res_root); { res_free(res_root);
return FALSE; return FALSE;
@ -279,13 +264,14 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
res_free(res_root); res_free(res_root);
return FALSE; return FALSE;
} }
/* Match up unresolved entries with the null terminated symbol name entries from the /* 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; sym_temp = sym_temp1 = symbols;
symtop = symbols + string_size; symtop = symbols + string_size;
for (i = 0; res_root; i++) for (i = 0; res_root; i++)
{ while (i < res_root->symnum) {
while (i < res_root->symnum)
{ /* Forward symbol space until our symnum index (i) matches the symbol we are processing in res_root */ { /* Forward symbol space until our symnum index (i) matches the symbol we are processing in res_root */
while (*sym_temp) while (*sym_temp)
{ {
@ -303,7 +289,7 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
} }
assert (i == res_root->symnum); assert (i == res_root->symnum);
/* Find end of routine name that we care about */ /* Find end of routine name that we care about */
while (*sym_temp1 != '.' && *sym_temp1) while (('.' != *sym_temp1) && *sym_temp1)
{ if (sym_temp1 >= symtop) { if (sym_temp1 >= symtop)
{ {
free(symbols); free(symbols);
@ -316,9 +302,9 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
assert(sym_size <= MAX_MIDENT_LEN); assert(sym_size <= MAX_MIDENT_LEN);
memcpy(&rtnid.c[0], sym_temp, sym_size); memcpy(&rtnid.c[0], sym_temp, sym_size);
rtnid.c[sym_size] = 0; rtnid.c[sym_size] = 0;
if (rtnid.c[0] == '_') if ('_' == rtnid.c[0])
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.addr = &rtnid.c[0];
rtn_str.len = sym_size; rtn_str.len = sym_size;
rtn = find_rtn_hdr(&rtn_str); /* Routine already resolved? */ rtn = find_rtn_hdr(&rtn_str); /* Routine already resolved? */
@ -329,7 +315,8 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
sym_temp1++; sym_temp1++;
sym_temp = sym_temp1; sym_temp = sym_temp1;
while (*sym_temp1) while (*sym_temp1)
{ if (sym_temp1 >= symtop) {
if (sym_temp1 >= symtop)
{ {
free(symbols); free(symbols);
res_free(res_root); res_free(res_root);
@ -341,7 +328,7 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
assert(sym_size <= MAX_MIDENT_LEN); assert(sym_size <= MAX_MIDENT_LEN);
memcpy(&labid.c[0], sym_temp, sym_size); memcpy(&labid.c[0], sym_temp, sym_size);
labid.c[sym_size] = 0; labid.c[sym_size] = 0;
if (labid.c[0] == '_') if ('_' == labid.c[0])
labid.c[0] = '%'; labid.c[0] = '%';
labsym = TRUE; labsym = TRUE;
} }
@ -351,23 +338,23 @@ bool addr_fix(int file, struct exec *fhead, urx_rtnref *urx_lcl, rhdtyp *code)
{ /* The routine part at least is known */ { /* The routine part at least is known */
if (labsym) if (labsym)
{ /* Look our target label up in the routines label table */ { /* Look our target label up in the routines label table */
label = (lab_tabent *)((char *) rtn + rtn->labtab_ptr); label = (lab_tabent *)((char *)rtn + rtn->labtab_ptr);
labtop = label + rtn->labtab_len; labtop = label + rtn->labtab_len;
for (; label < labtop && (sym_size != label->lab_name.len || for (; label < labtop && ((sym_size != label->lab_name.len)
memcmp(&labid.c[0], label->lab_name.addr, sym_size)); label++) || memcmp(&labid.c[0], label->lab_name.addr, sym_size)); label++)
; ;
if (label < labtop) if (label < labtop)
res_addr = (char *)(label->LABENT_LNR_OFFSET + (char *)rtn); res_addr = (char *)&label->LABENT_LNR_OFFSET;
else else
res_addr = 0; res_addr = 0;
} } else
else
res_addr = (char *)rtn; res_addr = (char *)rtn;
if (res_addr) 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; res_temp = res_root->next;
while(res_root) while (res_root)
{ *(uint4 *)(((char *)code) + res_root->addr) = (unsigned int) res_addr; {
*(uint4 *)(((char *)code) + res_root->addr) = (unsigned int)res_addr;
res_temp1 = res_root->list; res_temp1 = res_root->list;
free(res_root); free(res_root);
res_root = res_temp1; 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 */ /* 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); urx_rp = urx_putrtn(rtn_str.addr, rtn_str.len, urx_lcl);
res_temp = res_root->next; res_temp = res_root->next;
while(res_root) while (res_root)
{ {
if (labsym) if (labsym)
urx_putlab(&labid.c[0], sym_size, urx_rp, ((char *)code) + res_root->addr); urx_putlab(&labid.c[0], sym_size, urx_rp, ((char *)code) + res_root->addr);
else 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->next = urx_rp->addr;
urx_tmpaddr->addr = (INTPTR_T *)(((char *)code) + res_root->addr); urx_tmpaddr->addr = (INTPTR_T *)(((char *)code) + res_root->addr);
urx_rp->addr = urx_tmpaddr; urx_rp->addr = urx_tmpaddr;
@ -415,10 +402,10 @@ void res_free(res_list *root)
} }
} }
/* ZL_ERROR - perform cleanup and signal errors found in zlinking a mumps object module /* ZL_ERROR - perform cleanup and signal errors found in zlinking a mumps object module
* err - an error code that accepts no arguments and * 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) void zl_error(int4 file, int4 err, int4 err2, int4 len, char *addr)
{ {
int rc; int rc;
@ -429,7 +416,7 @@ void zl_error(int4 file, int4 err, int4 err2, int4 len, char *addr)
code = NULL; code = NULL;
} }
CLOSEFILE_RESET(file, rc); /* resets "file" to FD_INVALID */ 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); rts_error(VARLSTCNT(6) err, 0, err2, 2, len, addr);
else if (0 != err) else if (0 != err)
rts_error(VARLSTCNT(1) 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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -85,10 +85,6 @@ byte_off:
long: movl %eax,msf_mpc_off(%edx) long: movl %eax,msf_mpc_off(%edx)
addl $5,msf_mpc_off(%edx) addl $5,msf_mpc_off(%edx)
cont: call exfun_frame 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 leal ret_val(%ebp),%esi
movl %esp,%edi movl %esp,%edi
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
@ -102,10 +98,8 @@ cont: call exfun_frame
addl $4,%eax addl $4,%eax
pushl %eax # push total count pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]); call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
done: movl sav_msf(%ebp),%eax done: movl frame_pointer,%edx
movl %eax,frame_pointer movl msf_temps_ptr_off(%edx),%edi
orw $SFT_EXTFUN,msf_typ_off(%eax)
movl msf_temps_ptr_off(%eax),%edi
retlab: leal sav_ebx(%ebp),%esp retlab: leal sav_ebx(%ebp),%esp
movl rtn_pc(%ebp),%edx movl rtn_pc(%ebp),%edx
movl act_cnt(%ebp),%eax 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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -33,12 +33,17 @@
# PUBLIC op_extcall # PUBLIC op_extcall
ENTRY op_extcall ENTRY op_extcall
putframe putframe
addl $4,%esp addl $4,%esp # burn return pc
popl %edx popl %edx # routine hdr addr
popl %eax popl %eax # label addr
cmpl $0,%eax cmpl $0,%eax
je l2 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 mrt_curr_ptr(%edx),%eax
addl %edx,%eax addl %edx,%eax
pushl %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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -46,11 +46,6 @@
.extern push_parm .extern push_parm
.extern rts_error .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 actual1 = 24
act_cnt = 20 act_cnt = 20
mask_arg = 16 mask_arg = 16
@ -78,26 +73,27 @@ ENTRY op_extexfun
movl label_arg(%ebp),%eax movl label_arg(%ebp),%eax
cmpl $0,%eax cmpl $0,%eax
je l3 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 mrt_curr_ptr(%edx),%ebx
addl %edx,%ebx addl %edx,%ebx
cmpb $Grp5_Prefix,0(%ebx) popl %eax # restore labaddr
jne l6
movb 1(%ebx),%cl cmpl $0,4(%eax) # labaddr += 4, to point to has_parms; then *has_parms
andb $reg_opcode_mask,%cl je l6 # if has_parms == 0, then issue an error
cmpb $CALL_Ev,%cl
jne l6
cmpl $ISFORMAL,2(%ebx)
jne l6
pushl %ebx pushl %ebx
pushl $0 pushl $0
pushl %edx pushl %edx
call new_stack_frame call new_stack_frame
addl $12,%esp 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 leal ret_val(%ebp),%esi
movl %esp,%edi movl %esp,%edi
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
@ -111,9 +107,7 @@ l1: movl (%eax),%ebx
addl $4,%eax # include: $T(just pushed) plus other 3 addl $4,%eax # include: $T(just pushed) plus other 3
pushl %eax # push total count pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]); 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 retlab: leal sav_ebx(%ebp),%esp
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
addl $5,%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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -33,7 +33,7 @@
# PUBLIC op_extjmp # PUBLIC op_extjmp
ENTRY op_extjmp ENTRY op_extjmp
putframe putframe
addl $4,%esp addl $4,%esp # Burn return pc
popl %edx popl %edx
cmpl $0,%edx cmpl $0,%edx
je l2 je l2
@ -41,7 +41,12 @@ ENTRY op_extjmp
cmpl $0,%eax cmpl $0,%eax
je l4 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 mrt_curr_ptr(%edx),%eax
addl %edx,%eax addl %edx,%eax
pushl %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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -85,10 +85,6 @@ byte_off:
long: movl %eax,msf_mpc_off(%edx) long: movl %eax,msf_mpc_off(%edx)
addl $5,msf_mpc_off(%edx) addl $5,msf_mpc_off(%edx)
cont: call exfun_frame_sp 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 leal ret_val(%ebp),%esi
movl %esp,%edi movl %esp,%edi
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
@ -102,10 +98,8 @@ cont: call exfun_frame_sp
addl $4,%eax addl $4,%eax
pushl %eax # push total count pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]); call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]);
done: movl sav_msf(%ebp),%eax done: movl frame_pointer,%edx
movl %eax,frame_pointer movl msf_temps_ptr_off(%edx),%edi
orw $SFT_EXTFUN,msf_typ_off(%eax)
movl msf_temps_ptr_off(%eax),%edi
retlab: leal sav_ebx(%ebp),%esp retlab: leal sav_ebx(%ebp),%esp
movl rtn_pc(%ebp),%edx movl rtn_pc(%ebp),%edx
movl act_cnt(%ebp),%eax 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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -33,12 +33,17 @@
# PUBLIC op_mprofextcall # PUBLIC op_mprofextcall
ENTRY op_mprofextcall ENTRY op_mprofextcall
putframe putframe
addl $4,%esp addl $4,%esp # burn return pc
popl %edx popl %edx # routine hdr addr
popl %eax popl %eax # label addr
cmpl $0,%eax cmpl $0,%eax
je l2 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 mrt_curr_ptr(%edx),%eax
addl %edx,%eax addl %edx,%eax
pushl %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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -46,11 +46,6 @@
.extern push_parm .extern push_parm
.extern rts_error .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 actual1 = 24
act_cnt = 20 act_cnt = 20
mask_arg = 16 mask_arg = 16
@ -78,26 +73,27 @@ ENTRY op_mprofextexfun
movl label_arg(%ebp),%eax movl label_arg(%ebp),%eax
cmpl $0,%eax cmpl $0,%eax
je l3 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 mrt_curr_ptr(%edx),%ebx
addl %edx,%ebx addl %edx,%ebx
cmpb $Grp5_Prefix,0(%ebx) popl %eax # restore labaddr
jne l6
movb 1(%ebx),%cl cmpl $0,4(%eax) # labaddr += 4, to point to has_parms; then *has_parms
andb $reg_opcode_mask,%cl je l6 # if has_parms == 0, then issue an error
cmpb $CALL_Ev,%cl
jne l6
cmpl $ISFORMAL,2(%ebx)
jne l6
pushl %ebx pushl %ebx
pushl $0 pushl $0
pushl %edx pushl %edx
call new_stack_frame_sp call new_stack_frame_sp
addl $12,%esp 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 leal ret_val(%ebp),%esi
movl %esp,%edi movl %esp,%edi
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
@ -111,9 +107,7 @@ l1: movl (%eax),%ebx
addl $4,%eax # include: $T(just pushed) plus other 3 addl $4,%eax # include: $T(just pushed) plus other 3
pushl %eax # push total count pushl %eax # push total count
call push_parm # push_parm ($T, ret_value, mask, argc [,arg1, arg2, ...]); 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 retlab: leal sav_ebx(%ebp),%esp
movl act_cnt(%ebp),%eax movl act_cnt(%ebp),%eax
addl $5,%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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -24,7 +24,7 @@
.extern frame_pointer .extern frame_pointer
.text .text
.extern exfun_frame_push_dummy_frame .extern exfun_frame_sp
.sbttl op_mprofforlcldob .sbttl op_mprofforlcldob
# PUBLIC op_mprofforlcldob # PUBLIC op_mprofforlcldob
@ -33,7 +33,7 @@ ENTRY op_mprofforlcldob
movl (%esp),%eax movl (%esp),%eax
movl %eax,msf_mpc_off(%edx) movl %eax,msf_mpc_off(%edx)
addl $2,msf_mpc_off(%edx) # store pc in MUMPS stack frame 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 frame_pointer,%edx
movl msf_temps_ptr_off(%edx),%edi movl msf_temps_ptr_off(%edx),%edi
ret 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -10,18 +10,19 @@
****************************************************************/ ****************************************************************/
/* caller_id routine called from CRIT_TRACE macro to /* caller_id routine called from CRIT_TRACE macro to
return the return address of our caller allowing CRIT_TRACE * return the return address of our caller allowing CRIT_TRACE
(used in various semaphore routines) to determine who was * (used in various semaphore routines) to determine who was
calling those semaphore routines and for what purpose and * calling those semaphore routines and for what purpose and
when. This is a system dependent type of operation and is * when. This is a system dependent type of operation and is
generally implemented in assembly language. * generally implemented in assembly language.
Presently 32bit linux system has its own implementation in * Presently 32bit linux system has its own implementation in
assembly. Similar implementation will not work on x86_64 * assembly. Similar implementation will not work on x86_64
since register rbp is also used as M Frame pointer in its * since register rbp is also used as M Frame pointer in its
assembly files. * assembly files.
This particular implementation will work only on Linux x86_64 system * This particular implementation will work only on Linux x86_64 system
due to its dependency on "backtrace" function call which is not * due to its dependency on "backtrace" function call which is not
available on all Unix flovours.*/ * available on all Unix flovours.
*/
#include "mdef.h" #include "mdef.h"
@ -29,6 +30,7 @@
#include <signal.h> #include <signal.h>
#include "gtm_stdlib.h" #include "gtm_stdlib.h"
#include "gt_timer.h"
#include "caller_id.h" #include "caller_id.h"
#define MAX_TRACE_DEPTH 3 #define MAX_TRACE_DEPTH 3
@ -37,6 +39,8 @@
GBLREF boolean_t blocksig_initialized; GBLREF boolean_t blocksig_initialized;
GBLREF sigset_t block_sigsent; 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 */ 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; sigset_t savemask;
/* We cannot let this routine nest itself due to the impolite things that /* 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) if (caller_id_reent)
return (caddr_t)-1; 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 /* 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, * 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. * 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; caller_id_reent = FALSE;
if (blocksig_initialized) if (blocksig_initialized)
sigprocmask(SIG_SETMASK, &savemask, NULL); 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) if (trace_size >= RETURN_ADDRESS_DEPTH)
return (caddr_t)trace[RETURN_ADDRESS_DEPTH]; return (caddr_t)trace[RETURN_ADDRESS_DEPTH];
else 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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # of its copyright holder(s), and is made available #
@ -205,10 +205,14 @@ if ( $?gtm_version_change == "1" ) then
setenv gt_ld_options_all_exe "$gt_ld_options_all_exe -Wl,--version-script,gtmexe_symbols.export" setenv gt_ld_options_all_exe "$gt_ld_options_all_exe -Wl,--version-script,gtmexe_symbols.export"
# optimize for all 64bit platforms # optimize for all 64bit platforms
setenv gt_ld_syslibs " -lrt -lelf -lncurses -lm -ldl" #
# -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 if ( 32 == $gt_build_type ) then
# 32bit x86_64 and ia32 - decided at the beginning of the file # 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 endif
if ( "cygwin" == $platform_only ) then if ( "cygwin" == $platform_only ) then
setenv gt_ld_syslibs "-lncurses -lm -lcrypt" 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 # # This source code contains the intellectual property #
# of its copyright holder(s), and is made available # # 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_linker=cc
gt_ld_shl_options=-shared gt_ld_shl_options=-shared
gt_ld_shl_suffix=.so gt_ld_shl_suffix=.so
gt_ld_syslibs= -lrt -lelf -lncurses -lm -ldl
gt_ld_sysrtns= gt_ld_sysrtns=
ifeq ($(gt_build_type),32) ifeq ($(gt_build_type),32)
gt_ld_m_shl_options= gt_ld_m_shl_options=
gt_ld_syslibs= -lrt -lncurses -lm -ldl
endif endif
# -lrt for async I/O in mupip recover/rollback # -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) ifeq ($(gt_build_type), 64)
gt_ld_syslibs=-lrt -lelf -lncurses -lm -ldl gt_ld_syslibs=-lrt -lelf -lncurses -lm -ldl -lc -lpthread
else else
ifeq ($(gt_os_type),Linux) ifeq ($(gt_os_type),Linux)
gt_ld_syslibs=-lrt -lncurses -lm -ldl gt_ld_syslibs=-lrt -lncurses -lm -ldl -lc -lpthread
else else
gt_ld_syslibs=-lncurses -lm -lcrypt gt_ld_syslibs=-lncurses -lm -lcrypt
endif endif
@ -183,7 +183,8 @@ endef
# #
define gt-dep define gt-dep
@echo $*.o $*.d : '\' > $@; \ @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 endef
define gt-export define gt-export
@echo "{" >$@ @echo "{" >$@

View File

@ -10,15 +10,15 @@
****************************************************************/ ****************************************************************/
#ifdef __CYGWIN__ #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) #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__) #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__) #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 #else
#define GTM_RELEASE_NAME "GT.M V5.4-002B Linux x86" #define GTM_RELEASE_NAME "GT.M V5.5-000 Linux x86"
#endif #endif
#define GTM_PRODUCT "GT.M" #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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,45 +15,45 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.h" #include "advancewindow.h"
GBLREF char window_token; error_def (ERR_MAXACTARG);
GBLREF mident window_ident; 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; int mask, parmcount;
error_def (ERR_MAXACTARG); oprtype ot;
error_def (ERR_NAMEEXPECTED); triple *counttrip, *masktrip, *ref0, *ref1, *ref2;
error_def (ERR_COMMAORRPAREXP); DCL_THREADGBL_ACCESS;
assert (window_token == TK_LPAREN); SETUP_THREADGBL_ACCESS;
advancewindow (); assert(TK_LPAREN == TREF(window_token));
masktrip = newtriple (OC_PARAMETER); advancewindow();
masktrip = newtriple(OC_PARAMETER);
mask = 0; mask = 0;
counttrip = newtriple (OC_PARAMETER); counttrip = newtriple(OC_PARAMETER);
masktrip->operand[1] = put_tref (counttrip); masktrip->operand[1] = put_tref(counttrip);
ref0 = counttrip; ref0 = counttrip;
if (window_token == TK_RPAREN) if (TK_RPAREN == TREF(window_token))
parmcount = 0; parmcount = 0;
else else
{
for (parmcount = 1; ; parmcount++) for (parmcount = 1; ; parmcount++)
{ {
if (parmcount > MAX_ACTUALS) if (MAX_ACTUALS < parmcount)
{ {
stx_error (ERR_MAXACTARG); stx_error (ERR_MAXACTARG);
return FALSE; return FALSE;
} }
if (window_token == TK_PERIOD) if (TK_PERIOD == TREF(window_token))
{ {
advancewindow (); advancewindow ();
if (window_token == TK_IDENT) if (TK_IDENT == TREF(window_token))
{ {
ot = put_mvar (&window_ident); ot = put_mvar(&(TREF(window_ident)));
mask |= (1 << parmcount - 1); mask |= (1 << parmcount - 1);
advancewindow (); advancewindow();
} } else if (TK_ATSIGN == TREF(window_token))
else if (window_token == TK_ATSIGN)
{ {
if (!indirection(&ot)) if (!indirection(&ot))
return FALSE; return FALSE;
@ -61,38 +61,33 @@ int actuallist (oprtype *opr)
ref2->operand[0] = ot; ref2->operand[0] = ot;
ot = put_tref(ref2); ot = put_tref(ref2);
mask |= (1 << parmcount - 1); mask |= (1 << parmcount - 1);
} } else
else
{ {
stx_error (ERR_NAMEEXPECTED); stx_error(ERR_NAMEEXPECTED);
return FALSE; return FALSE;
} }
} } else if (TK_COMMA == TREF(window_token))
else if (window_token == TK_COMMA)
{ {
ref2 = newtriple(OC_NULLEXP); ref2 = newtriple(OC_NULLEXP);
ot = put_tref(ref2); ot = put_tref(ref2);
} } else if (EXPR_FAIL == expr(&ot, MUMPS_EXPR))
else return FALSE;
if (!expr (&ot)) return FALSE; ref1 = newtriple(OC_PARAMETER);
ref1 = newtriple (OC_PARAMETER); ref0->operand[1] = put_tref(ref1);
ref0->operand[1] = put_tref (ref1);
ref1->operand[0] = ot; ref1->operand[0] = ot;
if (window_token == TK_COMMA) if (TK_COMMA == TREF(window_token))
{ advancewindow (); { advancewindow ();
if (window_token == TK_RPAREN) if (TK_RPAREN == TREF(window_token))
{ ref0 = ref1; { ref0 = ref1;
ref2 = newtriple(OC_NULLEXP); ref2 = newtriple(OC_NULLEXP);
ot = put_tref(ref2); ot = put_tref(ref2);
ref1 = newtriple (OC_PARAMETER); ref1 = newtriple(OC_PARAMETER);
ref0->operand[1] = put_tref (ref1); ref0->operand[1] = put_tref(ref1);
ref1->operand[0] = ot; ref1->operand[0] = ot;
parmcount++; parmcount++;
break; break;
} }
} } else if (TREF(window_token) == TK_RPAREN)
else
if (window_token == TK_RPAREN)
break; break;
else else
{ {
@ -101,10 +96,11 @@ int actuallist (oprtype *opr)
} }
ref0 = ref1; ref0 = ref1;
} }
advancewindow (); }
masktrip->operand[0] = put_ilit (mask); advancewindow();
counttrip->operand[0] = put_ilit (parmcount); masktrip->operand[0] = put_ilit(mask);
counttrip->operand[0] = put_ilit(parmcount);
parmcount += 2; parmcount += 2;
*opr = put_tref (masktrip); *opr = put_tref(masktrip);
return parmcount; return parmcount;
} }

View File

@ -27,20 +27,15 @@
GBLREF unsigned char *source_buffer; GBLREF unsigned char *source_buffer;
GBLREF short int source_column; 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 char *lexical_ptr;
GBLREF spdesc stringpool; GBLREF spdesc stringpool;
GBLREF boolean_t gtm_utf8_mode; GBLREF boolean_t gtm_utf8_mode;
GBLREF boolean_t run_time; 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]; LITREF char ctypetab[NUM_CHARS];
error_def(ERR_LITNONGRAPH); error_def(ERR_LITNONGRAPH);
error_def(ERR_NUMOFLOW);
static readonly unsigned char apos_ok[] = static readonly unsigned char apos_ok[] =
{ {
@ -56,7 +51,6 @@ static readonly unsigned char apos_ok[] =
void advancewindow(void) void advancewindow(void)
{ {
error_def(ERR_NUMOFLOW);
unsigned char *cp1, *cp2, *cp3, x; unsigned char *cp1, *cp2, *cp3, x;
char *tmp, source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)]; char *tmp, source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)];
int y, charlen; int y, charlen;
@ -69,38 +63,35 @@ void advancewindow(void)
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
TREF(last_source_column) = source_column; TREF(last_source_column) = source_column;
source_column = (unsigned char *)lexical_ptr - source_buffer + 1; source_column = (unsigned char *)lexical_ptr - source_buffer + 1;
window_token = director_token; TREF(window_token) = TREF(director_token);
window_mval = director_mval; TREF(window_mval) = TREF(director_mval);
director_mval.mvtype = 0; /* keeps mval from being GC'd since it is not useful until re-used */ (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 */
/* It is more efficient to swich buffers between window_ident and director_ident TREF(window_ident) = TREF(director_ident); /* than to copy text from director_ident to window_ident */
* instead of copying the text from director_ident to window_ident. This can be (TREF(director_ident)).addr = tmp;
* done by exchanging the pointers window_ident.addr and director_ident.addr */
tmp = window_ident.addr;
window_ident = director_ident;
director_ident.addr = tmp;
x = *lexical_ptr; x = *lexical_ptr;
switch (y = ctypetab[x]) switch (y = ctypetab[x])
{ {
case TK_EOL:
TREF(director_token) = TK_EOL;
return; /* if next character is terminator, avoid incrementing past it */
case TK_QUOTE: case TK_QUOTE:
ENSURE_STP_FREE_SPACE(MAX_SRCLINE); ENSURE_STP_FREE_SPACE(MAX_SRCLINE);
cp1 = (unsigned char *)lexical_ptr + 1; cp1 = (unsigned char *)lexical_ptr + 1;
cp2 = cp3 = stringpool.free; cp2 = cp3 = stringpool.free;
for (;;) for (;;)
{ {
# ifdef UNICODE_SUPPORTED
#ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode) if (gtm_utf8_mode)
cptr = (unsigned char *)UTF8_MBTOWC((sm_uc_ptr_t)cp1, source_buffer + MAX_SRCLINE, ch); cptr = (unsigned char *)UTF8_MBTOWC((sm_uc_ptr_t)cp1, source_buffer + MAX_SRCLINE, ch);
#endif # endif
x = *cp1++; x = *cp1++;
if ((SP > x) UNICODE_ONLY(|| (gtm_utf8_mode && !(U_ISPRINT(ch))))) if ((SP > x) UNICODE_ONLY(|| (gtm_utf8_mode && !(U_ISPRINT(ch)))))
{ {
TREF(last_source_column) = cp1 - source_buffer; TREF(last_source_column) = cp1 - source_buffer;
if ('\0' == x) if ('\0' == x)
{ {
director_token = window_token = TK_ERROR; TREF(director_token) = TREF(window_token) = TK_ERROR;
return; return;
} }
if (!run_time) if (!run_time)
@ -118,43 +109,43 @@ void advancewindow(void)
break; break;
} }
*cp2++ = x; *cp2++ = x;
#ifdef UNICODE_SUPPORTED # ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && (cptr > cp1)) if (gtm_utf8_mode && (cptr > cp1))
{ {
assert(4 > (cptr - cp1)); assert(4 > (cptr - cp1));
for (; cptr > cp1;) for (; cptr > cp1;)
*cp2++ = *cp1++; *cp2++ = *cp1++;
} }
#endif # endif
assert(cp2 <= stringpool.top); assert(cp2 <= stringpool.top);
} }
lexical_ptr = (char *)cp1; lexical_ptr = (char *)cp1;
director_token = TK_STRLIT; TREF(director_token) = TK_STRLIT;
director_mval.mvtype = MV_STR; (TREF(director_mval)).mvtype = MV_STR;
director_mval.str.addr = (char *)cp3; (TREF(director_mval)).str.addr = (char *)cp3;
director_mval.str.len = INTCAST(cp2 - cp3); (TREF(director_mval)).str.len = INTCAST(cp2 - cp3);
stringpool.free = cp2; stringpool.free = cp2;
s2n(&director_mval); s2n(&(TREF(director_mval)));
#ifdef UNICODE_SUPPORTED # ifdef UNICODE_SUPPORTED
if (gtm_utf8_mode && !run_time) if (gtm_utf8_mode && !run_time)
{ /* UTF8 mode and not compiling an indirect gets an optimization to set the { /* UTF8 mode and not compiling an indirect gets an optimization to set the
(true) length of the string into the mval * (true) length of the string into the mval
*/ */
charlen = utf8_len_stx(&director_mval.str); charlen = utf8_len_stx(&(TREF(director_mval)).str);
if (0 > charlen) /* got a BADCHAR error */ if (0 > charlen) /* got a BADCHAR error */
director_token = TK_ERROR; TREF(director_token) = TK_ERROR;
else else
{ {
assert(charlen == director_mval.str.char_len); assert(charlen == (TREF(director_mval)).str.char_len);
director_mval.mvtype |= MV_UTF_LEN; (TREF(director_mval)).mvtype |= MV_UTF_LEN;
} }
} }
#endif # endif
return; return;
case TK_LOWER: case TK_LOWER:
case TK_PERCENT: case TK_PERCENT:
case TK_UPPER: case TK_UPPER:
cp2 = (unsigned char *)director_ident.addr; cp2 = (unsigned char *)((TREF(director_ident)).addr);
cp3 = cp2 + MAX_MIDENT_LEN; cp3 = cp2 + MAX_MIDENT_LEN;
for (;;) for (;;)
{ {
@ -164,33 +155,33 @@ void advancewindow(void)
if ((TK_UPPER != y) && (TK_DIGIT != y) && (TK_LOWER != y)) if ((TK_UPPER != y) && (TK_DIGIT != y) && (TK_LOWER != y))
break; break;
} }
director_ident.len = INTCAST(cp2 - (unsigned char*)director_ident.addr); (TREF(director_ident)).len = INTCAST(cp2 - (unsigned char*)(TREF(director_ident)).addr);
director_token = TK_IDENT; TREF(director_token) = TK_IDENT;
return; return;
case TK_PERIOD: case TK_PERIOD:
if (ctypetab[x = *(lexical_ptr + 1)] != TK_DIGIT) if (ctypetab[x = *(lexical_ptr + 1)] != TK_DIGIT)
break; break;
case TK_DIGIT: case TK_DIGIT:
director_mval.str.addr = lexical_ptr; (TREF(director_mval)).str.addr = lexical_ptr;
director_mval.str.len = MAX_SRCLINE; (TREF(director_mval)).str.len = MAX_SRCLINE;
director_mval.mvtype = MV_STR; (TREF(director_mval)).mvtype = MV_STR;
lexical_ptr = (char *)s2n(&director_mval); lexical_ptr = (char *)s2n(&(TREF(director_mval)));
if (!(director_mval.mvtype &= MV_NUM_MASK)) if (!((TREF(director_mval)).mvtype &= MV_NUM_MASK))
{ {
stx_error(ERR_NUMOFLOW); stx_error(ERR_NUMOFLOW);
director_token = TK_ERROR; TREF(director_token) = TK_ERROR;
return; return;
} }
if (TREF(s2n_intlit)) if (TREF(s2n_intlit))
{ {
director_token = TK_NUMLIT ; TREF(director_token) = TK_NUMLIT ;
n2s(&director_mval); n2s(&(TREF(director_mval)));
} else } else
{ {
director_token = TK_INTLIT ; TREF(director_token) = TK_INTLIT ;
director_mval.str.len = INTCAST(lexical_ptr - director_mval.str.addr); (TREF(director_mval)).str.len = INTCAST(lexical_ptr - (TREF(director_mval)).str.addr);
ENSURE_STP_FREE_SPACE(director_mval.str.len); ENSURE_STP_FREE_SPACE((TREF(director_mval)).str.len);
memcpy(stringpool.free, director_mval.str.addr, director_mval.str.len); memcpy(stringpool.free, (TREF(director_mval)).str.addr, (TREF(director_mval)).str.len);
assert (stringpool.free <= stringpool.top) ; assert (stringpool.free <= stringpool.top) ;
} }
return; return;
@ -204,7 +195,7 @@ void advancewindow(void)
{ {
if (DEL < (x = *++lexical_ptr)) if (DEL < (x = *++lexical_ptr))
{ {
director_token = TK_ERROR; TREF(director_token) = TK_ERROR;
return; return;
} }
if (TK_RBRACKET == ctypetab[x]) if (TK_RBRACKET == ctypetab[x])
@ -212,21 +203,23 @@ void advancewindow(void)
lexical_ptr++; lexical_ptr++;
y = TK_NSORTS_AFTER; y = TK_NSORTS_AFTER;
} }
director_token = y; TREF(director_token) = y;
return; return;
} }
} }
} }
director_token = TK_APOSTROPHE; TREF(director_token) = TK_APOSTROPHE;
return; return;
case TK_SEMICOLON: case TK_SEMICOLON:
while (*++lexical_ptr) ; while (*++lexical_ptr)
y = TK_EOL; ;
break; assert(TK_EOL == ctypetab[*lexical_ptr]);
TREF(director_token) = TK_EOL;
return; /* if next character is terminator, avoid incrementing past it */
case TK_ASTERISK: case TK_ASTERISK:
if (DEL < (x = *(lexical_ptr + 1))) if (DEL < (x = *(lexical_ptr + 1)))
{ {
director_token = TK_ERROR; TREF(director_token) = TK_ERROR;
return; return;
} }
if (TK_ASTERISK == ctypetab[x]) if (TK_ASTERISK == ctypetab[x])
@ -238,7 +231,7 @@ void advancewindow(void)
case TK_RBRACKET: case TK_RBRACKET:
if ((x = *(lexical_ptr + 1)) > DEL) if ((x = *(lexical_ptr + 1)) > DEL)
{ {
director_token = TK_ERROR; TREF(director_token) = TK_ERROR;
return; return;
} }
if (TK_RBRACKET == ctypetab[x]) if (TK_RBRACKET == ctypetab[x])
@ -251,7 +244,7 @@ void advancewindow(void)
; ;
} }
lexical_ptr++; lexical_ptr++;
director_token = y; TREF(director_token) = y;
return; return;
} }
@ -272,13 +265,15 @@ void advwindw_hash_in_mname_allowed(void)
unsigned char *cp2, *cp3, x; unsigned char *cp2, *cp3, x;
unsigned char ident_buffer[SIZEOF(mident_fixed)]; unsigned char ident_buffer[SIZEOF(mident_fixed)];
int ident_len, ch; int ident_len, ch;
DCL_THREADGBL_ACCESS;
assert(TK_IDENT == window_token); SETUP_THREADGBL_ACCESS;
assert(TK_HASH == director_token); 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 */ /* 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 */ /* 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; cp3 = ident_buffer + MAX_MIDENT_LEN;
*cp2++ = '#'; /* We are only called if director token is '#' so put that char in buffer now */ *cp2++ = '#'; /* We are only called if director token is '#' so put that char in buffer now */
/* Start processing with the token following the '#' */ /* Start processing with the token following the '#' */
@ -289,9 +284,9 @@ void advwindw_hash_in_mname_allowed(void)
if (cp2 < cp3) if (cp2 < cp3)
*cp2++ = x; *cp2++ = x;
} }
director_ident.len = INTCAST(cp2 - ident_buffer); (TREF(director_ident)).len = INTCAST(cp2 - ident_buffer);
director_token = TK_IDENT; TREF(director_token) = TK_IDENT;
memcpy(director_ident.addr, ident_buffer, director_ident.len); memcpy((TREF(director_ident)).addr, ident_buffer, (TREF(director_ident)).len);
advancewindow(); /* Makes the homogenized token the current token (again) and prereads next token */ advancewindow(); /* Makes the homogenized token the current token (again) and prereads next token */
} }
#endif #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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -41,6 +41,36 @@
#include "gtm_malloc.h" #include "gtm_malloc.h"
#include "stringpool.h" #include "stringpool.h"
#include "mmemory.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 */ /* 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 /* 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. * 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. * 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() */ 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 */ break; /* Pointer not within the stack -- must be earliest occurence */
} }
} while(fp); } while(fp);
@ -307,11 +306,11 @@ void als_lsymtab_repair(hash_table_mname *table, ht_ent_mname *table_base_orig,
} }
if (NULL == *htep) if (NULL == *htep)
continue; 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 */ /* Entry doesn't point to the current symbol table so ignore it since it didn't change */
continue; continue;
htenew = (ht_ent_mname *)((*htep)->value); /* Pick up entry we should now use */ 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; *htep = htenew;
} }
/* For debug at least make unusable in case any stragglers point to it -- even though we are somewhat duplicating /* 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. /* 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 * 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 * mval that lives in the compiler temps of the caller with a pointer in the stack frame of the callee. Since this
* block allocated by push_parm. Since this mval-container is just an mval and not an lv_val, we have to largely * mval-container is just an mval and not an lv_val, we have to largely do similar processing to the
* do similar processing to the "als_prcs_xnew_alias_cntnr" with this block type difference in mind. * "als_prcs_xnew_alias_cntnr" with this block type difference in mind.
*/ */
if (NULL != alias_retarg) if (NULL != alias_retarg)
{ {
@ -642,7 +641,8 @@ STATICFNDEF void als_prcs_xnew_alias_cntnr(lvTree *lvt, symval *popdsymval, symv
newlv, oldlv)); newlv, oldlv));
} else } else
{ /* lv_val is owned by current or older symval .. just use it in the subsequent scan in case { /* 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 DBGRFCT((stderr, "\nals_prcs_xnew_alias_cntnr: aliascont var found - aliascont lv 0x"lvaddr
" just being (potentially) scanned for container vars\n", node)); " just being (potentially) scanned for container vars\n", node));
newlv = oldlv; newlv = oldlv;
@ -939,9 +939,8 @@ void als_zwrhtab_init(void)
if (zavb) if (zavb)
{ {
for (zavb_next = zavb->next; zavb_next; zavb = zavb_next, zavb_next = zavb->next) 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); free(zavb);
}
assert(zavb); assert(zavb);
zwrhtab->first_zwrzavb = zavb; zwrhtab->first_zwrzavb = zavb;
} }
@ -961,7 +960,6 @@ zwr_alias_var *als_getzavslot(void)
assert(zwrhtab); assert(zwrhtab);
assert(zwrhtab->first_zwrzavb); assert(zwrhtab->first_zwrzavb);
zwrhtab->cleaned = FALSE; /* No longer in a clean/initialized state */ zwrhtab->cleaned = FALSE; /* No longer in a clean/initialized state */
/* Check if a block can be allocated out of a zavb super block */ /* Check if a block can be allocated out of a zavb super block */
zavb = zwrhtab->first_zwrzavb; zavb = zwrhtab->first_zwrzavb;
@ -996,7 +994,7 @@ ht_ent_mname *als_lookup_base_lvval(lv_val *lvp)
assert(htep_top == curr_symval->h_symtab.top); assert(htep_top == curr_symval->h_symtab.top);
for (; htep < htep_top; htep++) 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 { /* 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. * 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. * 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 * 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 * 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 * 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. * 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. * 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". * 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. * 5) If the lv_val has descendants, run the decendant chain to look for container vars.
@ -1064,10 +1062,8 @@ int als_lvval_gc(void)
if (NULL == stp_array) if (NULL == stp_array)
/* Same initialization as is in stp_gcol_src.h */ /* Same initialization as is in stp_gcol_src.h */
stp_array = (mstr **)malloc((stp_array_size = STP_MAXITEMS) * SIZEOF(mstr *)); stp_array = (mstr **)malloc((stp_array_size = STP_MAXITEMS) * SIZEOF(mstr *));
lvarraycur = lvarray = (lv_val **)stp_array; lvarraycur = lvarray = (lv_val **)stp_array;
lvarraytop = lvarraycur + stp_array_size; lvarraytop = lvarraycur + stp_array_size;
/* Steps 1,2 - find all the base lv_vals and put in list */ /* 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 (lv_blk_ptr = curr_symval->lv_first_block; lv_blk_ptr; lv_blk_ptr = lv_blk_ptr->next)
{ {
@ -1099,13 +1095,12 @@ int als_lvval_gc(void)
htep_top = curr_symval->h_symtab.base + curr_symval->h_symtab.size; 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++) for (; htep < htep_top; htep++)
{
if (HTENT_VALID_MNAME(htep, lv_val, lvp)) 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 { /* 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); MARK_REACHABLE(lvp);
} }
}
/* Step 7 - Run the mv_stent chain marking those vars as reachable. */ /* Step 7 - Run the mv_stent chain marking those vars as reachable. */
DBGRFCT((stderr, "als_lvval_gc: Starting mv_stent scan\n")); 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)) 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,7 +1160,7 @@ int als_lvval_gc(void)
} }
/* Step 8 - Run the TP stack to see if there is anything we can mark reachable */ /* 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")); 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 { /* Since TP keeps its own use count on these sorts of variables, we will mark both the
@ -1237,10 +1232,9 @@ int als_lvval_gc(void)
{ {
lvp = *lvptr; lvp = *lvptr;
if (lvp->stats.lvtaskcycle != lvtaskcycle && LV_SYMVAL(lvp)) if (lvp->stats.lvtaskcycle != lvtaskcycle && LV_SYMVAL(lvp))
{ /* Var is still intact, kill it */ /* Var is still intact, kill it */
assert(FALSE); assert(FALSE);
} }
}
# endif # endif
assert(lvtaskcycle == savelvtaskcycle); assert(lvtaskcycle == savelvtaskcycle);
DBGRFCT((stderr, "als_lvval_gc: GC complete -- recovered %d lv_vals\n", killcnt)); DBGRFCT((stderr, "als_lvval_gc: GC complete -- recovered %d lv_vals\n", killcnt));
@ -1263,18 +1257,12 @@ void als_lvmon_output(void)
flush_pio(); flush_pio();
for (lvlsymtab = curr_symval; lvlsymtab; lvlsymtab = lvlsymtab->last_tab) for (lvlsymtab = curr_symval; lvlsymtab; lvlsymtab = lvlsymtab->last_tab)
{
for (lvbp = curr_symval->lv_first_block; lvbp; lvbp = lvbp->next) 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++) 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) if (lvp->lvmon_mark)
{ /* lv_val slot not used as an sbs and is marked. Report it */ { /* 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); FPRINTF(stderr, "als_lvmon_output: lv_val at 0x"lvaddr" is still marked\n", lvp);
} }
} FFLUSH(stderr);
}
}
fflush(stderr);
} }
# endif # 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -72,19 +72,20 @@ void alloc_reg(void)
case OC_PARAMETER: case OC_PARAMETER:
continue; continue;
case OC_LINESTART: case OC_LINESTART:
/* If the next triple is also a LINESTART, then this is a comment line. Therefore /* If the next triple is also a LINESTART, then this is a comment line.
eliminate this LINESTART */ * Therefore eliminate this LINESTART
*/
opx = x->exorder.fl->opcode; 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; opc = x->opcode = OC_NOOP;
COMPDBG(PRINTF(" ** Converting triple to NOOP (rsn 1) **\n");); COMPDBG(PRINTF(" ** Converting triple to NOOP (rsn 1) **\n"););
continue; /* continue, because 'normal' NOOP continues from this switch */ 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 /* 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 * 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 * 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. * 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) if (!(cmd_qlf.qlf & CQ_LINE_ENTRY) && (OC_ILIT == opx) && (NULL != x->exorder.fl->exorder.fl)
&& (OC_LINEFETCH == x->exorder.fl->exorder.fl->opcode)) && (OC_LINEFETCH == x->exorder.fl->exorder.fl->opcode))
@ -96,8 +97,7 @@ void alloc_reg(void)
break; break;
case OC_LINEFETCH: case OC_LINEFETCH:
case OC_FETCH: case OC_FETCH:
assert((TRIP_REF == x->operand[0].oprclass) assert((TRIP_REF == x->operand[0].oprclass) && (OC_ILIT == x->operand[0].oprval.tref->opcode));
&& (OC_ILIT == x->operand[0].oprval.tref->opcode));
if (x->operand[0].oprval.tref->operand[0].oprval.ilit == mvmax) if (x->operand[0].oprval.tref->operand[0].oprval.ilit == mvmax)
{ {
x->operand[0].oprval.tref->operand[0].oprval.ilit = 0; x->operand[0].oprval.tref->operand[0].oprval.ilit = 0;
@ -179,10 +179,10 @@ void alloc_reg(void)
} else } else
{ {
oct &= OCT_VALUE | OCT_MVADDR; 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)); || (OCT_CDADDR == oct));
r = (OCT_MVAL == oct) ? TVAL_REF : (((OCT_MVADDR | OCT_MVAL) == oct) ? TVAD_REF r = (OCT_MVAL == oct) ? TVAL_REF : (((OCT_MVADDR | OCT_MVAL) == oct)
: ((OCT_MINT == oct) ? TINT_REF : TCAD_REF)); ? TVAD_REF : ((OCT_MINT == oct) ? TINT_REF : TCAD_REF));
for (c = 0; tempcont[r][c] && (MAX_TEMP_COUNT > c); c++) for (c = 0; tempcont[r][c] && (MAX_TEMP_COUNT > c); c++)
; ;
if (MAX_TEMP_COUNT <= c) if (MAX_TEMP_COUNT <= c)
@ -202,7 +202,7 @@ void alloc_reg(void)
x->destination = x->destination.oprval.tref->destination; 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[r] = temphigh[r] + 1;
sa_temps_offset[TVAR_REF] = sa_temps[TVAR_REF] * sa_class_sizes[TVAR_REF]; sa_temps_offset[TVAR_REF] = sa_temps[TVAR_REF] * sa_class_sizes[TVAR_REF];
size = sa_temps[TVAL_REF] * sa_class_sizes[TVAL_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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -19,15 +19,15 @@
GBLREF unsigned char *stacktop, *stackwarn, *msp; GBLREF unsigned char *stacktop, *stackwarn, *msp;
GBLREF stack_frame *frame_pointer; GBLREF stack_frame *frame_pointer;
error_def(ERR_STACKCRIT);
error_def(ERR_STACKOFLOW);
void base_frame(rhdtyp *base_address) void base_frame(rhdtyp *base_address)
{ {
void gtm_ret_code(); /* This is an external which points to code without an entry mask */ void gtm_ret_code(); /* This is an external which points to code without an entry mask */
unsigned char *msp_save; unsigned char *msp_save;
stack_frame *fp; stack_frame *fp;
error_def(ERR_STACKOFLOW);
error_def(ERR_STACKCRIT);
if ((INTPTR_T)msp & 1) /* synchronize mumps stack on even boundary */ if ((INTPTR_T)msp & 1) /* synchronize mumps stack on even boundary */
msp--; msp--;
if ((INTPTR_T)msp & 2) if ((INTPTR_T)msp & 2)
@ -59,4 +59,6 @@ void base_frame(rhdtyp *base_address)
fp->vartab_len = 0; fp->vartab_len = 0;
fp->vartab_ptr = (char *)fp; fp->vartab_ptr = (char *)fp;
fp->type = SFT_COUNT; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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; uint4 status;
srch_blk_status blkhist; 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; 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 */ if (orig_hint >= total_blks) /* for TP, hint can be > total_blks */
orig_hint = 1; orig_hint = 1;
hint = orig_hint; 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); return (FILE_EXTENDED);
hint = total_blks; hint = total_blks;
total_blks = cs_addrs->ti->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); hint_cycled = DIVIDE_ROUND_UP(total_blks, BLKS_PER_LMAP);
local_maps = hint_cycled + 2; /* for (up to) 2 wraps */ 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -13,7 +13,7 @@
#include "compiler.h" #include "compiler.h"
#include "opcode.h" #include "opcode.h"
int bool_expr(bool op,oprtype *addr) int bool_expr(boolean_t op, oprtype *addr)
{ {
oprtype x; oprtype x;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
@ -26,10 +26,10 @@ int bool_expr(bool op,oprtype *addr)
TREF(expr_depth) = 0; TREF(expr_depth) = 0;
return FALSE; return FALSE;
} }
assert(TRIP_REF == x.oprclass);
coerce(&x, OCT_BOOL); 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); bx_tail(x.oprval.tref, op, addr);
if (!(--(TREF(expr_depth))))
TREF(saw_side_effect) = TREF(shift_side_effects) = FALSE;
return TRUE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 */ 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 */ 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_init(csa);
bt_refresh(csa); bt_refresh(csa, TRUE);
return; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -18,15 +18,18 @@
#include "longset.h" #include "longset.h"
#include "relqop.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; sgmnt_data_ptr_t csd;
bt_rec_ptr_t ptr, top, bt1; bt_rec_ptr_t ptr, top, bt1;
error_def(ERR_BTFAIL);
csd = csa->hdr; csd = csa->hdr;
assert(dba_bg == csd->acc_meth); assert(dba_bg == csd->acc_meth);
if (init)
longset((uchar_ptr_t)csa->bt_header, (csd->bt_buckets + csd->n_bts + 1) * SIZEOF(bt_rec), 0); 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++) for (ptr = csa->bt_header, top = ptr + csd->bt_buckets + 1; ptr < top; ptr++)
@ -36,9 +39,13 @@ void bt_refresh(sgmnt_addrs *csa)
{ {
ptr->blk = BT_NOTVALID; ptr->blk = BT_NOTVALID;
ptr->cache_index = CR_NOTVALID; ptr->cache_index = CR_NOTVALID;
ptr->tn = ptr->killtn = 0;
if (init)
{
insqt((que_ent_ptr_t)ptr, (que_ent_ptr_t)bt1); 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); 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; ((th_rec *)((uchar_ptr_t)csa->th_base + csa->th_base->tnque.fl))->tn = csa->ti->curr_tn - 1;
csa->ti->mm_tn = 0; csa->ti->mm_tn = 0;
return; return;

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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -12,24 +12,187 @@
#include "mdef.h" #include "mdef.h"
#include "compiler.h" #include "compiler.h"
#include "opcode.h" #include "opcode.h"
#include "mdq.h"
#include "mmemory.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) if (jmp_to_next)
{ {
p = (oprtype *) mcalloc(SIZEOF(oprtype)); p = (oprtype *)mcalloc(SIZEOF(oprtype));
*p = put_tjmp(t); *p = put_tjmp(t);
} } else
else
{
p = addr; 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[0].oprval.tref, jmp_type_one, p);
bx_tail(t->operand[1].oprval.tref, sense, addr); 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;
}
}
t->opcode = OC_NOOP; t->opcode = OC_NOOP;
t->operand[0].oprclass = t->operand[1].oprclass = 0; t->operand[0].oprclass = t->operand[1].oprclass = NOCLASS;
return; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -18,39 +18,39 @@
LITREF octabstruct oc_tab[]; LITREF octabstruct oc_tab[];
/* structure of jmps is as follows: /* 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 void bx_tail(triple *t, boolean_t sense, oprtype *addr)
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)
/* /*
triple *t; triple to be processed * triple *t; triple to be processed
bool sense; code to be generated is jmpt or jmpf *boolean_t sense; code to be generated is jmpt or jmpf
oprtype *addr; address to jmp *oprtype *addr; address to jmp
*/ */
{ {
triple *ref; triple *ref;
oprtype *p; oprtype *p;
assert(sense == TRUE || sense == FALSE); assert((1 & sense) == sense);
assert(oc_tab[t->opcode].octype & OCT_BOOL); assert(oc_tab[t->opcode].octype & OCT_BOOL);
assert(t->operand[0].oprclass == TRIP_REF); assert(TRIP_REF == t->operand[0].oprclass);
assert(t->operand[1].oprclass == TRIP_REF || t->operand[1].oprclass == 0); assert((TRIP_REF == t->operand[1].oprclass) || (NOCLASS == t->operand[1].oprclass));
switch (t->opcode) switch (t->opcode)
{ {
case OC_COBOOL: case OC_COBOOL:
ex_tail(&t->operand[0]); 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); dqdel(t->operand[0].oprval.tref, exorder);
t->opcode = sense ? OC_JMPTSET : OC_JMPTCLR; t->opcode = sense ? OC_JMPTSET : OC_JMPTCLR;
@ -62,54 +62,54 @@ oprtype *addr; address to jmp
dqins(t, exorder, ref); dqins(t, exorder, ref);
return; return;
case OC_COM: 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->opcode = OC_NOOP;
t->operand[0].oprclass = 0; t->operand[0].oprclass = 0;
return; return;
case OC_NEQU: case OC_NEQU:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_EQU: case OC_EQU:
bx_relop(t, OC_EQU, sense ? OC_JMPNEQ : OC_JMPEQU, addr); bx_relop(t, OC_EQU, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break; break;
case OC_NPATTERN: case OC_NPATTERN:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_PATTERN: case OC_PATTERN:
bx_relop(t, OC_PATTERN, sense ? OC_JMPNEQ : OC_JMPEQU, addr); bx_relop(t, OC_PATTERN, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break; break;
case OC_NFOLLOW: case OC_NFOLLOW:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_FOLLOW: case OC_FOLLOW:
bx_relop(t, OC_FOLLOW, sense ? OC_JMPGTR : OC_JMPLEQ, addr); bx_relop(t, OC_FOLLOW, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break; break;
case OC_NSORTS_AFTER: case OC_NSORTS_AFTER:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_SORTS_AFTER: case OC_SORTS_AFTER:
bx_relop(t, OC_SORTS_AFTER, sense ? OC_JMPGTR : OC_JMPLEQ, addr); bx_relop(t, OC_SORTS_AFTER, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break; break;
case OC_NCONTAIN: case OC_NCONTAIN:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_CONTAIN: case OC_CONTAIN:
bx_relop(t, OC_CONTAIN, sense ? OC_JMPNEQ : OC_JMPEQU, addr); bx_relop(t, OC_CONTAIN, sense ? OC_JMPNEQ : OC_JMPEQU, addr);
break; break;
case OC_NGT: case OC_NGT:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_GT: case OC_GT:
bx_relop(t, OC_NUMCMP, sense ? OC_JMPGTR : OC_JMPLEQ, addr); bx_relop(t, OC_NUMCMP, sense ? OC_JMPGTR : OC_JMPLEQ, addr);
break; break;
case OC_NLT: case OC_NLT:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_LT: case OC_LT:
bx_relop(t, OC_NUMCMP, sense ? OC_JMPLSS : OC_JMPGEQ, addr); bx_relop(t, OC_NUMCMP, sense ? OC_JMPLSS : OC_JMPGEQ, addr);
break; break;
case OC_NAND: case OC_NAND:
sense = ! sense; sense = !sense;
/* caution: fall through */ /* caution: fall through */
case OC_AND: case OC_AND:
bx_boolop(t, FALSE, sense, sense, addr); bx_boolop(t, FALSE, sense, sense, addr);
@ -124,7 +124,7 @@ oprtype *addr; address to jmp
GTMASSERT; GTMASSERT;
} }
for (p = t->operand ; p < ARRAYTOP(t->operand); p++) for (p = t->operand ; p < ARRAYTOP(t->operand); p++)
if (p->oprclass == TRIP_REF) if (TRIP_REF == p->oprclass)
ex_tail(p); ex_tail(p);
return; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -20,9 +20,8 @@
#include "mdef.h" #include "mdef.h"
#include "caller_id.h" #include "caller_id.h"
caddr_t caller_id(void) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -10,12 +10,11 @@
****************************************************************/ ****************************************************************/
#ifndef CALLG_H #ifndef CALLG_H
#define CALLG_H #define CALLG_H
#include "fgncalsp.h"
typedef struct gparam_list_struct typedef struct gparam_list_struct
{ {
intszofptr_t n; intszofptr_t n;
void *arg[MAXIMUM_PARAMETERS]; void *arg[MAX_ACTUALS];
} gparam_list; } gparam_list;
typedef INTPTR_T (*callgfnptr)(intszofptr_t cnt, ...); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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_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_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_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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -21,6 +21,8 @@
#include "cdbg_dump.h" #include "cdbg_dump.h"
#include "stringpool.h" #include "stringpool.h"
#include "cache.h" #include "cache.h"
#include "gtmio.h"
#include "have_crit.h"
LITDEF char *oprtype_names[] = 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); cdbg_dump_operand(indent + 1, &dtrip->operand[1], OP_1);
if (dtrip->destination.oprclass) if (dtrip->destination.oprclass)
cdbg_dump_operand(indent + 1, &dtrip->destination, OP_DEST); 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) 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, 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); (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)); 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) 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)); PRINTF("%s ** Warning ** Null opr passed as operand\n", cdbg_indent(indent));
if (!opr->oprclass) if (!opr->oprclass)
{ {
fflush(stdout); FFLUSH(stdout);
return; return;
} }
/* We have a real oprclass, dump it's info */ /* We have a real oprclass, dump it's info */
@ -225,7 +227,7 @@ void cdbg_dump_operand(int indent, oprtype *opr, int opnum)
default: default:
PRINTF("%s %s bogus reference\n", cdbg_indent(indent), oprtype_type_names[opr->oprclass]); 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) void cdbg_dump_mval(int indent, mval *mv)
@ -253,7 +255,7 @@ void cdbg_dump_mval(int indent, mval *mv)
if (!first) if (!first)
PRINTF(", "); PRINTF(", ");
PRINTF("String"); PRINTF("String");
fflush(stdout); FFLUSH(stdout);
first = FALSE; first = FALSE;
} }
if (first) if (first)
@ -281,7 +283,7 @@ void cdbg_dump_mval(int indent, mval *mv)
else else
cdbg_dump_mstr(indent, &mv->str); cdbg_dump_mstr(indent, &mv->str);
} }
fflush(stdout); FFLUSH(stdout);
} }
/* Dump value of a given mstr. Assumes length is non-zero */ /* 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); memcpy(buffer, strp, len);
buffer[len] = 0; buffer[len] = 0;
PRINTF("%s String value: %s\n", cdbg_indent(indent), buffer); PRINTF("%s String value: %s\n", cdbg_indent(indent), buffer);
fflush(stdout); FFLUSH(stdout);
free(buffer); free(buffer);
} }
@ -321,7 +323,7 @@ char *cdbg_indent(int indent)
indent_str = malloc(MAX_INDENT); indent_str = malloc(MAX_INDENT);
if (MAX_INDENT < indent * 2) if (MAX_INDENT < indent * 2)
{ {
fflush(stdout); FFLUSH(stdout);
GTMASSERT; GTMASSERT;
} }
if (indent > last_indent) if (indent > last_indent)

View File

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

View File

@ -51,6 +51,7 @@ int m_zedit(void);
int m_zgoto(void); int m_zgoto(void);
int m_zhalt(void); int m_zhalt(void);
int m_zhelp(void); int m_zhelp(void);
int m_zinvcmd(void);
int m_zlink(void); int m_zlink(void);
int m_zmessage(void); int m_zmessage(void);
int m_zprint(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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -21,8 +21,6 @@
#include "emit_code.h" #include "emit_code.h"
#include "dumptable.h" #include "dumptable.h"
GBLDEF int4 codegen_padlen; /* pad code to section alignment */
LITREF octabstruct oc_tab[]; /* op-code table */ LITREF octabstruct oc_tab[]; /* op-code table */
GBLREF triple t_orig; /* head of triples */ GBLREF triple t_orig; /* head of triples */
GBLREF char cg_phase; /* code generation phase */ GBLREF char cg_phase; /* code generation phase */
@ -30,27 +28,28 @@ GBLREF int4 curr_addr; /* current address */
GBLREF src_line_struct src_head; GBLREF src_line_struct src_head;
GBLREF short source_column,source_line; GBLREF short source_column,source_line;
GBLREF int4 pending_errtriplecode; /* if non-zero contains the error code to invoke ins_errtriple with */ GBLREF int4 pending_errtriplecode; /* if non-zero contains the error code to invoke ins_errtriple with */
GBLREF triple *curtchain;
void code_gen(void) void code_gen(void)
{ {
int4 old_line, pad_len; int4 old_line, pad_len;
triple *ct; /* current triple */
src_line_struct *sl; 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; curr_addr = t_orig.exorder.fl->rtaddr;
old_line = -1; old_line = -1;
} }
assert(0 == pending_errtriplecode); /* we should never have a pending ins_errtriple at this point */ 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 */ DEBUG_ONLY(chktchain(&t_orig)); /* if this assert fails, then recompile with DEBUG_TRIPLES to catch the issue sooner */
dqloop(&t_orig, exorder, ct) dqloop(&t_orig, exorder, ct)
{ {
if (cg_phase == CGP_APPROX_ADDR) if (CGP_APPROX_ADDR == cg_phase)
ct->rtaddr = curr_addr; ct->rtaddr = curr_addr;
else if (cg_phase == CGP_ASSEMBLY) else if (CGP_ASSEMBLY == cg_phase)
{ {
if (ct->src.line != old_line) if (ct->src.line != old_line)
{ {
@ -67,31 +66,27 @@ void code_gen(void)
} }
source_line = ct->src.line; source_line = ct->src.line;
source_column = ct->src.column; source_column = ct->src.column;
if (!(oc_tab[ct->opcode].octype & OCT_CGSKIP)) if (!(oc_tab[ct->opcode].octype & OCT_CGSKIP))
trip_gen(ct); trip_gen(ct);
}/* dqloop */ }/* dqloop */
#ifdef _AIX #ifdef _AIX
emit_epilog(); emit_epilog();
#endif #endif
/* The code section needs to be padded so the next section (variable name table) can be optimally aligned /* 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 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 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. will be subtracted back out, rechecked for padding and an appropriate pad length recomputed.
*/ */
if (CGP_APPROX_ADDR == cg_phase) if (CGP_APPROX_ADDR == cg_phase)
codegen_padlen = PADLEN(curr_addr, SECTION_ALIGN_BOUNDARY); /* Length to pad to align next section */ TREF(codegen_padlen) = PADLEN(curr_addr, SECTION_ALIGN_BOUNDARY); /* Length to pad to align next section */
if (codegen_padlen) if (TREF(codegen_padlen))
{ {
assert(STR_LIT_LEN(PADCHARS) >= codegen_padlen); assert(STR_LIT_LEN(PADCHARS) >= TREF(codegen_padlen));
if (CGP_MACHINE == cg_phase) 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 else
curr_addr += codegen_padlen; curr_addr += TREF(codegen_padlen);
} }
if (CGP_ASSEMBLY == cg_phase)
if (cg_phase == CGP_ASSEMBLY)
dumptable(); dumptable();
}/* code_gen */ }/* code_gen */

View File

@ -31,11 +31,10 @@ GBLREF spdesc stringpool, rts_stringpool, indr_stringpool;
GBLREF short int source_column; GBLREF short int source_column;
GBLREF char cg_phase; GBLREF char cg_phase;
GBLREF unsigned char *source_buffer; GBLREF unsigned char *source_buffer;
GBLREF char window_token;
error_def(ERR_INDEXTRACHARS); 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; triple *ref;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
@ -43,11 +42,11 @@ int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
if (status) if (status)
{ {
while (TK_SPACE == window_token) /* Eat up trailing white space */ while (TK_SPACE == TREF(window_token)) /* Eat up trailing white space */
advancewindow(); 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); stx_error(ERR_INDEXTRACHARS);
} else } else
{ {
@ -77,7 +76,7 @@ int comp_fini(bool status, mstr *obj, opctype retcode, oprtype *retopr, mstr_len
indr_stringpool.free = indr_stringpool.base; indr_stringpool.free = indr_stringpool.base;
} }
} }
if (!status) if (EXPR_FAIL == status)
{ {
assert(indr_stringpool.base == stringpool.base); assert(indr_stringpool.base == stringpool.base);
indr_stringpool = stringpool; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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_STACKCRIT);
error_def(ERR_STACKOFLOW); error_def(ERR_STACKOFLOW);
void comp_indr (mstr *obj) void comp_indr(mstr *obj)
{ {
stack_frame *sf; stack_frame *sf;
unsigned char *fix, *fix_base, *tmps, *syms, *save_msp; unsigned char *fix, *fix_base, *tmps, *syms, *save_msp;
@ -46,10 +46,8 @@ void comp_indr (mstr *obj)
save_msp = msp; save_msp = msp;
sf = (stack_frame *)(msp -= SIZEOF(stack_frame)); sf = (stack_frame *)(msp -= SIZEOF(stack_frame));
rtnhdr = (ihdtyp *)obj->addr; rtnhdr = (ihdtyp *)obj->addr;
/* Check that our cache_entry pointer is in proper alignment with us */ /* Check that our cache_entry pointer is in proper alignment with us */
assert(rtnhdr->indce->obj.addr == (char *)rtnhdr); assert(rtnhdr->indce->obj.addr == (char *)rtnhdr);
tempsz = ROUND_UP2(rtnhdr->temp_size, SIZEOF(char *)); tempsz = ROUND_UP2(rtnhdr->temp_size, SIZEOF(char *));
tmps = msp -= tempsz; tmps = msp -= tempsz;
vartabsz = rtnhdr->vartab_len; vartabsz = rtnhdr->vartab_len;
@ -65,7 +63,6 @@ void comp_indr (mstr *obj)
rts_error(VARLSTCNT(1) ERR_STACKCRIT); rts_error(VARLSTCNT(1) ERR_STACKCRIT);
} }
syms = msp; syms = msp;
*sf = *frame_pointer; *sf = *frame_pointer;
sf->old_frame_pointer = frame_pointer; sf->old_frame_pointer = frame_pointer;
sf->type = 0; sf->type = 0;
@ -74,16 +71,18 @@ void comp_indr (mstr *obj)
sf->vartab_len = rtnhdr->vartab_len; sf->vartab_len = rtnhdr->vartab_len;
if (zapsz = (vartabsz + tempsz)) /* Note assignment */ if (zapsz = (vartabsz + tempsz)) /* Note assignment */
memset(syms, 0, zapsz); /* Zap temps and symtab together */ memset(syms, 0, zapsz); /* Zap temps and symtab together */
sf->vartab_ptr = (char *)rtnhdr + rtnhdr->vartab_off; sf->vartab_ptr = (char *)rtnhdr + rtnhdr->vartab_off;
sf->temp_mvals = rtnhdr->temp_mvals; sf->temp_mvals = rtnhdr->temp_mvals;
/* Code starts just past the literals that were fixed up and past the validation and hdr offset fields */ /* 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)); 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 /* IA64 required SECTION_ALIGN_BOUNDARY alignment (16 bytes). ABS 2008/12
This has been carried forward to other 64bit platfoms without problems */ * 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)); 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->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->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( DEBUG_ONLY(
vp = (INTPTR_T *)sf->mpc; vp = (INTPTR_T *)sf->mpc;
assert(NULL != vp); assert(NULL != vp);
@ -93,7 +92,6 @@ void comp_indr (mstr *obj)
assert((unsigned char*)rtnhdr == (unsigned char *)vp + *vp); assert((unsigned char*)rtnhdr == (unsigned char *)vp + *vp);
); );
rtnhdr->indce->refcnt++; /* This entry is now in use on M stack */ rtnhdr->indce->refcnt++; /* This entry is now in use on M stack */
if (is_tracing_on) if (is_tracing_on)
new_prof_frame(FALSE); new_prof_frame(FALSE);
sf->ctxt = sf->mpc; sf->ctxt = sf->mpc;

View File

@ -19,25 +19,27 @@
#include "advancewindow.h" #include "advancewindow.h"
#include "compile_pattern.h" #include "compile_pattern.h"
#include "patcode.h" #include "patcode.h"
#include "fullbool.h"
GBLREF spdesc stringpool; GBLREF spdesc stringpool;
GBLREF char *lexical_ptr; GBLREF char *lexical_ptr;
GBLREF unsigned char *source_buffer; GBLREF unsigned char *source_buffer;
GBLREF short int source_column; 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; ptstr retstr;
mval retmval; mval retmval;
mstr instr; mstr instr;
int status; triple *oldchain, *ref, tmpchain, *triptr;
triple *oldchain, tmpchain, *ref, *triptr;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
if (is_indirect) 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); dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -12,6 +12,6 @@
#ifndef __COMPILE_PATTERN_H__ #ifndef __COMPILE_PATTERN_H__
#define __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 #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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -162,7 +162,6 @@ typedef struct
#define OCT_CGSKIP 128 #define OCT_CGSKIP 128
#define OCT_COERCE 256 #define OCT_COERCE 256
typedef struct typedef struct
{ {
char name[20]; char name[20];
@ -190,13 +189,17 @@ typedef struct
# error UNSUPPORTED PLATFORM # error UNSUPPORTED PLATFORM
#endif #endif
#define EXPR_FAIL 0 /* expression had syntax error */ #define MUMPS_INT 0 /* integer - they only type the compiler handles differently */
#define EXPR_GOOD 1 /* expression ok, no indirection at root */ #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_INDR 2 /* expression ok, indirection at root */
#define EXPR_SHFT 4 /* expression ok, involved shifted GV references */ #define EXPR_SHFT 4 /* expression ok, involved shifted GV references */
#define CHARMAXARGS 256 #define CHARMAXARGS 256
#define MAX_ACTUALS 32
#define MAX_FORARGS 127 #define MAX_FORARGS 127
#define MAX_SRCLINE 8192 /* maximum length of a program source or indirection line */ #define MAX_SRCLINE 8192 /* maximum length of a program source or indirection line */
#define NO_FORMALLIST (-1) #define NO_FORMALLIST (-1)
@ -357,14 +360,14 @@ error_def(ERR_SVNOSET);
#define TRUE_WITH_INDX 2 #define TRUE_WITH_INDX 2
int actuallist(oprtype *opr); int actuallist(oprtype *opr);
int bool_expr(bool op, oprtype *addr); int bool_expr(boolean_t op, oprtype *addr);
void bx_boolop(triple *t, bool jmp_type_one, bool jmp_to_next, bool sense, 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_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 chktchain(triple *head);
void code_gen(void); void code_gen(void);
void coerce(oprtype *a, unsigned short new_type); 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_init(mstr *src);
void comp_indr(mstr *obj); void comp_indr(mstr *obj);
boolean_t compiler_startup(void); boolean_t compiler_startup(void);
@ -373,7 +376,7 @@ int eval_expr(oprtype *a);
int expratom(oprtype *a); int expratom(oprtype *a);
int exfunc(oprtype *a, boolean_t alias_target); int exfunc(oprtype *a, boolean_t alias_target);
int expritem(oprtype *a); int expritem(oprtype *a);
int expr(oprtype *a); int expr(oprtype *a, int m_type);
void ex_tail(oprtype *opr); void ex_tail(oprtype *opr);
int extern_func(oprtype *a); int extern_func(oprtype *a);
int f_ascii(oprtype *a, opctype op); int f_ascii(oprtype *a, opctype op);
@ -437,21 +440,19 @@ int gvn(void);
void ind_code(mstr *obj); void ind_code(mstr *obj);
int indirection(oprtype *a); int indirection(oprtype *a);
void ins_triple(triple *x); void ins_triple(triple *x);
int intexpr(oprtype *a);
void int_label(void); void int_label(void);
int jobparameters (oprtype *c); int jobparameters (oprtype *c);
boolean_t line(uint4 *lnc); boolean_t line(uint4 *lnc);
int linetail(void); int linetail(void);
int lkglvn(bool gblvn); int lkglvn(boolean_t gblvn);
int lref(oprtype *label, oprtype *offset, bool no_lab_ok, mint commarg_code, bool commarg_ok, bool *got_some); 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); int lvn(oprtype *a,opctype index_op,triple *parent);
void make_commarg(oprtype *x, mint ind); void make_commarg(oprtype *x, mint ind);
oprtype make_gvsubsc(mval *v); oprtype make_gvsubsc(mval *v);
triple *maketriple(opctype op); triple *maketriple(opctype op);
int name_glvn(bool gblvn, oprtype *a); int name_glvn(boolean_t gblvn, oprtype *a);
triple *newtriple(opctype op); triple *newtriple(opctype op);
int nref(void); int nref(void);
int numexpr(oprtype *a);
void obj_code(uint4 src_lines, uint4 checksum); void obj_code(uint4 src_lines, uint4 checksum);
int one_job_param(char **parptr); int one_job_param(char **parptr);
int parse_until_rparen_or_space(void); int parse_until_rparen_or_space(void);
@ -481,7 +482,6 @@ void shrink_jmps(void);
# endif # endif
void start_fetches(opctype op); void start_fetches(opctype op);
void start_for_fetches(void); void start_for_fetches(void);
int strexpr(oprtype *a);
void tnxtarg(oprtype *a); void tnxtarg(oprtype *a);
void tripinit(void); void tripinit(void);
void walktree(mvar *n,void (*f)(),char *arg); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -27,16 +27,18 @@ GBLREF command_qualifier cmd_qlf;
GBLREF char cg_phase; GBLREF char cg_phase;
GBLREF boolean_t mstr_native_align, save_mstr_native_align; 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) 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; START_CH;
if (DUMPABLE) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -30,7 +30,7 @@ void copy_stack_frame(void)
unsigned char *msp_save; unsigned char *msp_save;
msp_save = msp; msp_save = msp;
sf = (stack_frame *) (msp -= SIZEOF(stack_frame)); sf = (stack_frame *)(msp -= SIZEOF(stack_frame));
if (msp <= stackwarn) if (msp <= stackwarn)
{ {
if (msp <= stacktop) if (msp <= stacktop)
@ -46,6 +46,8 @@ void copy_stack_frame(void)
sf->old_frame_pointer = frame_pointer; sf->old_frame_pointer = frame_pointer;
sf->flags = 0; /* Don't propagate special flags */ sf->flags = 0; /* Don't propagate special flags */
sf->for_ctrl_stack = NULL; 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; frame_pointer = sf;
DBGEHND((stderr, "copy_stack_frame: Added stackframe at addr 0x"lvaddr" old-msp: 0x"lvaddr" new-msp: 0x"lvaddr"\n", DBGEHND((stderr, "copy_stack_frame: Added stackframe at addr 0x"lvaddr" old-msp: 0x"lvaddr" new-msp: 0x"lvaddr"\n",
sf, msp_save, msp)); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 boolean_t mupip_jnl_recover;
GBLREF jnl_process_vector *prc_vec; 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. /* Create a journal file from info.
* If necessary, it renames journal file of same name. * If necessary, it renames journal file of same name.
* Note: jgbl.gbl_jrec_time must be set by callers * 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; int org_fn_len, rename_fn_len, fstat;
uint4 ustatus; uint4 ustatus;
char *org_fn, rename_fn[MAX_FN_LEN]; 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 */ 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; int group_id;
struct stat sb; struct stat sb;
int perm; int perm;
struct perm_diag_data pdd;
#endif #endif
int idx;
trans_num db_tn; trans_num db_tn;
uint4 temp_offset, temp_checksum; uint4 temp_offset, temp_checksum;
uint4 jnl_fs_block_size; 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; jrecbuf = NULL;
if (info->no_rename) if (info->no_rename)
{ /* The only cases where no-renaming is possible are as follows { /* 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; return EXIT_ERR;
} }
/* setup new group and permissions if indicated by the security rules. /* 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 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))) 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->blks_to_upgrd = info->blks_to_upgrd;
epoch_record->free_blocks = info->free_blocks; epoch_record->free_blocks = info->free_blocks;
epoch_record->total_blks = info->total_blks; epoch_record->total_blks = info->total_blks;
epoch_record->fully_upgraded = info->csd->fully_upgraded;
temp_offset = JNL_HDR_LEN + PINI_RECLEN; temp_offset = JNL_HDR_LEN + PINI_RECLEN;
temp_checksum = ADJUST_CHECKSUM(INIT_CHECKSUM_SEED, temp_offset); temp_checksum = ADJUST_CHECKSUM(INIT_CHECKSUM_SEED, temp_offset);
epoch_record->prefix.checksum = ADJUST_CHECKSUM(temp_checksum, info->checksum); epoch_record->prefix.checksum = ADJUST_CHECKSUM(temp_checksum, info->checksum);
epoch_record->suffix.suffix_code = JNL_REC_SUFFIX_CODE; 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]; pfin_record = (struct_jrec_pfin *)&jrecbuf[PINI_RECLEN + EPOCH_RECLEN];
temp_offset = JNL_HDR_LEN + PINI_RECLEN + EPOCH_RECLEN; temp_offset = JNL_HDR_LEN + PINI_RECLEN + EPOCH_RECLEN;
temp_checksum = ADJUST_CHECKSUM(INIT_CHECKSUM_SEED, temp_offset); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -25,8 +25,11 @@ GBLREF boolean_t cw_stagnate_reinitialized;
/* Initialize the cw_stagnate hash-table */ /* Initialize the cw_stagnate hash-table */
#define CWS_INIT \ #define CWS_INIT \
{ \ { \
if (0 == cw_stagnate.size) \
{ \
init_hashtab_int4(&cw_stagnate, CWS_INITIAL_SIZE, HASHTAB_COMPACT, HASHTAB_SPARE_TABLE); \ init_hashtab_int4(&cw_stagnate, CWS_INITIAL_SIZE, HASHTAB_COMPACT, HASHTAB_SPARE_TABLE); \
cw_stagnate_reinitialized = TRUE; \ cw_stagnate_reinitialized = TRUE; \
} \
} }
/* macro CWS_INSERT appends a block_id onto an hashtable of block_id's /* 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -55,19 +55,19 @@ 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 */ /* 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 /* 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 * 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. * 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 * 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 * 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 * 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. * correspondingly updated. SE 5/2006.
*/ */
if (csd->minor_dbver < GDSMVCURR) if (csd->minor_dbver < GDSMVCURR)
{ /* In general, the method for adding new versions is: { /* 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 * 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). * 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. * 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) if (!csd->opened_by_gtmv53 && !csd->db_got_to_v5_once)
{ {
@ -103,15 +103,28 @@ void db_auto_upgrade(gd_region *reg)
* e) Add assert(FALSE) and break (like it was before) * e) Add assert(FALSE) and break (like it was before)
*/ */
switch(csd->minor_dbver) 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 GDSMV51000: /* Multi-site replication available */
case GDSMV52000: /* Unicode */ case GDSMV52000: /* Unicode */
case GDSMV53000: /* M-Itanium release */ case GDSMV53000: /* M-Itanium release */
gvstats_rec_upgrade(csa); /* Move GVSTATS information to new place in file header */ 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; 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; break;
case GDSMV54003: case GDSMV55000:
/* Nothing to do for this version since it is GDSMVCURR for now. */ /* 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, */ 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. */ 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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; cache_rec_ptr_t cr, cr_hash_base;
int blk_hash, lcnt, ocnt, hmax; int blk_hash, lcnt, ocnt, hmax;
bool is_mm; bool is_mm;
#ifdef DEBUG # ifdef DEBUG
cache_rec_ptr_t cr_low, cr_high; cache_rec_ptr_t cr_low, cr_high;
#endif # endif
csa = cs_addrs; csa = cs_addrs;
csd = csa->hdr; 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); cr_hash_base = (cache_rec_ptr_t)(csa->acc_meth.mm.mmblk_state->mmblk_array + blk_hash);
} }
ocnt = 0; ocnt = 0;
csa->wbuf_dqd++; /* Tell rundown we have an orphaned block in case of interrupt */
do do
{ {
cr = cr_hash_base; cr = cr_hash_base;
assert(cr->blk == BT_QUEHEAD); assert((0 == cr->blk) || (BT_QUEHEAD == cr->blk));
lcnt = hmax; lcnt = hmax;
do do
{ {
@ -77,10 +76,7 @@ cache_rec_ptr_t db_csh_get(block_id block) /* block number to look up */
* queue changed on us. * queue changed on us.
*/ */
if (cr == cr_hash_base) if (cr == cr_hash_base)
{
csa->wbuf_dqd--;
return (cache_rec_ptr_t)NULL; return (cache_rec_ptr_t)NULL;
}
break; /* Retry - something changed */ break; /* Retry - something changed */
} }
if ((CR_BLKEMPTY != cr->blk) && ((cr->blk % hmax) != blk_hash)) 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; cr->refer = TRUE;
} }
csa->wbuf_dqd--;
return cr; return cr;
} }
lcnt--; 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 /* 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 */ * 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)); } 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); 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); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -14,17 +14,25 @@
#include "gtm_facility.h" #include "gtm_facility.h"
#include "fileinfo.h" #include "fileinfo.h"
#include "gdsbt.h" #include "gdsbt.h"
#include "gdsblk.h"
#include "gdsfhead.h" #include "gdsfhead.h"
#include "interlock.h" #include "interlock.h"
#include "lockconst.h" #include "lockconst.h"
#include "longset.h" #include "longset.h"
#include "relqop.h" #include "relqop.h"
#include "filestruct.h"
#include "jnl.h"
error_def(ERR_WCFAIL); error_def(ERR_WCFAIL);
GBLREF int4 process_id; GBLREF int4 process_id;
#if defined(UNIX) && defined(DEBUG)
void db_csh_ref(sgmnt_addrs *csa) 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; sgmnt_data_ptr_t csd;
node_local_ptr_t cnl; node_local_ptr_t cnl;
@ -41,36 +49,48 @@ void db_csh_ref(sgmnt_addrs *csa)
*/ */
is_mm = (dba_mm == csd->acc_meth); is_mm = (dba_mm == csd->acc_meth);
if (!is_mm) if (!is_mm)
{
if (init)
{ {
longset((uchar_ptr_t)csa->acc_meth.bg.cache_state, longset((uchar_ptr_t)csa->acc_meth.bg.cache_state,
SIZEOF(cache_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(cache_rec), 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 */ 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; cr = cr1 = csa->acc_meth.bg.cache_state->cache_array;
buffer_size = csd->blk_size; buffer_size = csd->blk_size;
assert(buffer_size > 0); assert(buffer_size > 0);
assert(0 == buffer_size % DISK_BLOCK_SIZE); 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); rec_size = SIZEOF(cache_rec);
} else } else
{
if (init)
{ {
longset((uchar_ptr_t)csa->acc_meth.mm.mmblk_state, longset((uchar_ptr_t)csa->acc_meth.mm.mmblk_state,
SIZEOF(mmblk_que_heads) + (csd->bt_buckets + csd->n_bts - 1) * SIZEOF(mmblk_rec), 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 */ 0); /* -1 since there is a mmblk_rec in mmblk_que_heads */
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_active.latch, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&csa->acc_meth.mm.mmblk_state->mmblkq_wip.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;
rec_size = SIZEOF(mmblk_rec); rec_size = SIZEOF(mmblk_rec);
} }
cnl = csa->nl; cnl = csa->nl;
if (init)
{
SET_LATCH_GLOBAL(&cnl->wc_var_lock, LOCK_AVAILABLE); SET_LATCH_GLOBAL(&cnl->wc_var_lock, LOCK_AVAILABLE);
SET_LATCH_GLOBAL(&cnl->db_latch, 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); 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 < cr_top; cr = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size))
cr->blk = BT_QUEHEAD; cr->blk = BT_QUEHEAD;
cr_top = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size * csd->n_bts); cr_top = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size * csd->n_bts);
if (init)
{
cnl->cur_lru_cache_rec_off = GDS_ANY_ABS2REL(csa, cr); cnl->cur_lru_cache_rec_off = GDS_ANY_ABS2REL(csa, cr);
cnl->cache_hits = 0; cnl->cache_hits = 0;
}
if (!is_mm) if (!is_mm)
{ {
bp = (sm_uc_ptr_t)ROUND_UP((sm_ulong_t)cr_top, OS_PAGE_SIZE); bp = (sm_uc_ptr_t)ROUND_UP((sm_ulong_t)cr_top, OS_PAGE_SIZE);
@ -86,6 +106,8 @@ void db_csh_ref(sgmnt_addrs *csa)
} }
for (; cr < cr_top; cr = (cache_rec_ptr_t)((sm_uc_ptr_t)cr + rec_size), 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)) cr1 = (cache_rec_ptr_t)((sm_uc_ptr_t)cr1 + rec_size))
{
if (init)
{ {
if (!is_mm) if (!is_mm)
{ {
@ -94,10 +116,18 @@ void db_csh_ref(sgmnt_addrs *csa)
{ {
INTERLOCK_INIT_MM(cr); INTERLOCK_INIT_MM(cr);
} }
}
cr->cycle++; /* increment cycle whenever buffer's blk number changes (for tp_hist) */ cr->cycle++; /* increment cycle whenever buffer's blk number changes (for tp_hist) */
cr->blk = CR_BLKEMPTY; cr->blk = CR_BLKEMPTY;
assert(0 == cr->bt_index); /* when cr->blk is empty, ensure no bt points to this cache-record */ /* 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)
{
if (!is_mm) if (!is_mm)
{ {
assert(bp <= bp_top); assert(bp <= bp_top);
@ -105,6 +135,7 @@ void db_csh_ref(sgmnt_addrs *csa)
bp += buffer_size; 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; cr->refer = FALSE;
} }
cnl->wc_in_free = csd->n_bts; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 /* Debug macro. This macro is compiled into even the pro-build. It emits the enclosed message if a debug
option has been specified.*/ 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 /* 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. 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -39,6 +39,16 @@ GBLREF int4 exi_condition;
GBLREF int4 error_condition; GBLREF int4 error_condition;
GBLREF enum gtmImageTypes image_type; 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) CONDITION_HANDLER(dbcertify_base_ch)
{ {
VMS_ONLY( VMS_ONLY(
@ -48,14 +58,6 @@ CONDITION_HANDLER(dbcertify_base_ch)
unsigned char msg_buff[MAX_MSG_SIZE + 1]; unsigned char msg_buff[MAX_MSG_SIZE + 1];
$DESCRIPTOR(msgbuf, msg_buff); $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; START_CH;
PRN_ERROR; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -258,7 +258,7 @@ void dbcertify_certify_phase(void)
"- premature exit to main loop\n")); "- premature exit to main loop\n"));
break; break;
} }
DBC_DEBUG(("DBC_DEBUG: ****************** Reading new p1out record (%d) *****************\n", \ DBC_DEBUG(("DBC_DEBUG: ****************** Reading new p1out record (%d) *****************\n",
(rec_num + 1))); (rec_num + 1)));
dbc_read_p1out(psa, &psa->rhdr, SIZEOF(p1rec)); dbc_read_p1out(psa, &psa->rhdr, SIZEOF(p1rec));
if (0 != psa->rhdr.akey_len) if (0 != psa->rhdr.akey_len)
@ -278,7 +278,7 @@ void dbcertify_certify_phase(void)
++restart_cnt; ++restart_cnt;
if (MAX_RESTART_CNT < restart_cnt) if (MAX_RESTART_CNT < restart_cnt)
GTMASSERT; /* No idea what could cause this.. */ 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))); (rec_num + 1)));
/* "restart_transaction" is either set or cleared by dbc_split_blk() below */ /* "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 */ /* 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)) 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 */ { /* 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_lh_blk_len, new_rh_blk_len, psa->max_blk_len));
/* New update array for new block */ /* New update array for new block */
if (level_0) if (level_0)
@ -1022,8 +1022,8 @@ boolean_t dbc_split_blk(phase_static_area *psa, block_id blk_num, enum gdsblk_ty
} else } else
{ /* Recompute sizes for inserted record being in righthand block as per { /* Recompute sizes for inserted record being in righthand block as per
method (2) */ method (2) */
DBC_DEBUG(("DBC_DEBUG: Method 1 created invalid blocks: lh: %d rh: %d " \ 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, \ "max_blk_len: %d -- trying method 2\n", new_lh_blk_len, new_rh_blk_len,
psa->max_blk_len)); psa->max_blk_len));
/* By definition we *must* have an inserted record in this path */ /* By definition we *must* have an inserted record in this path */
assert(0 != ins_rec_len); 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) if (MAX_RESTART_CNT < restart_cnt)
GTMASSERT; /* No idea what could cause this */ 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)); restart_blk_set.blk_num));
psa->block_depth_hwm = -1; /* Zaps cache so all blocks are re-read */ psa->block_depth_hwm = -1; /* Zaps cache so all blocks are re-read */
restart_transaction = dbc_split_blk(psa, restart_blk_set.blk_num, 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 */ 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)); 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 /* 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 */ 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; 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)); blk_index, allocated_blk_num));
/* Fill this block number in the places it needs to be filled */ /* Fill this block number in the places it needs to be filled */
assert(-1 == blk_set_p->blk_num); 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; blk_sega_p = (blk_segment *)blk_set_p->upd_addr;
if (gdsblk_bitmap == blk_set_p->blk_type || gdsblk_read == blk_set_p->usage) 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 */ { /* 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)); blk_index, blk_set_p->blk_type, blk_set_p->usage));
assert(NULL == blk_sega_p); assert(NULL == blk_sega_p);
continue; 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->new_buff = blk_set_p->old_buff;
blk_set_p->old_buff = blk_p; 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)); blk_set_p->blk_num));
psa->fc->op_buff = blk_set_p->new_buff; 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); dbcertify_dbfilop(psa);
if (gdsblk_create == blk_set_p->usage) if (gdsblk_create == blk_set_p->usage)
psa->blks_created++; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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; save_errno = errno;
errmsg = STRERROR(save_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)); 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 */ 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), ((gdsblk_read == blk_set_p->usage) ? blk_set_p->old_buff : blk_set_p->new_buff),
psa->dbc_cs_data->blk_size); psa->dbc_cs_data->blk_size);
blk_set_p->blk_num = -1; /* Effectively invalidate this (now) older cache entry */ 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)); blk_index, psa->block_depth));
} else } else
{ {
@ -568,7 +568,7 @@ int dbc_read_dbblk(phase_static_area *psa, int blk_num, enum gdsblk_type blk_typ
correct configuration */ correct configuration */
dbc_init_blk(psa, blk_set_p, blk_set_p->blk_num, gdsblk_read, blk_set_p->blk_len, dbc_init_blk(psa, blk_set_p, blk_set_p->blk_num, gdsblk_read, blk_set_p->blk_len,
blk_set_p->blk_levl); 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)); " %d\n", psa->block_depth));
break; break;
default: 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)); 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 = FC_READ;
psa->fc->op_buff = (sm_uc_ptr_t)blk_set_new_p->old_buff; 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 */ 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) */ 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 */ /* 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")); " key record\n"));
return blk_index; 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))); (rec_p - blk_p)));
GET_ULONG(blk_ptr, rec_p + VMS_ONLY(3) UNIX_ONLY(4)); GET_ULONG(blk_ptr, rec_p + VMS_ONLY(3) UNIX_ONLY(4));
blk_index = dbc_read_dbblk(psa, blk_ptr, blk_type); 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 */ { /* 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) if (gdsblk_gvtleaf == blk_set_p->blk_type || min_levl == blk_levl)
{ /* This is a terminal block. It is the end of the road */ { /* 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))); " scan was a normal keyed record at offset 0x%lx\n", (rec_p - blk_p)));
return blk_index; 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 this record is known to contain a pointer to another block. Read the block in and
recurse to continue the search for the key. 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))); (rec_p - blk_p)));
GET_ULONG(blk_ptr, (rec_p + SIZEOF(rec_hdr) + blk_set_p->curr_blk_key->end GET_ULONG(blk_ptr, (rec_p + SIZEOF(rec_hdr) + blk_set_p->curr_blk_key->end
- ((rec_hdr *)rec_p)->cmpc + 1)); - ((rec_hdr *)rec_p)->cmpc + 1));

View File

@ -12,8 +12,8 @@
#include "mdef.h" #include "mdef.h"
#ifdef VMS #ifdef VMS
#include "efn.h" # include "efn.h"
#include <ssdef.h> # include <ssdef.h>
#endif #endif
#include "xfer_enum.h" #include "xfer_enum.h"
@ -25,11 +25,9 @@
#include "add_inter.h" #include "add_inter.h"
#include "op.h" #include "op.h"
#include "iott_wrterr.h" #include "iott_wrterr.h"
#ifdef DEBUG_DEFERRED_EVENT
#ifdef DEBUG_DEFERRED # include "gtm_stdio.h"
#include "gtm_stdio.h"
#endif #endif
#include "fix_xfer_entry.h" #include "fix_xfer_entry.h"
/* ============================================================================= /* =============================================================================
@ -39,13 +37,10 @@
/* The transfer table */ /* The transfer table */
GBLREF xfer_entry_t xfer_table[]; GBLREF xfer_entry_t xfer_table[];
/* M Profiling active */ /* M Profiling active */
GBLREF boolean_t is_tracing_on; GBLREF boolean_t is_tracing_on;
/* Marks sensitive database operations */ /* Marks sensitive database operations */
GBLREF volatile int4 fast_lock_count; GBLREF volatile int4 fast_lock_count;
#if defined(VMS) #if defined(VMS)
GBLREF volatile short num_deferred; GBLREF volatile short num_deferred;
#else #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 * 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. * in xfer_set_handlers). The macro INCR_CNT_SP accomplishes this task for us.
*/ */
#if defined(UNIX) #if defined(UNIX)
volatile int4 xfer_table_events[DEFERRED_EVENTS]; volatile int4 xfer_table_events[DEFERRED_EVENTS];
#define INCR_CNT_SP(X,Y) INCR_CNT(X,Y) #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, * Use interlocked operations to prevent races between set and reset,
* and to avoid missing overlapping sets. * and to avoid missing overlapping sets.
* On HP: * On HPUX-HPPA:
* OK only if there's no a risk a conflicting operation is * 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: * On all platforms:
* Don't want I/O from a sensitive area. * Don't want I/O from a sensitive area.
* Avoid both by testing fast_lock_count, and doing interlocks and * 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. * risk is missing an event when there's already one happening.
* ------------------------------------------------------------------ * ------------------------------------------------------------------
*/ */
VMS_ONLY(assert(lib$ast_in_prog())); VMS_ONLY(assert(lib$ast_in_prog()));
if (fast_lock_count == 0) if (fast_lock_count == 0)
{ {
#ifdef DEBUG_DEFERRED DBGDFRDEVNT((stderr, "xfer_set_handlers: Before interlocked operations: "
(void) FPRINTF(stderr, "xfer_table_events[%d]=%d, first_event=%s, num_deferred=%d\n",
"\nBefore interlocked operations: " event_type, xfer_table_events[event_type], (is_first_event ? "TRUE" : "FALSE"),
"xfer_table_events[%d]=%d, " num_deferred));
"first_event=%s, "
"num_deferred=%d\n",
event_type,
xfer_table_events[event_type],
(is_first_event?"TRUE":"FALSE"),
num_deferred);
#endif
if (1 == INCR_CNT_SP(&xfer_table_events[event_type], &defer_latch)) if (1 == INCR_CNT_SP(&xfer_table_events[event_type], &defer_latch))
{
/* Concurrent events can collide here, too */ /* Concurrent events can collide here, too */
is_first_event = (1 == INCR_CNT_SP(&num_deferred, &defer_latch)); is_first_event = (1 == INCR_CNT_SP(&num_deferred, &defer_latch));
} DBGDFRDEVNT((stderr, "xfer_set_handlers: After interlocked operations: "
"xfer_table_events[%d]=%d, first_event=%s, num_deferred=%d\n",
#ifdef DEBUG_DEFERRED event_type,xfer_table_events[event_type], (is_first_event ? "TRUE" : "FALSE"),
(void) FPRINTF(stderr, num_deferred));
"\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
} else if (1 == ++xfer_table_events[event_type]) } else if (1 == ++xfer_table_events[event_type])
is_first_event = (1 == ++num_deferred); is_first_event = (1 == ++num_deferred);
if (is_first_event) if (is_first_event)
{ {
first_event = event_type; first_event = event_type;
# ifdef DEBUG_DEFERRED_EVENT
#ifdef DEBUG_DEFERRED
if (0 != fast_lock_count) if (0 != fast_lock_count)
{ DBGDFRDEVNT((stderr, "xfer_set_handlers: Setting xfer_table for event type %d\n",
(void) FPRINTF(stderr, event_type));
"Setting xfer_table for event type %d.\n", # endif
event_type);
}
#endif
/* ------------------------------------------------------- /* -------------------------------------------------------
* If table changed, it was not synchronized. * If table changed, it was not synchronized.
* (Assumes these entries are all that would be changed) * (Assumes these entries are all that would be changed)
@ -191,7 +164,7 @@ boolean_t xfer_set_handlers(int4 event_type, void (*set_fn)(int4 param), int4 p
* fixed up addresses making direct comparisions non-trivial. * fixed up addresses making direct comparisions non-trivial.
* -------------------------------------------------------- * --------------------------------------------------------
*/ */
#ifndef __ia64 # ifndef __ia64
assert((xfer_table[xf_linefetch] == op_linefetch) || assert((xfer_table[xf_linefetch] == op_linefetch) ||
(xfer_table[xf_linefetch] == op_zstepfetch) || (xfer_table[xf_linefetch] == op_zstepfetch) ||
(xfer_table[xf_linefetch] == op_zst_fet_over) || (xfer_table[xf_linefetch] == op_zst_fet_over) ||
@ -215,24 +188,25 @@ boolean_t xfer_set_handlers(int4 event_type, void (*set_fn)(int4 param), int4 p
assert(xfer_table[xf_retarg] == op_retarg || assert(xfer_table[xf_retarg] == op_retarg ||
xfer_table[xf_retarg] == opp_zst_over_retarg || xfer_table[xf_retarg] == opp_zst_over_retarg ||
xfer_table[xf_retarg] == opp_zstepretarg); xfer_table[xf_retarg] == opp_zstepretarg);
#endif /* !ia64 */ # endif /* !IA64 */
/* ----------------------------------------------- /* -----------------------------------------------
* Now call the specified set function to swap in * Now call the specified set function to swap in
* the desired handlers (and set flags or whatever). * the desired handlers (and set flags or whatever).
* ----------------------------------------------- * -----------------------------------------------
*/ */
DBGDFRDEVNT((stderr, "xfer_set_handlers: Driving event setup handler\n"));
set_fn(param_val); set_fn(param_val);
} }
#ifdef DEBUG_DEFERRED # ifdef DEBUG_DEFERRED_EVENT
else if (0 != fast_lock_count) else if (0 != fast_lock_count)
{ {
(void) FPRINTF(stderr, DBGDFRDEVNT((stderr, "xfer_set_handlers: ---Multiple deferred events---\n"
"\n---Multiple deferred events---\n" "Event type %d occurred while type %d was pending\n", event_type, first_event));
"Event type %d occurred while type %d was pending\n", } else
event_type, {
first_event); DBGDFRDEVNT((stderr, "xfer_set_handlers: Event bypassed -- was not first event\n"));
} }
#endif # endif
assert(no_event != first_event); assert(no_event != first_event);
return is_first_event; return is_first_event;
} }
@ -253,27 +227,19 @@ boolean_t xfer_reset_if_setter(int4 event_type)
{ {
if (event_type == first_event) if (event_type == first_event)
{ {
DBGDFRDEVNT((stderr, "xfer_reset_if_setter: event_type is first_event\n"));
/* Still have to synchronize the same way... */ /* Still have to synchronize the same way... */
if (TRUE == xfer_reset_handlers(event_type)) if (xfer_reset_handlers(event_type))
{ /* ********************************* { /* Check for and activate any other pending events before returning success */
* Check for and activate any
* other pending events before
* returning success:
* *********************************
*/
/* (Not implemented) */ /* (Not implemented) */
return TRUE; return TRUE;
} else } 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); assert(FALSE);
return FALSE; return FALSE;
} }
} else }
DBGDFRDEVNT((stderr, "xfer_reset_if_setter: event_type is NOT first_event\n"));
return FALSE; return FALSE;
} }
@ -322,8 +288,7 @@ boolean_t xfer_reset_handlers(int4 event_type)
int4 e_type; int4 e_type;
boolean_t reset_type_is_set_type; boolean_t reset_type_is_set_type;
int4 status; int4 status;
int e, ei, e_tot=0; int e, ei, e_tot = 0;
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
* Note: If reset routine can preempt path from handler to * 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 < num_deferred);
assert(0 < xfer_table_events[event_type]); assert(0 < xfer_table_events[event_type]);
if (is_tracing_on) if (is_tracing_on)
{ {
FIX_XFER_ENTRY(xf_linefetch, op_mproflinefetch); 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_zbstart, op_zbstart);
FIX_XFER_ENTRY(xf_ret, opp_ret); FIX_XFER_ENTRY(xf_ret, opp_ret);
FIX_XFER_ENTRY(xf_retarg, op_retarg); FIX_XFER_ENTRY(xf_retarg, op_retarg);
DBGDFRDEVNT((stderr, "xfer_reset_handlers: Reset xfer_table for event type %d.\n", event_type));
#ifdef DEBUG_DEFERRED
(void) FPRINTF(stderr,"Reset xfer_table for event type %d.\n",event_type);
#endif
reset_type_is_set_type = (event_type == first_event); reset_type_is_set_type = (event_type == first_event);
# ifdef DEBUG
#ifdef DEBUG
if (!reset_type_is_set_type) if (!reset_type_is_set_type)
{ rts_error(VARLSTCNT(4) ERR_DEFEREVENT, 2, event_type, first_event);
rts_error(VARLSTCNT(4) ERR_DEFEREVENT, # endif
2,
event_type,
first_event);
}
#endif
#ifdef DEBUG_DEFERRED # ifdef DEBUG_DEFERRED_EVENT
/*--------------------------------------------=--------------------------------- /* Note: concurrent modification of array elements means events that occur during this section will
* Note: concurrent modification of array elements means events that occur * cause inconsistent totals.
* during this section will cause inconsistent totals.
*-----------------------------------------------------------------------------
*/ */
for (ei=no_event; ei<DEFERRED_EVENTS; ei++) for (ei = no_event; ei < DEFERRED_EVENTS; ei++)
{
e_tot += xfer_table_events[ei]; e_tot += xfer_table_events[ei];
} if (1 < e_tot)
if (e_tot >1)
{ {
(void) FPRINTF(stderr,"Event Log:\n"); DBGDFRDEVNT((stderr, "xfer_reset_handlers: Event Log:\n"));
for (ei=no_event; ei<DEFERRED_EVENTS; ei++) for (ei=no_event; ei<DEFERRED_EVENTS; ei++)
{ DBGDFRDEVNT((stderr, "xfer_reset_handlers: Event type %d: count was %d.\n",
(void) FPRINTF(stderr, ei, xfer_table_events[ei]));
" Event type %d: count was %d.\n",
ei,
xfer_table_events[ei]);
} }
} # endif
#endif
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
* Kluge(?): set all locations to nonzero value to * Kluge(?): set all locations to nonzero value to
@ -419,12 +365,11 @@ boolean_t xfer_reset_handlers(int4 event_type)
num_deferred = 0; num_deferred = 0;
ctrap_action_is = 0; ctrap_action_is = 0;
outofband = 0; outofband = 0;
VMS_ONLY( # ifdef VMS
status = sys$clref(efn_outofband); status = sys$clref(efn_outofband);
assert(SS$_WASSET == status); assert(SS$_WASSET == status);
if ((SS$_WASSET != status) && (SS$_WASCLR != status)) assertpro((SS$_WASSET == status) || (SS$_WASCLR == status));
GTMASSERT; # endif
)
/* ****************************************************************** /* ******************************************************************
* There is a race here: * There is a race here:
* If a new event interrupts after previous line and before * 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. */ /* Clear to allow new events to be reset only after we're all done. */
for (e_type = 1; DEFERRED_EVENTS > e_type; e_type++) for (e_type = 1; DEFERRED_EVENTS > e_type; e_type++)
{
xfer_table_events[e_type] = FALSE; xfer_table_events[e_type] = FALSE;
}
return reset_type_is_set_type; return reset_type_is_set_type;
} }
@ -465,8 +408,7 @@ void async_action(bool lnfetch_or_start)
switch(first_event) switch(first_event)
{ {
case (outofband_event): case (outofband_event):
if (0 == outofband) /* This function can be invoked only by a op_*intrrpt* transfer table function. Those transfer table
{ /* 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 * 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 * 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 * those transfer table functions for more than one M-line. If "outofband" is set to 0, the call to
@ -475,15 +417,14 @@ void async_action(bool lnfetch_or_start)
* might lead to application integrity issues. It is therefore considered safer to GTMASSERT as we * might lead to application integrity issues. It is therefore considered safer to GTMASSERT as we
* will at least have the core for analysis. * will at least have the core for analysis.
*/ */
GTMASSERT; assertpro(0 != outofband);
}
outofband_action(lnfetch_or_start); outofband_action(lnfetch_or_start);
break; break;
case (tt_write_error_event): case (tt_write_error_event):
UNIX_ONLY( # ifdef UNIX
xfer_reset_if_setter(tt_write_error_event); xfer_reset_if_setter(tt_write_error_event);
iott_wrterr(); iott_wrterr();
) # endif
/* VMS tt error processing is done in op_*intrrpt */ /* VMS tt error processing is done in op_*intrrpt */
break; break;
case (network_error_event): case (network_error_event):
@ -499,11 +440,10 @@ void async_action(bool lnfetch_or_start)
* ------------------------------------------------------- * -------------------------------------------------------
*/ */
default: default:
GTMASSERT; /* see above GTMASSERT for comment as to why this is needed */ assertpro(FALSE); /* see above assertpro() for comment as to why this is needed */
} }
} }
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
* Indicate whether an xfer_table change is pending. * Indicate whether an xfer_table change is pending.
* Only works for changes made using routines in this module * 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 * Async. events that can be deferred
* -------------------------------------------- * --------------------------------------------
@ -90,13 +98,8 @@ boolean_t xfer_reset_if_setter(int4 event_type);
*/ */
void ctrap_set(int4); void ctrap_set(int4);
void ctrlc_set(int4); void ctrlc_set(int4);
void ctrly_set(int4); void ctrly_set(int4);
void tp_timeout_defer(int4);
void tt_write_error_set(int4); void tt_write_error_set(int4);
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------

View File

@ -24,14 +24,10 @@
#include "cvtparm.h" #include "cvtparm.h"
#include "deviceparameters.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_DEVPARINAP);
error_def(ERR_DEVPARUNK);
error_def(ERR_DEVPARVALREQ); error_def(ERR_DEVPARVALREQ);
error_def(ERR_RPARENMISSING);
LITREF unsigned char io_params_size[]; LITREF unsigned char io_params_size[];
LITREF dev_ctl_struct dev_param_control[]; LITREF dev_ctl_struct dev_param_control[];
@ -523,9 +519,9 @@ int deviceparameters(oprtype *c, char who_calls)
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
assert(dev_param_index[26] == (SIZEOF(dev_param_names)/SIZEOF(nametabent))); assert((SIZEOF(dev_param_names) / SIZEOF(nametabent) == dev_param_index[26]));
assert(dev_param_index[26] == (SIZEOF(dev_param_data)/SIZEOF(unsigned char))); assert((SIZEOF(dev_param_data) / SIZEOF(unsigned char)) == dev_param_index[26]);
is_parm_list = (window_token == TK_LPAREN); is_parm_list = (TK_LPAREN == TREF(window_token));
if (is_parm_list) if (is_parm_list)
advancewindow(); advancewindow();
cat_cnt = 0; cat_cnt = 0;
@ -533,9 +529,10 @@ int deviceparameters(oprtype *c, char who_calls)
parse_warn = FALSE; parse_warn = FALSE;
for (;;) for (;;)
{ {
if ((window_token != TK_IDENT) if ((TK_IDENT != TREF(window_token))
|| ((n = namelook(dev_param_index, dev_param_names, window_ident.addr, window_ident.len)) < 0)) || (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 */ STX_ERROR_WARN(ERR_DEVPARUNK); /* sets "parse_warn" to TRUE */
break; break;
} }
@ -549,16 +546,16 @@ int deviceparameters(oprtype *c, char who_calls)
*parptr++ = n; *parptr++ = n;
if (io_params_size[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 */ STX_ERROR_WARN(ERR_DEVPARVALREQ); /* sets "parse_warn" to TRUE */
break; break;
} }
advancewindow(); advancewindow();
if (!expr(&x)) if (EXPR_FAIL == expr(&x, MUMPS_EXPR))
return FALSE; return FALSE;
assert(x.oprclass == TRIP_REF); assert(TRIP_REF == x.oprclass);
if (x.oprval.tref->opcode == OC_LIT) 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 /* 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 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)); cat_list[cat_cnt++] = put_str(parstr, INTCAST(parptr - parstr));
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); status = cvtparm(n, &x.oprval.tref->operand[0].oprval.mlit->v, &tmpmval);
if (status) if (status)
{ {
@ -593,12 +590,12 @@ int deviceparameters(oprtype *c, char who_calls)
} }
if (!is_parm_list) if (!is_parm_list)
break; break;
if (window_token == TK_COLON) if (TK_COLON == TREF(window_token))
{ {
advancewindow(); advancewindow();
continue; continue;
} }
else if (window_token == TK_RPAREN) else if (TK_RPAREN == TREF(window_token))
{ {
advancewindow(); advancewindow();
break; 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 */ { /* Parse the remaining arguments until the corresponding RIGHT-PAREN or SPACE or EOL is reached */
if (!parse_until_rparen_or_space()) if (!parse_until_rparen_or_space())
return FALSE; return FALSE;
if (window_token == TK_RPAREN) if (TK_RPAREN == TREF(window_token))
advancewindow(); advancewindow();
} }
*parptr++ = iop_eol; *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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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.len = v->str.len;
label.str.addr = &ident.c[0]; label.str.addr = &ident.c[0];
addr = op_labaddr(frame_pointer->rvector, &label, 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); current_rhead = CURRENT_RHEAD_ADR(frame_pointer->rvector);
frame_pointer->mpc = LINE_NUMBER_ADDR(current_rhead, USHBIN_ONLY(*)addr); if (argcode == indir_do)
#ifdef HAS_LITERAL_SECT { /* 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); frame_pointer->ctxt = (unsigned char *)LINKAGE_ADR(current_rhead);
#else # else
frame_pointer->ctxt = PTEXT_ADR(current_rhead); frame_pointer->ctxt = PTEXT_ADR(current_rhead);
#endif # endif
return TRUE; return TRUE;
} else } else
return FALSE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -35,16 +35,16 @@ GBLREF int process_exiting;
* *
* 0 - no return value requested * 0 - no return value requested
* 1 - non-alias 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 * Determination of parm/no-parm is made by calling get_ret_targ() which checks the stack frames back to
* on the stack back to a counted frame to see of an MVST_PARM block containg a return mval was pushed * a counted frame whether the ret_value field has a return mval, signifying that a return value is required.
* onto the stack signifying a return value is required. If a return value is required, determination of * If a return value is required, determination of the type of return value is made by examining the
* the type of return value is made by examining the generated instruction stream at the return point * generated instruction stream at the return point and checking for an OC_EXFUNRET or OC_EXFUNRETALS
* and checking for an OC_EXFUNRET or OC_EXFUNRETALS (non-alias and alias type return var processor * (non-alias and alias type return var processor respectively) opcode following the return point. This is
* respectively) opcode following the return point. This is done by isolating the instruction that * done by isolating the instruction that indexes into the transfer table, extracting the xfer-table index
* indexes into the transfer table, extracting the xfer-table index and checking against known values * and checking against known values for op_exfunret and op_exfunretals to determine type of return. No match
* for op_exfunret and op_exfunretals to determine type of return. No match means no return value. * means no return value.
* *
* Because this routine looks at the generated code stream at the return point, it is highly platform * Because this routine looks at the generated code stream at the return point, it is highly platform
* dependent. * dependent.
@ -54,8 +54,6 @@ GBLREF int process_exiting;
int dollar_quit(void) int dollar_quit(void)
{ {
stack_frame *sf; stack_frame *sf;
mval *parm_blk;
int retval;
int xfer_index; int xfer_index;
union union
@ -68,12 +66,10 @@ int dollar_quit(void)
int *xfer_offset_32; int *xfer_offset_32;
} ptrs; } ptrs;
parm_blk = get_ret_targ(&sf); /* There was no return value - return 0 */
if (NULL == parm_blk) if (NULL == get_ret_targ(&sf))
/* There was no parm block - return 0 */ return 0;
retval = 0; /* There is a return value - see if they want a "regular" or alias type return argument */
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 */ sf = sf->old_frame_pointer; /* Caller's frame */
# ifdef __i386 # ifdef __i386
{ {
@ -168,8 +164,7 @@ int dollar_quit(void)
*/ */
ZOS_ONLY(memcpy(&instr_RR, sf->mpc, SIZEOF(instr_RR))); ZOS_ONLY(memcpy(&instr_RR, sf->mpc, SIZEOF(instr_RR)));
ptrs.instr = sf->mpc; ptrs.instr = sf->mpc;
ZOS_ONLY(if ((S390_OPCODE_RR_BCR == instr_RR.opcode) ZOS_ONLY(if ((S390_OPCODE_RR_BCR == instr_RR.opcode) && (0 == instr_RR.r1) && (0 == instr_RR.r2))
&& (0 == instr_RR.r1) && (0 == instr_RR.r2))
ptrs.instr += 2); /* Past BCR 0,0 from external call */ ptrs.instr += 2); /* Past BCR 0,0 from external call */
ptrs.instr += 6; /* Past address load of compiler temp arg */ ptrs.instr += 6; /* Past address load of compiler temp arg */
memcpy(&instr_LG, ptrs.instr, SIZEOF(instr_LG)); memcpy(&instr_LG, ptrs.instr, SIZEOF(instr_LG));
@ -253,10 +248,10 @@ int dollar_quit(void)
# endif # endif
if (xf_exfunret == xfer_index) if (xf_exfunret == xfer_index)
/* Need a QUIT with a non-alias return value */ /* Need a QUIT with a non-alias return value */
retval = 1; return 1;
else if (xf_exfunretals == xfer_index) else if (xf_exfunretals == xfer_index)
/* Need a QUIT with an alias return value */ /* Need a QUIT with an alias return value */
retval = 11; return 11;
else else
{ /* Something weird afoot - had parm block can can't locate EXFUNRET[ALS] opcode. This can happen if { /* 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 * a fatal error occurs during a call before the callee stack frame is actually pushed and we are
@ -264,8 +259,6 @@ int dollar_quit(void)
* we didn't find a parm block.. * we didn't find a parm block..
*/ */
assert(process_exiting); assert(process_exiting);
retval = 0; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -12,6 +12,8 @@
#ifndef __DSE_H__ #ifndef __DSE_H__
#define __DSE_H__ #define __DSE_H__
error_def(ERR_DSEWCREINIT);
#define PATCH_SAVE_SIZE 128 #define PATCH_SAVE_SIZE 128
#define DSE_DMP_TIME_FMT "DD-MON-YEAR 24:60:SS" #define DSE_DMP_TIME_FMT "DD-MON-YEAR 24:60:SS"
@ -58,7 +60,7 @@ enum dse_fmt
}; };
/* Grab crit for dse* functions taking into account -nocrit if specified */ /* 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) \ #define DSE_GRAB_CRIT_AS_APPROPRIATE(WAS_CRIT, WAS_HOLD_ONTO_CRIT, NOCRIT_PRESENT, CS_ADDRS, GV_CUR_REGION) \
{ \ { \
if (!WAS_CRIT) \ if (!WAS_CRIT) \
{ \ { \
@ -66,14 +68,19 @@ enum dse_fmt
CS_ADDRS->now_crit = TRUE; \ CS_ADDRS->now_crit = TRUE; \
else \ else \
grab_crit(GV_CUR_REGION); \ 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 */ /* 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) \ 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) \ if (NOCRIT_PRESENT) \
CS_ADDRS->now_crit = FALSE; \ CS_ADDRS->now_crit = FALSE; \
else \ else \
@ -81,6 +88,51 @@ enum dse_fmt
} \ } \
} }
#ifdef UNIX
# define GET_CONFIRM(X, Y) \
{ \
PRINTF("CONFIRMATION: "); \
FGETS((X), (Y), stdin, fgets_res); \
Y = strlen(X); \
}
#else
# define GET_CONFIRM(X, Y) \
{ \
if(!cli_get_str("CONFIRMATION",(X),&(Y))) \
{ \
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)); \
} \
}
void dse_ctrlc_setup(void); void dse_ctrlc_setup(void);
int dse_data(char *dst, int *len); int dse_data(char *dst, int *len);
int dse_getki(char *dst, int *len, char *qual, int qual_len); int dse_getki(char *dst, int *len, char *qual, int qual_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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -21,16 +21,8 @@
#include "gtmmsg.h" #include "gtmmsg.h"
#if defined(UNIX) #if defined(UNIX)
#define GET_CONFIRM(X,Y) {PRINTF("CONFIRMATION: ");FGETS((X), (Y), stdin, fgets_res);Y = strlen(X);}
#include "gtm_ipc.h" #include "gtm_ipc.h"
GBLREF uint4 user_id; 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 #endif
#include "gdsblk.h" #include "gdsblk.h"
@ -65,6 +57,11 @@ GBLREF uint4 process_id;
GBLREF gd_addr *original_header; GBLREF gd_addr *original_header;
GBLREF boolean_t dse_all_dump; /* TRUE if DSE ALL -DUMP is specified */ 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) void dse_all(void)
{ {
gd_region *ptr; gd_region *ptr;
@ -74,8 +71,6 @@ void dse_all(void)
gd_region *old_region; gd_region *old_region;
block_id old_block; block_id old_block;
int4 stat; int4 stat;
char confirm[256];
unsigned short len;
boolean_t ref = FALSE; boolean_t ref = FALSE;
boolean_t crit = FALSE; boolean_t crit = FALSE;
boolean_t wc = FALSE; boolean_t wc = FALSE;
@ -89,14 +84,7 @@ void dse_all(void)
boolean_t was_crit; boolean_t was_crit;
gd_addr *temp_gdaddr; gd_addr *temp_gdaddr;
gd_binding *map; gd_binding *map;
#ifdef UNIX UNIX_ONLY(char *fgets_res;)
char *fgets_res;
#endif
error_def(ERR_DSEWCINITCON);
error_def(ERR_FREEZE);
error_def(ERR_DBRDONLY);
error_def(ERR_FREEZECTRL);
old_addrs = cs_addrs; old_addrs = cs_addrs;
old_region = gv_cur_region; old_region = gv_cur_region;
@ -106,13 +94,7 @@ void dse_all(void)
if (cli_present("RENEW") == CLI_PRESENT) if (cli_present("RENEW") == CLI_PRESENT)
{ {
crit = ref = wc = nofreeze = TRUE; crit = ref = wc = nofreeze = TRUE;
len = SIZEOF(confirm); GET_CONFIRM_AND_HANDLE_NEG_RESPONSE;
GET_CONFIRM(confirm,len);
if (confirm[0] != 'Y' && confirm[0] != 'y')
{
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON);
return;
}
} else } else
{ {
if (cli_present("CRITINIT") == CLI_PRESENT) if (cli_present("CRITINIT") == CLI_PRESENT)
@ -121,14 +103,8 @@ void dse_all(void)
ref = TRUE; ref = TRUE;
if (cli_present("WCINIT") == CLI_PRESENT) if (cli_present("WCINIT") == CLI_PRESENT)
{ {
GET_CONFIRM_AND_HANDLE_NEG_RESPONSE;
wc = TRUE; 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) if (cli_present("BUFFER_FLUSH") == CLI_PRESENT)
flush = TRUE; flush = TRUE;
@ -225,18 +201,13 @@ void dse_all(void)
if (!was_crit) if (!was_crit)
grab_crit(gv_cur_region); /* no point seizing crit if WE already have it held */ 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 (wc)
{ {
if (!was_crit && !seize) if (!was_crit && !seize)
grab_crit(gv_cur_region); grab_crit(gv_cur_region);
bt_init(cs_addrs); DSE_WCREINIT(cs_addrs);
if (cs_addrs->hdr->acc_meth == dba_bg)
{
bt_refresh(cs_addrs);
db_csh_ini(cs_addrs);
db_csh_ref(cs_addrs);
}
if (!was_crit && (!seize || release)) if (!was_crit && (!seize || release))
rel_crit(gv_cur_region); rel_crit(gv_cur_region);
} }
@ -244,13 +215,19 @@ void dse_all(void)
wcs_flu(WCSFLU_FLUSH_HDR | WCSFLU_WRITE_EPOCH | WCSFLU_SYNC_EPOCH); wcs_flu(WCSFLU_FLUSH_HDR | WCSFLU_WRITE_EPOCH | WCSFLU_SYNC_EPOCH);
if (release) if (release)
{ /* user wants crit to be released unconditionally so "was_crit" not checked like everywhere else */ { /* 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) 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); rel_crit(gv_cur_region);
}
else else
{
assert(!cs_addrs->hold_onto_crit && !cs_addrs->dse_crit_seize_done);
util_out_print("Current process does not own the Region: !AD.", util_out_print("Current process does not own the Region: !AD.",
TRUE, REG_LEN_STR(gv_cur_region)); TRUE, REG_LEN_STR(gv_cur_region));
} }
}
if (nofreeze) if (nofreeze)
{ {
if (REG_ALREADY_FROZEN == region_freeze(gv_cur_region,FALSE, override, FALSE)) if (REG_ALREADY_FROZEN == region_freeze(gv_cur_region,FALSE, override, 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -44,20 +44,20 @@ GBLREF int patch_fdmp_recs;
GBLREF int patch_rec_counter; GBLREF int patch_rec_counter;
LITREF char *gtm_dbversion_table[]; LITREF char *gtm_dbversion_table[];
error_def(ERR_BITMAPSBAD);
error_def(ERR_CTRLC);
error_def(ERR_DSEBLKRDFAIL);
boolean_t dse_b_dmp(void) boolean_t dse_b_dmp(void)
{ {
int4 util_len, head, lmap_num, iter1, iter2, mapsize, bplmap, nocrit_present, dummy_int, len, count; int4 util_len, head, lmap_num, iter1, iter2, mapsize, bplmap, nocrit_present, dummy_int, len, count;
unsigned char util_buff[MAX_UTIL_LEN], mask; 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; 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); 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; cache_rec_ptr_t cr;
enum db_ver ondsk_blkver; enum db_ver ondsk_blkver;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
error_def(ERR_BITMAPSBAD);
head = cli_present("HEADER"); head = cli_present("HEADER");
if (CLI_PRESENT == cli_present("BLOCK")) if (CLI_PRESENT == cli_present("BLOCK"))
{ {
@ -87,19 +87,19 @@ boolean_t dse_b_dmp(void)
patch_rec_counter = 1; patch_rec_counter = 1;
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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 ( ; ; ) for ( ; ; )
{ {
if (blk / bplmap * bplmap != blk) if (blk / bplmap * bplmap != blk)
{ {
if (!(bp = t_qread(blk, &dummy_int, &cr))) 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); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
} }
if (((blk_hdr_ptr_t) bp)->levl && patch_is_fdmp) 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); util_out_print("Error: cannot perform GLO/ZWR dump on index block.", TRUE);
return FALSE; return FALSE;
} }
@ -138,7 +138,7 @@ boolean_t dse_b_dmp(void)
} }
if (util_interrupt) 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); rts_error(VARLSTCNT(1) ERR_CTRLC);
break; break;
} }
@ -148,7 +148,7 @@ boolean_t dse_b_dmp(void)
{ {
if (!(bp = t_qread(blk, &dummy_int, &cr))) 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); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
} }
if (CLI_NEGATED != head) if (CLI_NEGATED != head)
@ -235,7 +235,8 @@ boolean_t dse_b_dmp(void)
util_out_print("|", TRUE); util_out_print("|", TRUE);
if (util_interrupt) 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); 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); TRUE,1, BUSY_CHAR, 1, FREE_CHAR, 1, REUSABLE_CHAR, 1, CORRUPT_CHAR);
if (invalid_bitmap) 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); rts_error(VARLSTCNT(1) ERR_BITMAPSBAD);
} }
} }
@ -256,6 +258,6 @@ boolean_t dse_b_dmp(void)
blk = 0; blk = 0;
} }
patch_curr_blk = blk; 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -33,6 +33,8 @@
GBLREF gd_region *gv_cur_region; GBLREF gd_region *gv_cur_region;
GBLREF gd_addr *original_header; 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 DB_ABS2REL(X) ((sm_uc_ptr_t)(X) - (sm_uc_ptr_t)csa->nl)
#define MAX_UTIL_LEN 40 #define MAX_UTIL_LEN 40
#define CLEAN_VERIFY "verification is clean" #define CLEAN_VERIFY "verification is clean"
@ -54,9 +56,7 @@ void dse_cache(void)
sm_uc_ptr_t chng_ptr; sm_uc_ptr_t chng_ptr;
cache_rec_ptr_t cr_que_lo; cache_rec_ptr_t cr_que_lo;
mmblk_rec_ptr_t mr_que_lo; mmblk_rec_ptr_t mr_que_lo;
boolean_t is_mm; boolean_t is_mm, was_hold_onto_crit;
error_def(ERR_SIZENOTVALID4);
all_present = (CLI_PRESENT == cli_present("ALL")); all_present = (CLI_PRESENT == cli_present("ALL"));
@ -93,8 +93,7 @@ void dse_cache(void)
csa = &FILE_INFO(reg)->s_addrs; csa = &FILE_INFO(reg)->s_addrs;
assert(is_mm || (csa->db_addrs[0] == (sm_uc_ptr_t)csa->nl)); assert(is_mm || (csa->db_addrs[0] == (sm_uc_ptr_t)csa->nl));
was_crit = csa->now_crit; was_crit = csa->now_crit;
if (!was_crit && !nocrit_present) DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, csa, reg);
grab_crit(reg);
if (verify_present || recover_present) if (verify_present || recover_present)
{ {
GET_CURR_TIME_IN_DOLLARH_AND_ZDATE(dollarh_mval, dollarh_buffer, zdate_mval, zdate_buffer); 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); util_out_print("Region !AD : db_file_header = 0x!XJ", TRUE, REG_LEN_STR(reg), csa->hdr);
} }
} }
if (!was_crit && !nocrit_present) DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, csa, reg);
rel_crit(reg);
} }
return; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 unsigned char *non_tp_jfb_buff_ptr;
GBLREF cw_set_element cw_set[]; GBLREF cw_set_element cw_set[];
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEFAIL);
error_def(ERR_DBRDONLY);
void dse_chng_bhead(void) void dse_chng_bhead(void)
{ {
block_id blk; block_id blk;
@ -79,10 +83,6 @@ void dse_chng_bhead(void)
blk_hdr_ptr_t bp, save_bp, save_old_block; blk_hdr_ptr_t bp, save_bp, save_old_block;
# endif # endif
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_DSEFAIL);
error_def(ERR_DBRDONLY);
if (gv_cur_region->read_only) if (gv_cur_region->read_only)
rts_error(VARLSTCNT(4) ERR_DBRDONLY, 2, DB_LEN_STR(gv_cur_region)); 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 */ 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 */ /* Pass the desired tn as argument to bg_update/mm_update below */
BUILD_AIMG_IF_JNL_ENABLED(csd, non_tp_jfb_buff_ptr, tn); BUILD_AIMG_IF_JNL_ENABLED(csd, non_tp_jfb_buff_ptr, tn);
was_hold_onto_crit = csa->hold_onto_crit; 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); t_end(&dummy_hist, NULL, tn);
# ifdef GTM_CRYPT # ifdef GTM_CRYPT
if (csd->is_encrypted && (tn < csa->ti->curr_tn)) 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 * 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 * 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) * 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: * Note:
* Although we use cw_set[0] to access the global buffer corresponding to the block number being updated, * 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 * 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); memcpy(save_bp, bp, bp->bsiz);
} }
# endif # endif
if (!was_hold_onto_crit) csa->hold_onto_crit = was_hold_onto_crit;
csa->hold_onto_crit = FALSE;
if (!was_crit) if (!was_crit)
rel_crit(gv_cur_region); rel_crit(gv_cur_region);
if (unhandled_stale_timer_pop) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -62,22 +62,11 @@ error_def(ERR_DBRDONLY);
error_def(ERR_SIZENOTVALID8); error_def(ERR_SIZENOTVALID8);
error_def(ERR_FREEZECTRL); 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) void dse_chng_fhead(void)
{ {
int4 x, index_x, save_x; int4 x, index_x, save_x;
unsigned short buf_len; unsigned short buf_len;
bool was_crit; boolean_t was_crit, was_hold_onto_crit;
boolean_t override = FALSE; boolean_t override = FALSE;
int4 nocrit_present; int4 nocrit_present;
int4 location_present, value_present, size_present, size; int4 location_present, value_present, size_present, size;
@ -103,13 +92,7 @@ void dse_chng_fhead(void)
memset(buf, 0, MAX_LINE); memset(buf, 0, MAX_LINE);
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("CRIT")); nocrit_present = (CLI_NEGATED == cli_present("CRIT"));
if (!was_crit) DSE_GRAB_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
{
if (nocrit_present)
cs_addrs->now_crit = TRUE;
else
grab_crit(gv_cur_region);
}
if (CLI_PRESENT == cli_present("OVERRIDE")) if (CLI_PRESENT == cli_present("OVERRIDE"))
override = TRUE; override = TRUE;
#ifdef VMS #ifdef VMS
@ -121,7 +104,7 @@ void dse_chng_fhead(void)
&& !override) && !override)
#endif #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.", util_out_print("Region: !AD is frozen by another user, not releasing freeze.",
TRUE, REG_LEN_STR(gv_cur_region)); TRUE, REG_LEN_STR(gv_cur_region));
rts_error(VARLSTCNT(4) ERR_FREEZE, 2, 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; location_present = TRUE;
if (!cli_get_hex("LOCATION", &location)) 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; return;
} }
} }
@ -144,7 +127,7 @@ void dse_chng_fhead(void)
location_present = TRUE; location_present = TRUE;
if (!cli_get_hex("HEXLOCATION", &location)) 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; return;
} }
} }
@ -153,7 +136,7 @@ void dse_chng_fhead(void)
location_present = TRUE; location_present = TRUE;
if (!cli_get_int("DECLOCATION", (int4 *)&location)) 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; return;
} }
} }
@ -163,7 +146,7 @@ void dse_chng_fhead(void)
size_present = TRUE; size_present = TRUE;
if (!cli_get_int("SIZE", &size)) 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; return;
} }
} }
@ -173,7 +156,7 @@ void dse_chng_fhead(void)
value_present = TRUE; value_present = TRUE;
if (!cli_get_hex64("VALUE", (gtm_uint64_t *)&value)) 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; return;
} }
} }
@ -182,7 +165,7 @@ void dse_chng_fhead(void)
value_present = TRUE; value_present = TRUE;
if (!cli_get_hex64("HEXVALUE", &value)) 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; return;
} }
} }
@ -191,7 +174,7 @@ void dse_chng_fhead(void)
value_present = TRUE; value_present = TRUE;
if (!cli_get_uint64("DECVALUE", (gtm_uint64_t *)&value)) 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; return;
} }
} }
@ -202,7 +185,7 @@ void dse_chng_fhead(void)
if (!((SIZEOF(char) == size) || (SIZEOF(short) == size) || (SIZEOF(int4) == size) || if (!((SIZEOF(char) == size) || (SIZEOF(short) == size) || (SIZEOF(int4) == size) ||
(SIZEOF(gtm_int64_t) == 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); rts_error(VARLSTCNT(1) ERR_SIZENOTVALID8);
} }
if ((0 > (int4)size) || ((uint4)SGMNT_HDR_LEN < (uint4)location) if ((0 > (int4)size) || ((uint4)SGMNT_HDR_LEN < (uint4)location)
@ -267,8 +250,7 @@ void dse_chng_fhead(void)
else else
{ {
cs_addrs->hdr->blk_size = ((x/DISK_BLOCK_SIZE) + 1) * DISK_BLOCK_SIZE; cs_addrs->hdr->blk_size = ((x/DISK_BLOCK_SIZE) + 1) * DISK_BLOCK_SIZE;
CLNUP_CRIT; gtm_putmsg(VARLSTCNT(4) ERR_BLKSIZ512, 2, x, cs_addrs->hdr->blk_size);
rts_error(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))) 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 -------- */ /* ---------- 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)) if (CLI_PRESENT == cli_present("REG_SEQNO") && cli_get_hex64("REG_SEQNO", (gtm_uint64_t *)&seq_no))
cs_addrs->hdr->reg_seqno = 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( VMS_ONLY(
if (CLI_PRESENT == cli_present("RESYNC_SEQNO") && cli_get_hex64("RESYNC_SEQNO", (gtm_uint64_t *)&seq_no)) if (CLI_PRESENT == cli_present("RESYNC_SEQNO") && cli_get_hex64("RESYNC_SEQNO", (gtm_uint64_t *)&seq_no))
cs_addrs->hdr->resync_seqno = 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; cs_addrs->hdr->zqgblmod_seqno = seq_no;
if (CLI_PRESENT == cli_present("ZQGBLMOD_TN") && cli_get_hex64("ZQGBLMOD_TN", &tn)) if (CLI_PRESENT == cli_present("ZQGBLMOD_TN") && cli_get_hex64("ZQGBLMOD_TN", &tn))
cs_addrs->hdr->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")) if (CLI_PRESENT == cli_present("STDNULLCOLL"))
{ {
@ -764,6 +754,6 @@ void dse_chng_fhead(void)
else else
cs_addrs->hdr->writer_trigger_factor = x; 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -35,6 +35,8 @@ GBLREF uint4 process_id;
GBLREF short crash_count; GBLREF short crash_count;
GBLREF gd_addr *original_header; GBLREF gd_addr *original_header;
error_def(ERR_DBRDONLY);
#define MAX_UTIL_LEN 80 #define MAX_UTIL_LEN 80
void dse_crit(void) void dse_crit(void)
@ -44,8 +46,6 @@ void dse_crit(void)
boolean_t crash = FALSE, cycle = FALSE, owner = FALSE; boolean_t crash = FALSE, cycle = FALSE, owner = FALSE;
gd_region *save_region, *r_local, *r_top; gd_region *save_region, *r_local, *r_top;
error_def(ERR_DBRDONLY);
crash = ((cli_present("CRASH") == CLI_PRESENT) || (cli_present("RESET") == CLI_PRESENT)); crash = ((cli_present("CRASH") == CLI_PRESENT) || (cli_present("RESET") == CLI_PRESENT));
cycle = (CLI_PRESENT == cli_present("CYCLE")); cycle = (CLI_PRESENT == cli_present("CYCLE"));
if (cli_present("SEIZE") == CLI_PRESENT || cycle) if (cli_present("SEIZE") == CLI_PRESENT || cycle)
@ -60,6 +60,7 @@ void dse_crit(void)
crash_count = cs_addrs->critical->crashcnt; crash_count = cs_addrs->critical->crashcnt;
grab_crit(gv_cur_region); grab_crit(gv_cur_region);
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;
util_out_print("!/Seized write critical section.!/", TRUE); util_out_print("!/Seized write critical section.!/", TRUE);
if (!cycle) if (!cycle)
return; return;
@ -76,10 +77,16 @@ void dse_crit(void)
crash_count = cs_addrs->critical->crashcnt; crash_count = cs_addrs->critical->crashcnt;
if (cs_addrs->now_crit) if (cs_addrs->now_crit)
{ /* user wants crit to be released unconditionally so "was_crit" not checked like everywhere else */ { /* 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 */ cs_addrs->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
rel_crit(gv_cur_region); rel_crit(gv_cur_region);
util_out_print("!/Released write critical section.!/", TRUE); 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; return;
} }
if (cli_present("INIT") == CLI_PRESENT) 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. * 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->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
cs_addrs->dse_crit_seize_done = FALSE;
rel_crit(gv_cur_region); rel_crit(gv_cur_region);
util_out_print("!/Removed owner of write critical section!/", TRUE); util_out_print("!/Removed owner of write critical section!/", TRUE);
} else } 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. * 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->hold_onto_crit = FALSE; /* need to do this before the rel_crit */
cs_addrs->dse_crit_seize_done = FALSE;
rel_crit(gv_cur_region); rel_crit(gv_cur_region);
util_out_print("!/Removed owner of write critical section!/", TRUE); util_out_print("!/Removed owner of write critical section!/", TRUE);
util_out_print("!/WARNING: No recovery because database is MM.!/", 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; boolean_t jnl_buff_open;
unsigned char util_buff[MAX_UTIL_LEN], buffer[MAXNUMLEN]; 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; uint4 jnl_status;
enum jnl_state_codes jnl_state; enum jnl_state_codes jnl_state;
gds_file_id zero_fid; gds_file_id zero_fid;
@ -255,8 +255,7 @@ void dse_dmp_fhead (void)
if (CLI_PRESENT == cli_present("ALL")) if (CLI_PRESENT == cli_present("ALL"))
{ /* Only dump if -/ALL as if part of above display */ { /* Only dump if -/ALL as if part of above display */
util_out_print(0, TRUE); util_out_print(0, TRUE);
UNIX_ONLY(util_out_print(" Dualsite Resync Seqno 0x!16@XQ", FALSE, &csd->dualsite_resync_seqno);) util_out_print(" ", FALSE);
VMS_ONLY(util_out_print(" ", FALSE);)
util_out_print(" DB Current Minor Version !4UL", TRUE, csd->minor_dbver); 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(" 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); 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); 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); 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")) if (NEED_TO_DUMP("ENVIRONMENT"))
{ {
util_out_print(0, TRUE); 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); util_out_print(" jnl solid tn 0x!16@XQ", TRUE, &csd->jnl_eovtn);
for (rectype = JRT_BAD + 1; rectype < JRT_RECTYPES - 1; rectype++) 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]); jb->reccnt[rectype]);
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) 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(0, TRUE);
util_out_print(" Recover interrupted !AD", FALSE, 5, (csd->recov_interrupted ? " TRUE" : "FALSE")); util_out_print(" Recover interrupted !AD", FALSE, 5, (csd->recov_interrupted ? " TRUE" : "FALSE"));
util_out_print(" ", FALSE); util_out_print(" ", FALSE);
util_out_print(" INTRPT resolve time !12UL", TRUE, csd->intrpt_recov_tp_resolve_time); 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(" ", FALSE);
util_out_print(" INTRPT jnl_state !12UL", TRUE, csd->intrpt_recov_jnl_state); util_out_print(" INTRPT repl_state !12UL", TRUE, csd->intrpt_recov_repl_state);
util_out_print(" INTRPT repl_state !12UL", FALSE, csd->intrpt_recov_repl_state); util_out_print(" INTRPT seqno 0x!16@XQ", TRUE, &csd->intrpt_recov_resync_seqno);
util_out_print(0, TRUE); 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")) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -33,47 +33,47 @@
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_sibs;
GBLREF bool patch_find_root_search; GBLREF bool patch_find_root_search;
GBLREF bool patch_exh_found; GBLREF global_root_list *global_roots_head;
GBLREF block_id patch_path[MAX_BT_DEPTH + 1];
GBLREF int4 patch_offset[MAX_BT_DEPTH + 1]; 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 sgmnt_addrs *cs_addrs;
GBLREF VSIG_ATOMIC_T util_interrupt; GBLREF VSIG_ATOMIC_T util_interrupt;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
void dse_exhaus(int4 pp, int4 op) 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; block_id last;
short temp_short; cache_rec_ptr_t dummy_cr;
char util_buff[MAX_UTIL_LEN];
int count, util_len; int count, util_len;
int4 dummy_int; int4 dummy_int;
cache_rec_ptr_t dummy_cr;
global_dir_path *d_ptr, *temp; global_dir_path *d_ptr, *temp;
error_def(ERR_DSEBLKRDFAIL); short temp_short;
error_def(ERR_CTRLC); sm_uc_ptr_t bp, b_top, np, nrp, nr_top, ptr, rp, r_top;
last = 0; last = 0;
patch_path_count++; patch_path_count++;
if(!(bp = t_qread(patch_path[pp - 1],&dummy_int,&dummy_cr))) if(!(bp = t_qread(patch_path[pp - 1], &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); 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; 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); b_top = bp + SIZEOF(blk_hdr);
else else
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz; b_top = bp + ((blk_hdr_ptr_t)bp)->bsiz;
for (rp = bp + SIZEOF(blk_hdr); rp < b_top ;rp = r_top) for (rp = bp + SIZEOF(blk_hdr); rp < b_top; rp = r_top)
{ {
if (util_interrupt) if (util_interrupt)
{ {
rts_error(VARLSTCNT(1) ERR_CTRLC); rts_error(VARLSTCNT(1) ERR_CTRLC);
break; break;
} }
if (!(np = t_qread(patch_path[pp - 1],&dummy_int,&dummy_cr))) if (!(np = t_qread(patch_path[pp - 1], &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (np != bp) if (np != bp)
{ {
@ -82,22 +82,19 @@ void dse_exhaus(int4 pp, int4 op)
r_top = np + (r_top - bp); r_top = np + (r_top - bp);
bp = np; bp = np;
} }
GET_SHORT(temp_short,&((rec_hdr_ptr_t) rp)->rsiz); GET_SHORT(temp_short, &((rec_hdr_ptr_t)rp)->rsiz);
r_top = rp + temp_short; r_top = rp + temp_short;
if (r_top > b_top) if (r_top > b_top)
r_top = b_top; r_top = b_top;
if (r_top - rp < SIZEOF(block_id)) if (SIZEOF(block_id) > (r_top - rp))
break; break;
if (((blk_hdr_ptr_t)bp)->levl) if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_path[pp],(r_top - SIZEOF(block_id))); GET_LONG(patch_path[pp], (r_top - SIZEOF(block_id)));
else else
{ {
for (ptr = rp + SIZEOF(rec_hdr); ; ) for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= r_top);)
{ ;
if (*ptr++ == 0 && *ptr++ ==0) GET_LONG(patch_path[pp], ptr);
break;
}
GET_LONG(patch_path[pp],ptr);
} }
patch_offset[op] = (int4)(rp - bp); patch_offset[op] = (int4)(rp - bp);
if (patch_path[pp] == patch_find_blk) if (patch_path[pp] == patch_find_blk)
@ -105,7 +102,7 @@ void dse_exhaus(int4 pp, int4 op)
if (!patch_exh_found) if (!patch_exh_found)
{ {
if (patch_find_sibs) if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings",TRUE); util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
patch_exh_found = TRUE; patch_exh_found = TRUE;
} }
if (patch_find_sibs) if (patch_find_sibs)
@ -114,98 +111,82 @@ void dse_exhaus(int4 pp, int4 op)
if (r_top < b_top) if (r_top < b_top)
{ {
nrp = r_top; nrp = r_top;
GET_SHORT(temp_short,&((rec_hdr_ptr_t) rp)->rsiz); GET_SHORT(temp_short, &((rec_hdr_ptr_t)rp)->rsiz);
nr_top = nrp + temp_short; nr_top = nrp + temp_short;
if (nr_top > b_top) if (nr_top > b_top)
nr_top = b_top; nr_top = b_top;
if (nr_top - nrp >= SIZEOF(block_id)) if (SIZEOF(block_id) <= (nr_top - nrp))
{ {
if (((blk_hdr_ptr_t)bp)->levl) if (((blk_hdr_ptr_t)bp)->levl)
GET_LONG(patch_right_sib,(nr_top - SIZEOF(block_id))); GET_LONG(patch_right_sib, (nr_top - SIZEOF(block_id)));
else else
{ {
for (ptr = rp + SIZEOF(rec_hdr); ;) for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= nr_top);)
{ ;
if (*ptr++ == 0 && *ptr++ == 0) GET_LONG(patch_right_sib, ptr);
break;
}
GET_LONG(patch_right_sib,ptr);
} }
} }
} } else
else
patch_right_sib = 0; patch_right_sib = 0;
if (patch_left_sib) if (patch_left_sib)
{ util_out_print("!_0x!XL", FALSE, patch_left_sib);
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);
}
else else
util_out_print(" none",TRUE); util_out_print("!_none!_", FALSE);
} util_out_print("!_0x!XL!_", FALSE, patch_find_blk);
else /* !patch_find_sibs */ 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--; patch_path_count--;
util_out_print(" Directory path!/ Path--blk:off",TRUE); util_out_print(" Directory path!/ Path--blk:off", TRUE);
if (!patch_find_root_search) if (!patch_find_root_search)
{ {
d_ptr = global_roots_head->link->dir_path; d_ptr = global_roots_head->link->dir_path;
while(d_ptr) while (d_ptr)
{ {
memcpy(util_buff," ",1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(d_ptr->block,(uchar_ptr_t)&util_buff[util_len],8); util_len += i2hex_nofill(d_ptr->block, (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len],":",1); memcpy(&util_buff[util_len], ":", 1);
util_len += 1; util_len += 1;
util_len += i2hex_nofill(d_ptr->offset,(uchar_ptr_t)&util_buff[util_len],4); util_len += i2hex_nofill(d_ptr->offset, (uchar_ptr_t)&util_buff[util_len], 4);
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff,FALSE); util_out_print(util_buff, FALSE);
temp = d_ptr; temp = d_ptr;
d_ptr = d_ptr->next; d_ptr = d_ptr->next;
free(temp); free(temp);
} }
global_roots_head->link->dir_path = 0; global_roots_head->link->dir_path = 0;
util_out_print("!/!/ Global paths!/ Path--blk:off",TRUE); util_out_print("!/!/ Global paths!/ Path--blk:off", TRUE);
} }
for (count = 0; count < patch_path_count ;count++) for (count = 0; count < patch_path_count; count++)
{ {
memcpy(util_buff," ",1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(patch_path[count],(uchar_ptr_t)&util_buff[util_len],8); util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
memcpy(&util_buff[util_len],":",1); memcpy(&util_buff[util_len], ":", 1);
util_len += 1; util_len += 1;
util_len += i2hex_nofill(patch_offset[count],(uchar_ptr_t)&util_buff[util_len],4); util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4);
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff,FALSE); util_out_print(util_buff,FALSE);
} }
memcpy(util_buff," ",1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(patch_path[count],(uchar_ptr_t)&util_buff[util_len],8); util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff,TRUE); util_out_print(util_buff, TRUE);
patch_path_count++; patch_path_count++;
} }
} }
if (patch_path[pp] > 0 && patch_path[pp] < cs_addrs->ti->total_blks if ((0 < patch_path[pp]) && (patch_path[pp] < cs_addrs->ti->total_blks) && (patch_path[pp] % cs_addrs->hdr->bplmap))
&& (patch_path[pp] % cs_addrs->hdr->bplmap)) {
if (((blk_hdr_ptr_t) bp)->levl > 1) if (1 < ((blk_hdr_ptr_t)bp)->levl)
dse_exhaus(pp + 1,op + 1); dse_exhaus(pp + 1, op + 1);
else if (((blk_hdr_ptr_t)bp)->levl == 1 && patch_find_root_search) else if ((1 == ((blk_hdr_ptr_t)bp)->levl) && patch_find_root_search)
dse_find_roots(patch_path[pp]); dse_find_roots(patch_path[pp]);
}
last = patch_path[pp]; last = patch_path[pp];
} }
patch_path_count--; patch_path_count--;

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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -13,18 +13,28 @@
#include "gtm_stdlib.h" /* for exit() */ #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 "error.h"
#include "iosp.h" #include "iosp.h"
#include "util.h" #include "util.h"
#include "dse_exit.h" #include "dse_exit.h"
GBLREF unsigned int t_tries; GBLREF unsigned int t_tries;
#ifdef DEBUG
GBLREF sgmnt_addrs *cs_addrs;
#endif
void dse_exit(void) void dse_exit(void)
{ {
/* reset t_tries (from CDB_STAGNATE to 0) as we are exiting and no longer going to be running transactions /* 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 */ * and an assert in wcs_recover relies on this */
t_tries = 0; t_tries = 0;
assert((NULL == cs_addrs) || !cs_addrs->now_crit || cs_addrs->hold_onto_crit);
util_out_close(); util_out_close();
EXIT(SS_NORMAL); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -31,123 +31,110 @@
/* Include prototypes*/ /* Include prototypes*/
#include "t_qread.h" #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 global_root_list *global_roots_head, *global_roots_tail;
GBLDEF block_id patch_left_sib, patch_right_sib, patch_find_blk; GBLDEF int4 patch_offset[MAX_BT_DEPTH + 1], patch_offset1[MAX_BT_DEPTH + 1];
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 short int patch_dir_path_count; GBLDEF short int patch_dir_path_count;
GBLREF block_id patch_curr_blk;
GBLREF sgmnt_addrs *cs_addrs; GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region; GBLREF gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk;
GBLREF short int patch_path_count; GBLREF short int patch_path_count;
#define MAX_UTIL_LEN 33 #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) void dse_f_blk(void)
{ {
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_root_list *temp;
global_dir_path *d_ptr, *dtemp; 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; int util_len;
int4 dummy_int; int4 dummy_int;
cache_rec_ptr_t dummy_cr; 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); if (CLI_PRESENT == cli_present("BLOCK"))
error_def(ERR_CTRLC);
if (cli_present("BLOCK") == CLI_PRESENT)
{ {
if(!cli_get_hex("BLOCK", (uint4 *)&blk)) if (!cli_get_hex("BLOCK", (uint4 *)&blk))
return; return;
if (blk < 0 || blk >= cs_addrs->ti->total_blks if ((0 > blk) || (blk >= cs_addrs->ti->total_blks) || !(blk % cs_addrs->hdr->bplmap))
|| !(blk % cs_addrs->hdr->bplmap))
{ {
util_out_print("Error: invalid block number.", TRUE); util_out_print("Error: invalid block number.", TRUE);
return; return;
} }
patch_curr_blk = blk; patch_curr_blk = blk;
} }
patch_find_sibs = (cli_present("SIBLINGS") == CLI_PRESENT); patch_find_sibs = (CLI_PRESENT == cli_present("SIBLINGS"));
patch_find_blk = patch_curr_blk; patch_find_blk = patch_curr_blk;
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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);
/* ESTABLISH is done here because dse_f_blk_ch() assumes we already /* ESTABLISH is done here because dse_f_blk_ch() assumes we already have crit. */
* have crit.
*/
ESTABLISH(dse_f_blk_ch); ESTABLISH(dse_f_blk_ch);
if (!(bp = t_qread(patch_find_blk, &dummy_int, &dummy_cr)))
if(!(bp = t_qread(patch_find_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); 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; 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); b_top = bp + SIZEOF(blk_hdr);
else else
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz; b_top = bp + ((blk_hdr_ptr_t)bp)->bsiz;
rp = bp + SIZEOF(blk_hdr); rp = bp + SIZEOF(blk_hdr);
GET_SHORT(rsize, &((rec_hdr_ptr_t) rp)->rsiz); GET_SHORT(rsize, &((rec_hdr_ptr_t) rp)->rsiz);
if (rsize < SIZEOF(rec_hdr)) if (SIZEOF(rec_hdr) > rsize)
r_top = rp + SIZEOF(rec_hdr); r_top = rp + SIZEOF(rec_hdr);
else else
r_top = rp + rsize; r_top = rp + rsize;
if (r_top > b_top) if (r_top > b_top)
r_top = b_top; r_top = b_top;
for (key_top = rp + SIZEOF(rec_hdr); key_top < r_top ; ) for (key_top = rp + SIZEOF(rec_hdr); (key_top < r_top) && *key_top++; )
{ ;
if (!*key_top++) if (((blk_hdr_ptr_t)bp)->levl && key_top > (blk_id = r_top - SIZEOF(block_id))) /* NOTE assignment */
break;
}
if (((blk_hdr_ptr_t)bp)->levl && key_top > (blk_id = r_top - SIZEOF(block_id)))
key_top = blk_id; key_top = blk_id;
patch_path_count = 1; patch_path_count = 1;
patch_path[0] = get_dir_root(); patch_path[0] = get_dir_root();
patch_left_sib = patch_right_sib = 0; patch_left_sib = patch_right_sib = 0;
size = key_top - rp - SIZEOF(rec_hdr); size = key_top - rp - SIZEOF(rec_hdr);
if (size > SIZEOF(targ_key)) if (SIZEOF(targ_key) < size)
size = SIZEOF(targ_key); size = SIZEOF(targ_key);
patch_find_root_search = TRUE; patch_find_root_search = TRUE;
if ((exhaust = (cli_present("EXHAUSTIVE") == CLI_PRESENT)) || size <= 0) if ((exhaust = (cli_present("EXHAUSTIVE") == CLI_PRESENT)) || (0 >= size)) /* NOTE assignment */
{ {
if (size < 0) if (size < 0)
{ {
util_out_print("No keys in block, cannot perform ordered search.", TRUE); 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); DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
REVERT; REVERT;
return; return;
} }
if (patch_exh_found = (patch_find_blk == patch_path[0])) if (patch_exh_found = (patch_find_blk == patch_path[0])) /* NOTE assignment */
{ {
if (patch_find_sibs) if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings!/ none none", TRUE);
else
{ {
memcpy(util_buff, "!/ Paths--blk:off!/ ", 24); util_out_print("!/!_Left sibling!_Current block!_Right sibling", TRUE);
util_len = 24; util_out_print("!_none!_!_0x!XL!_none",TRUE, patch_find_blk);
util_len += i2hex_nofill(patch_find_blk, (uchar_ptr_t)&util_buff[util_len], } else
8); {
util_buff[util_len] = 0; assert(1 == patch_path[0]); /* OK to assert because pro prints */
util_out_print(util_buff, TRUE); util_out_print("!/ Directory path!/ Path--blk:off!/!_1", TRUE);
} }
} } else
else
{ {
global_roots_head = (global_root_list *)malloc(SIZEOF(global_root_list)); global_roots_head = (global_root_list *)malloc(SIZEOF(global_root_list));
global_roots_tail = global_roots_head; global_roots_tail = global_roots_head;
global_roots_head->link = (global_root_list *)0; global_roots_head->link = NULL;
global_roots_head->dir_path = (global_dir_path *)0; global_roots_head->dir_path = NULL;
dse_exhaus(1, 0); dse_exhaus(1, 0);
patch_find_root_search = FALSE; patch_find_root_search = FALSE;
while (!patch_exh_found && global_roots_head->link) while (!patch_exh_found && global_roots_head->link)
@ -155,29 +142,29 @@ void dse_f_blk(void)
patch_path[0] = global_roots_head->link->root; patch_path[0] = global_roots_head->link->root;
patch_path_count = 1; patch_path_count = 1;
patch_left_sib = patch_right_sib = 0; patch_left_sib = patch_right_sib = 0;
if (patch_exh_found = (patch_find_blk == patch_path[0])) if (patch_exh_found = (patch_find_blk == patch_path[0])) /* NOTE assignment */
{ {
if (patch_find_sibs) if (patch_find_sibs)
util_out_print("!/ Left siblings Right siblings!/ none none", TRUE); {
else 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--; patch_path_count--;
util_out_print(" Directory path!/ Path--blk:off", TRUE); util_out_print("!/ Directory path!/ Path--blk:off", TRUE);
if (!patch_find_root_search) if (!patch_find_root_search)
{ {
d_ptr = global_roots_head->link->dir_path; d_ptr = global_roots_head->link->dir_path;
while(d_ptr) while (d_ptr)
{ {
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(d_ptr->block, util_len += i2hex_nofill(d_ptr->block,
(uchar_ptr_t)&util_buff[util_len], (uchar_ptr_t)&util_buff[util_len], 8);
8);
memcpy(&util_buff[util_len], ":", 1); memcpy(&util_buff[util_len], ":", 1);
util_len += 1; util_len += 1;
util_len += i2hex_nofill(d_ptr->offset, util_len += i2hex_nofill(d_ptr->offset,
(uchar_ptr_t)&util_buff[util_len], (uchar_ptr_t)&util_buff[util_len], 4);
4);
memcpy(&util_buff[util_len], ",", 1); memcpy(&util_buff[util_len], ",", 1);
util_len += 1; util_len += 1;
util_buff[util_len] = 0; util_buff[util_len] = 0;
@ -187,18 +174,18 @@ void dse_f_blk(void)
free(temp); free(temp);
} }
global_roots_head->link->dir_path = 0; global_roots_head->link->dir_path = 0;
util_out_print("!/!/ Global paths!/ Path--blk:off", TRUE); util_out_print("!/ Global tree path!/ Path--blk:off", TRUE);
} }
for (count = 0; count < patch_path_count ;count++) for (count = 0; count < patch_path_count; count++)
{ {
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(patch_path[count], util_len += i2hex_nofill(patch_path[count],
(uchar_ptr_t)&util_buff[util_len], (uchar_ptr_t)&util_buff[util_len], 8);
8);
memcpy(&util_buff[util_len], ":", 1); memcpy(&util_buff[util_len], ":", 1);
util_len += 1; util_len += 1;
util_len += i2hex_nofill(patch_offset[count], (uchar_ptr_t)&util_buff[util_len], 4); util_len += i2hex_nofill(patch_offset[count],
(uchar_ptr_t)&util_buff[util_len], 4);
memcpy(&util_buff[util_len], ",", 1); memcpy(&util_buff[util_len], ",", 1);
util_len += 1; util_len += 1;
util_buff[util_len] = 0; util_buff[util_len] = 0;
@ -206,17 +193,15 @@ void dse_f_blk(void)
} }
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(patch_path[count], util_len += i2hex_nofill(patch_path[count], (uchar_ptr_t)&util_buff[util_len], 8);
(uchar_ptr_t)&util_buff[util_len], 8);
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, TRUE); util_out_print(util_buff, TRUE);
} }
} } else
else
dse_exhaus(1, 0); dse_exhaus(1, 0);
temp = global_roots_head; temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path; d_ptr = global_roots_head->link->dir_path;
while(d_ptr) while (d_ptr)
{ {
dtemp = d_ptr; dtemp = d_ptr;
d_ptr = d_ptr->next; d_ptr = d_ptr->next;
@ -229,7 +214,7 @@ void dse_f_blk(void)
{ {
temp = global_roots_head; temp = global_roots_head;
d_ptr = global_roots_head->link->dir_path; d_ptr = global_roots_head->link->dir_path;
while(d_ptr) while (d_ptr)
{ {
dtemp = d_ptr; dtemp = d_ptr;
d_ptr = d_ptr->next; d_ptr = d_ptr->next;
@ -242,61 +227,211 @@ void dse_f_blk(void)
if (!patch_exh_found) if (!patch_exh_found)
{ {
if (exhaust) if (exhaust)
{
util_out_print("Error: exhaustive search fail.", TRUE); util_out_print("Error: exhaustive search fail.", TRUE);
}
else else
{
util_out_print("Error: ordered search fail.", TRUE); util_out_print("Error: ordered search fail.", TRUE);
} } else
}
else
util_out_print(0, TRUE); util_out_print(0, 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);
REVERT; REVERT;
return; return;
} } else /* !exhaust && size > 0 */
else /* !exhaust && size > 0 */
{ {
if (!dse_is_blk_in(rp, r_top, size)) if (!dse_is_blk_in(rp, r_top, size))
{ {
util_out_print("Error: ordered search fail.", TRUE); util_out_print("Error: ordered search fail.", 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);
REVERT; REVERT;
return; return;
} }
} }
if (patch_find_sibs) 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)
{ {
util_out_print("!/!_Left sibling!_Right sibling", TRUE); for (last = 0, lvl = (patch_find_root_search ? patch_dir_path_count : patch_path_count) - 1; 0 <= --lvl;)
if (patch_left_sib)
{ {
memcpy(util_buff, "!_", 2); if (!(sp = t_qread(patch_find_root_search ? patch_path[lvl] : patch_path1[lvl], &dummy_int,
util_len = 2; &dummy_cr)))
util_len += i2hex_nofill(patch_left_sib, (uchar_ptr_t)&util_buff[util_len], 8); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
util_buff[util_len] = 0; if (((blk_hdr_ptr_t)sp)->bsiz > cs_addrs->hdr->blk_size)
util_out_print(util_buff, FALSE); s_top = sp + cs_addrs->hdr->blk_size;
} else if (SIZEOF(blk_hdr) > ((blk_hdr_ptr_t)sp)->bsiz)
else
util_out_print("!_none", FALSE);
if (patch_right_sib)
{ {
memcpy(util_buff, "!_!_", 4); util_out_print("Error: sibling search hit problem blk 0x!XL",
util_len = 4; TRUE, patch_find_root_search ? patch_path[lvl] : patch_path1[lvl]);
util_len += i2hex_nofill(patch_right_sib, (uchar_ptr_t)&util_buff[util_len], 8); lvl = -1;
memcpy(&util_buff[util_len], "!/", 2); break;
util_len += 2;
util_buff[util_len] = 0;
util_out_print(util_buff, TRUE);
} else } else
util_out_print("!_!_none!/", TRUE); s_top = sp + ((blk_hdr_ptr_t)sp)->bsiz;
DSE_REL_CRIT_AS_APPROPRIATE(was_crit, nocrit_present, cs_addrs, gv_cur_region); 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; REVERT;
return; return;
} }
util_out_print("!/ Directory path!/ Path--blk:off", TRUE); util_out_print("!/ Directory path!/ Path--blk:off", TRUE);
patch_dir_path_count--; patch_dir_path_count--;
for (count = 0; count < patch_dir_path_count ;count++) for (count = 0; count < patch_dir_path_count; count++)
{ {
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
@ -309,11 +444,15 @@ void dse_f_blk(void)
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, FALSE); 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); util_out_print("!/ Global tree path!/ Path--blk:off", TRUE);
}
if (patch_path_count) if (patch_path_count)
{ {
patch_path_count--; patch_path_count--;
for (count = 0; count < patch_path_count ;count++) for (count = 0; count < patch_path_count; count++)
{ {
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
@ -326,25 +465,17 @@ void dse_f_blk(void)
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, FALSE); util_out_print(util_buff, FALSE);
} }
} else
assert(patch_find_root_search); /* OK to assert since pro works as desired */
memcpy(util_buff, " ", 1); memcpy(util_buff, " ", 1);
util_len = 1; util_len = 1;
util_len += i2hex_nofill(patch_path1[count], (uchar_ptr_t)&util_buff[util_len], 8); 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); memcpy(&util_buff[util_len], "!/", 2);
util_len += 2; util_len += 2;
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, TRUE); util_out_print(util_buff, TRUE);
} DSE_REL_CRIT_AS_APPROPRIATE(was_crit, was_hold_onto_crit, nocrit_present, cs_addrs, gv_cur_region);
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; REVERT;
return; return;
} }
@ -352,11 +483,10 @@ void dse_f_blk(void)
/* Control-C condition handler */ /* Control-C condition handler */
CONDITION_HANDLER(dse_f_blk_ch) CONDITION_HANDLER(dse_f_blk_ch)
{ {
error_def(ERR_CTRLC);
START_CH; START_CH;
if (SIGNAL == ERR_CTRLC) if (ERR_CTRLC == SIGNAL)
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);
NEXTCH; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -31,6 +31,8 @@
GBLREF sgmnt_addrs *cs_addrs; GBLREF sgmnt_addrs *cs_addrs;
GBLREF gd_region *gv_cur_region; GBLREF gd_region *gv_cur_region;
error_def(ERR_DSEBLKRDFAIL);
#define MAX_UTIL_LEN 80 #define MAX_UTIL_LEN 80
void dse_f_free(void) void dse_f_free(void)
@ -41,10 +43,9 @@ void dse_f_free(void)
sm_uc_ptr_t lmap_base; sm_uc_ptr_t lmap_base;
int4 bplmap, total_blks; int4 bplmap, total_blks;
int4 util_len, master_bit, lmap_bit, hint_over_bplmap, hint_mod_bplmap; 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; int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr; cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
if (cs_addrs->hdr->bplmap == 0) if (cs_addrs->hdr->bplmap == 0)
{ util_out_print("Cannot perform free block search: bplmap field of file header is zero.", TRUE); { 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)); in_last_bmap = (master_bit == (cs_addrs->ti->total_blks / bplmap));
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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))) if(!(lmap_base = t_qread(master_bit * bplmap, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (master_bit == hint_over_bplmap) if (master_bit == hint_over_bplmap)
@ -88,7 +89,7 @@ void dse_f_free(void)
util_len += 39; util_len += 39;
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, TRUE); 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; return;
} }
memcpy(util_buff, "!/Next free block is ", 21); memcpy(util_buff, "!/Next free block is ", 21);
@ -98,6 +99,6 @@ void dse_f_free(void)
util_len += 3; util_len += 3;
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff, TRUE); 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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; 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]; 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; 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"))) if (!dse_getki(&targ_key[0],&size,LIT_AND_LEN("KEY")))
return; return;
@ -51,11 +51,11 @@ void dse_f_key(void)
patch_find_root_search = TRUE; patch_find_root_search = TRUE;
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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)) 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); 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; return;
} }
root_path_count = patch_path_count; root_path_count = patch_path_count;
@ -117,6 +117,6 @@ void dse_f_key(void)
util_buff[util_len] = 0; util_buff[util_len] = 0;
util_out_print(util_buff,TRUE); 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk; GBLREF block_id patch_curr_blk;
error_def(ERR_DSEBLKRDFAIL);
#define MAX_UTIL_LEN 40 #define MAX_UTIL_LEN 40
void dse_integ(void) void dse_integ(void)
@ -41,9 +43,7 @@ void dse_integ(void)
int4 dummy_int, nocrit_present; int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr; cache_rec_ptr_t dummy_cr;
int util_len; int util_len;
boolean_t was_crit; boolean_t was_crit, was_hold_onto_crit;
error_def(ERR_DSEBLKRDFAIL);
if (CLI_PRESENT == cli_present("BLOCK")) if (CLI_PRESENT == cli_present("BLOCK"))
{ {
@ -65,13 +65,13 @@ void dse_integ(void)
util_out_print(util_buff, TRUE); util_out_print(util_buff, TRUE);
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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))) if (!(bp = t_qread(patch_curr_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
if (TRUE == cert_blk(gv_cur_region, patch_curr_blk, (blk_hdr_ptr_t)bp, 0, FALSE)) if (TRUE == cert_blk(gv_cur_region, patch_curr_blk, (blk_hdr_ptr_t)bp, 0, FALSE))
util_out_print("!/ No errors detected.!/", TRUE); util_out_print("!/ No errors detected.!/", TRUE);
else else
util_out_print(NULL, TRUE); 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -23,47 +23,43 @@
#include "dse.h" #include "dse.h"
GBLREF sgmnt_addrs *cs_addrs; GBLREF sgmnt_addrs *cs_addrs;
GBLREF short int patch_dir_path_count;
GBLREF block_id patch_find_blk; GBLREF block_id patch_find_blk;
GBLREF block_id patch_path[MAX_BT_DEPTH + 1]; GBLREF bool patch_find_root_search;
GBLREF block_id patch_path1[MAX_BT_DEPTH + 1];
GBLREF int4 patch_offset[MAX_BT_DEPTH + 1]; GBLREF int4 patch_offset[MAX_BT_DEPTH + 1];
GBLREF int4 patch_offset1[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_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) int dse_is_blk_in(sm_uc_ptr_t rp, sm_uc_ptr_t r_top, short size)
{ {
sm_uc_ptr_t key_top; 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); memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
if ( patch_find_blk != patch_path[0] if ((patch_find_blk != patch_path[0])
&& !dse_order(patch_path[0], &patch_path[1], &patch_offset[0], && !dse_order(patch_path[0], &patch_path[1], patch_offset, targ_key, size, 0))
&targ_key[0], size, 0))
return FALSE; return FALSE;
patch_dir_path_count = patch_path_count; 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 if ((0 >= patch_path[patch_path_count - 1]) || (patch_path[patch_path_count] > cs_addrs->ti->total_blks))
|| patch_path[patch_path_count] > cs_addrs->ti->total_blks)
return FALSE; return FALSE;
patch_find_root_search = FALSE; patch_find_root_search = FALSE;
for (key_top = rp + SIZEOF(rec_hdr); key_top < r_top ; ) for (key_top = rp + SIZEOF(rec_hdr); (*key_top++ || *key_top++) && (key_top < r_top);)
if (!*key_top++ && !*key_top++) ;
break;
size = key_top - rp - SIZEOF(rec_hdr); size = key_top - rp - SIZEOF(rec_hdr);
if (size < 0) if (0 > size)
size = 0; size = 0;
else if (size > SIZEOF(targ_key)) else if (SIZEOF(targ_key) < size)
size = SIZEOF(targ_key); size = SIZEOF(targ_key);
memcpy(&targ_key[0], rp + SIZEOF(rec_hdr), size); memcpy(targ_key, rp + SIZEOF(rec_hdr), size);
patch_path1[0] = patch_path[patch_path_count - 1]; patch_path1[0] = patch_path[patch_path_count - 1];
patch_path[patch_path_count - 1] = 0; patch_path[patch_path_count - 1] = 0;
patch_path_count = 1; patch_path_count = 1;
if (patch_find_blk != patch_path1[0] if ((patch_find_blk != patch_path1[0])
&& !dse_order(patch_path1[0],&patch_path1[1],&patch_offset1[0], && !dse_order(patch_path1[0], &patch_path1[1], patch_offset1, targ_key, size, 0))
&targ_key[0], size, 0))
return FALSE; return FALSE;
} else } else
patch_path_count = 0; patch_path_count = 0;

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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -26,12 +26,15 @@
#include "t_qread.h" #include "t_qread.h"
#include "mmemory.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 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 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, int dse_order(block_id srch,
block_id_ptr_t pp, block_id_ptr_t pp,
@ -40,99 +43,99 @@ int dse_order(block_id srch,
short int targ_len, short int targ_len,
bool dir_data_blk) 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; unsigned char cc;
block_id last; block_id last;
short int size, rsize; short int rsize, size;
int4 dummy_int; int4 dummy_int;
cache_rec_ptr_t dummy_cr; cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
last = 0; last = 0;
patch_path_count++; 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); 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; 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); b_top = bp + SIZEOF(blk_hdr);
else 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_count = 0;
patch_comp_key[0] = patch_comp_key[1] = 0; patch_comp_key[0] = patch_comp_key[1] = 0;
for (rp = bp + SIZEOF(blk_hdr); rp < b_top ;rp = r_top, last = *pp) for (rp = bp + SIZEOF(blk_hdr); rp < b_top ;rp = r_top, last = *pp)
{ {
GET_SHORT(rsize,&((rec_hdr_ptr_t)rp)->rsiz); GET_SHORT(rsize, &((rec_hdr_ptr_t)rp)->rsiz);
if (rsize < SIZEOF(rec_hdr)) if (SIZEOF(rec_hdr) > rsize)
r_top = rp + SIZEOF(rec_hdr); r_top = rp + SIZEOF(rec_hdr);
else else
r_top = rp + rsize; 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; return FALSE;
if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl) if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl)
{ {
for (ptr = rp + SIZEOF(rec_hdr); ;) for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= b_top);)
if (*ptr++ == 0 && *ptr++ == 0) ;
break; GET_LONGP(pp, ptr);
GET_LONGP(pp,ptr);
} else } else
GET_LONGP(pp,b_top - SIZEOF(block_id)); GET_LONGP(pp, b_top - SIZEOF(block_id));
break; break;
} else } else
{ {
if (r_top - rp < SIZEOF(block_id) + SIZEOF(rec_hdr)) if ((SIZEOF(block_id) + SIZEOF(rec_hdr)) > (r_top - rp))
break; break;
if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl) if (dir_data_blk && !((blk_hdr_ptr_t)bp)->levl)
{ {
for (ptr = rp + SIZEOF(rec_hdr); ;) for (ptr = rp + SIZEOF(rec_hdr); (*ptr++ || *ptr++) && (ptr <= r_top);)
if (*ptr++ == 0 && *ptr++ == 0) ;
break;
key_top = ptr; key_top = ptr;
} else } else
key_top = r_top - SIZEOF(block_id); 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; cc = patch_comp_count;
else else
cc = ((rec_hdr_ptr_t) rp)->cmpc; cc = ((rec_hdr_ptr_t)rp)->cmpc;
size = key_top - rp - SIZEOF(rec_hdr); 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; size = SIZEOF(patch_comp_key) - 2 - cc;
if (size < 0) if (0 > size)
size = 0; size = 0;
memcpy(&patch_comp_key[cc], rp + SIZEOF(rec_hdr), size); memcpy(&patch_comp_key[cc], rp + SIZEOF(rec_hdr), size);
patch_comp_count = cc + size; patch_comp_count = cc + size;
GET_LONGP(pp,key_top); GET_LONGP(pp, key_top);
if (memvcmp(targ_key,targ_len,&patch_comp_key[0],patch_comp_count) <= 0) if (0 >= memvcmp(targ_key, targ_len, patch_comp_key, patch_comp_count))
break; break;
} }
} }
*op = (int4)(rp - bp); *op = (int4)(rp - bp);
if (*pp == patch_find_blk && !dir_data_blk) if ((*pp == patch_find_blk) && !dir_data_blk)
{ {
patch_left_sib = last; patch_left_sib = last;
if (r_top < b_top) if (r_top < b_top)
{ {
rp = r_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; r_top = rp + rsize;
if (r_top > b_top) if (r_top > b_top)
r_top = b_top; r_top = b_top;
if (r_top - rp >= SIZEOF(block_id)) if (SIZEOF(block_id) <= (r_top - rp))
GET_LONG(patch_right_sib,r_top - SIZEOF(block_id)); GET_LONG(patch_right_sib, r_top - SIZEOF(block_id));
} }
return TRUE; 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; return TRUE;
else if (((blk_hdr_ptr_t)bp)->levl == 1 && 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); 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 ((0 == ((blk_hdr_ptr_t)bp)->levl) && patch_find_root_search)
{
patch_find_root_search = FALSE;
return TRUE; return TRUE;
} }
}
patch_path_count--; patch_path_count--;
return FALSE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -36,6 +36,9 @@ GBLREF int patch_fdmp_recs;
GBLREF int patch_rec_counter; GBLREF int patch_rec_counter;
GBLREF VSIG_ATOMIC_T util_interrupt; GBLREF VSIG_ATOMIC_T util_interrupt;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
boolean_t dse_r_dmp(void) boolean_t dse_r_dmp(void)
{ {
block_id blk; block_id blk;
@ -44,12 +47,9 @@ boolean_t dse_r_dmp(void)
int4 dummy_int; int4 dummy_int;
cache_rec_ptr_t dummy_cr; cache_rec_ptr_t dummy_cr;
short record, size; short record, size;
boolean_t was_crit; boolean_t was_crit, was_hold_onto_crit;
int4 nocrit_present; int4 nocrit_present;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
if (cli_present("BLOCK") == CLI_PRESENT) if (cli_present("BLOCK") == CLI_PRESENT)
{ {
uint4 tmp_blk; uint4 tmp_blk;
@ -72,7 +72,7 @@ boolean_t dse_r_dmp(void)
count = 1; count = 1;
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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))) if (!(bp = t_qread(patch_curr_blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); 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)
@ -83,7 +83,7 @@ boolean_t dse_r_dmp(void)
b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz; b_top = bp + ((blk_hdr_ptr_t) bp)->bsiz;
if (((blk_hdr_ptr_t) bp)->levl && patch_is_fdmp) 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); util_out_print("Error: cannot perform GLO/ZWR dump on index block.", TRUE);
return FALSE; return FALSE;
} }
@ -91,12 +91,12 @@ boolean_t dse_r_dmp(void)
{ {
if (!(rp = skan_rnum (bp, FALSE))) 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; return FALSE;
} }
} else if (!(rp = skan_offset (bp, 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; return FALSE;
} }
util_out_print(0, TRUE); util_out_print(0, TRUE);
@ -106,7 +106,7 @@ boolean_t dse_r_dmp(void)
break; break;
patch_rec_counter += 1; 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) if (util_interrupt)
rts_error(VARLSTCNT(1) ERR_CTRLC); rts_error(VARLSTCNT(1) ERR_CTRLC);
else if (cli_present("HEADER") == CLI_NEGATED) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 short int patch_path_count;
GBLREF bool patch_find_root_search; GBLREF bool patch_find_root_search;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
void dse_range(void) void dse_range(void)
{ {
char lower[256], targ_key[256], upper[256], util_buff[MAX_UTIL_LEN]; 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; cache_rec_ptr_t dummy_cr;
short int rsize, size, size1; short int rsize, size, size1;
int cnt, dummy, lower_len, util_len, upper_len; int cnt, dummy, lower_len, util_len, upper_len;
boolean_t busy_matters, free, got_lonely_star, index, low, lost, star, up, was_crit; boolean_t busy_matters, free, got_lonely_star, index, low, lost, star, up, was_crit, was_hold_onto_crit;
error_def(ERR_DSEBLKRDFAIL);
error_def(ERR_CTRLC);
if (cli_present("FROM") == CLI_PRESENT) if (cli_present("FROM") == CLI_PRESENT)
{ {
@ -113,12 +113,12 @@ void dse_range(void)
cnt = 0; cnt = 0;
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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++) for (blk = from; blk <= to ;blk++)
{ {
if (util_interrupt) 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); rts_error(VARLSTCNT(1) ERR_CTRLC);
break; break;
} }
@ -229,7 +229,7 @@ void dse_range(void)
util_out_print("!/Blocks in the specified key range:", TRUE); util_out_print("!/Blocks in the specified key range:", TRUE);
util_out_print("Block: !8XL Level: !2UL", TRUE, blk, level); 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) if (cnt)
util_out_print("Found !UL blocks", TRUE, cnt); util_out_print("Found !UL blocks", TRUE, cnt);
else 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 gd_region *gv_cur_region;
GBLREF block_id patch_curr_blk; GBLREF block_id patch_curr_blk;
error_def(ERR_DSEBLKRDFAIL);
void dse_save(void) void dse_save(void)
{ {
block_id blk; block_id blk;
unsigned i, j, util_len; unsigned i, j, util_len;
unsigned short buff_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]; char buff[100], *ptr, util_buff[MAX_UTIL_LEN];
sm_uc_ptr_t bp; sm_uc_ptr_t bp;
int4 dummy_int, nocrit_present; int4 dummy_int, nocrit_present;
cache_rec_ptr_t dummy_cr; cache_rec_ptr_t dummy_cr;
error_def(ERR_DSEBLKRDFAIL);
memset(util_buff, 0, MAX_UTIL_LEN); memset(util_buff, 0, MAX_UTIL_LEN);
if (was_block = (cli_present("BLOCK") == CLI_PRESENT)) if (was_block = (cli_present("BLOCK") == CLI_PRESENT))
@ -129,11 +129,11 @@ void dse_save(void)
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
was_crit = cs_addrs->now_crit; was_crit = cs_addrs->now_crit;
nocrit_present = (CLI_NEGATED == cli_present("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))) if (!(bp = t_qread(blk, &dummy_int, &dummy_cr)))
rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL); rts_error(VARLSTCNT(1) ERR_DSEBLKRDFAIL);
memcpy(patch_save_set[patch_save_count].bp, bp, cs_addrs->hdr->blk_size); 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); buff_len = SIZEOF(buff);
if ((cli_present("COMMENT") == CLI_PRESENT) && cli_get_str("COMMENT", buff, &buff_len)) 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -21,37 +21,28 @@
#include "filestruct.h" #include "filestruct.h"
#include "cli.h" #include "cli.h"
#include "dse.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 #ifdef UNIX
#include "gtm_stdio.h" # include "gtm_stdio.h"
#define GET_CONFIRM(X,Y) {PRINTF("CONFIRMATION: ");FGETS((X), (Y), stdin, fgets_res);Y = strlen(X);}
#endif #endif
GBLREF gd_region *gv_cur_region; GBLREF gd_region *gv_cur_region;
GBLREF sgmnt_addrs *cs_addrs; GBLREF sgmnt_addrs *cs_addrs;
GBLREF short crash_count; GBLREF short crash_count;
error_def(ERR_DBRDONLY);
error_def(ERR_DSEINVLCLUSFN);
error_def(ERR_DSEONLYBGMM);
error_def(ERR_DSEWCINITCON);
void dse_wcreinit (void) void dse_wcreinit (void)
{ {
unsigned char *c; unsigned char *c;
char confirm[256];
uint4 large_block; uint4 large_block;
short len;
boolean_t was_crit; boolean_t was_crit;
# ifdef UNIX # ifdef UNIX
char *fgets_res; char *fgets_res;
# endif # endif
error_def(ERR_DSEWCINITCON);
error_def(ERR_DSEINVLCLUSFN);
error_def(ERR_DSEONLYBGMM);
error_def(ERR_DBRDONLY);
if (gv_cur_region->read_only) if (gv_cur_region->read_only)
rts_error(VARLSTCNT(4) ERR_DBRDONLY, 2, DB_LEN_STR(gv_cur_region)); 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) if (cs_addrs->critical)
crash_count = cs_addrs->critical->crashcnt; crash_count = cs_addrs->critical->crashcnt;
len = SIZEOF(confirm); GET_CONFIRM_AND_HANDLE_NEG_RESPONSE
GET_CONFIRM(confirm,len);
if (confirm[0] != 'Y' && confirm[0] != 'y')
{
rts_error(VARLSTCNT(1) ERR_DSEWCINITCON);
return;
}
if (cs_addrs->hdr->acc_meth != dba_bg && cs_addrs->hdr->acc_meth != dba_mm) 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")); 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; was_crit = cs_addrs->now_crit;
if (!was_crit) if (!was_crit)
grab_crit(gv_cur_region); grab_crit(gv_cur_region);
bt_init(cs_addrs); DSE_WCREINIT(cs_addrs);
if (cs_addrs->hdr->acc_meth == dba_bg)
{
bt_refresh(cs_addrs);
db_csh_ini(cs_addrs);
db_csh_ref(cs_addrs);
}
if (!was_crit) if (!was_crit)
rel_crit (gv_cur_region); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -20,6 +20,8 @@
#include "gdsblk.h" #include "gdsblk.h"
#include "gdsfhead.h" #include "gdsfhead.h"
#include "filestruct.h" #include "filestruct.h"
#include "gtmio.h"
#include "have_crit.h"
GBLREF gd_region *gv_cur_region; GBLREF gd_region *gv_cur_region;
GBLREF int process_id; GBLREF int process_id;
@ -54,6 +56,6 @@ void dump_lockhist(void)
break; /* Completed the loop */ break; /* Completed the loop */
} }
FPRINTF(stderr,"\0"); FPRINTF(stderr,"\0");
fflush(stderr); FFLUSH(stderr);
#endif #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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 ((2 * MAX_DIGITS_IN_INT) + STR_LIT_LEN(",M,Z,"))
#define ECODE_MAX_LEN_WITH_BUFFER ((ECODE_MAX_LEN) + (BUFFER_FOR_OVERFLOW)) #define ECODE_MAX_LEN_WITH_BUFFER ((ECODE_MAX_LEN) + (BUFFER_FOR_OVERFLOW))
error_def(ERR_SETECODE);
void ecode_set(int errnum) void ecode_set(int errnum)
{ {
mval tmpmval; mval tmpmval;
@ -36,20 +38,18 @@ void ecode_set(int errnum)
int ansi_error; int ansi_error;
int severity; int severity;
error_def(ERR_SETECODE);
/* If this routine was called with error code SETECODE, /* If this routine was called with error code SETECODE,
* an end-user just put a correct value into $ECODE, * an end-user just put a correct value into $ECODE,
* and it shouldn't be replaced by this routine. * and it shouldn't be replaced by this routine.
*/ */
if (ERR_SETECODE == errnum) if (ERR_SETECODE == errnum)
return; return;
/* When the value of $ECODE is non-empty, error trapping /* When the value of $ECODE is non-empty, error trapping is invoked. When the severity level does not warrant
* will be 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
* error trapping, no value should be copied into $ECODE * checking the severity code so system error numbers aren't misinterpreted.
*/ */
severity = errnum & SEV_MSK; severity = errnum & SEV_MSK;
if ((INFO == severity) || (SUCCESS == severity)) if ((NULL != err_check(errnum)) && ((INFO == severity) || (SUCCESS == severity)))
return; return;
/* Get ECODE string from error-number. If the error has an ANSI standard code, return ,Mnnn, (nnn is ANSI code). /* 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 * 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)) if (ectl = err_check(errnum))
{ {
ansi_error = ((errnum & FACMASK(ectl->facnum)) && (MSGMASK(errnum, ectl->facnum) <= ectl->msg_cnt)) ansi_error = ((errnum & FACMASK(ectl->facnum)) && (MSGMASK(errnum, ectl->facnum) <= ectl->msg_cnt))
? error_ansi[MSGMASK(errnum, ectl->facnum) - 1] ? error_ansi[MSGMASK(errnum, ectl->facnum) - 1] : 0;
: 0; if (0 < ansi_error)
if (ansi_error > 0)
{ {
*ecode_ptr++ = 'M'; *ecode_ptr++ = 'M';
ecode_ptr = (char *)i2asc((unsigned char *)ecode_ptr, ansi_error); 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.addr = &ecode_buff[0];
ecode_mstr.len = INTCAST(ecode_ptr - ecode_mstr.addr); ecode_mstr.len = INTCAST(ecode_ptr - ecode_mstr.addr);
assert(ecode_mstr.len <= ECODE_MAX_LEN); assert(ecode_mstr.len <= ECODE_MAX_LEN);
if (ecode_mstr.len > ECODE_MAX_LEN_WITH_BUFFER) assertpro(ECODE_MAX_LEN_WITH_BUFFER >= ecode_mstr.len);
GTMASSERT;
ecode_add(&ecode_mstr); ecode_add(&ecode_mstr);
} }

View File

@ -21,6 +21,15 @@
#include <sys/types.h> #include <sys/types.h>
#include <errno.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) \ #define ACCEPT_SOCKET(SOCKET, ADDR, LEN, RC) \
{ \ { \
@ -278,4 +287,27 @@
} while (-1 == RC && EINTR == errno); \ } 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 #endif

View File

@ -25,8 +25,6 @@
GBLREF stack_frame *frame_pointer; GBLREF stack_frame *frame_pointer;
GBLREF mident routine_name; GBLREF mident routine_name;
GBLREF char window_token;
GBLREF mident window_ident;
error_def(ERR_LABELEXPECTED); error_def(ERR_LABELEXPECTED);
error_def(ERR_RTNNAME); 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; mstr rtn_str, lbl_str;
triple *ref, *next, *rettrip; triple *ref, *next, *rettrip;
boolean_t same_rout; boolean_t same_rout;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
rtnname.len = labname.len = 0; rtnname.len = labname.len = 0;
rtnname.addr = &rtn_text[0]; rtnname.addr = &rtn_text[0];
labname.addr = &lab_text[0]; labname.addr = &lab_text[0];
@ -49,16 +49,16 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
* known use of textname TRUE - in m_zgoto). * known use of textname TRUE - in m_zgoto).
*/ */
assert(!(can_commarg && textname)); assert(!(can_commarg && textname));
switch (window_token) switch (TREF(window_token))
{ {
case TK_INTLIT: case TK_INTLIT:
int_label(); int_label();
/* caution: fall through */ /* caution: fall through */
case TK_IDENT: case TK_IDENT:
memcpy(labname.addr, window_ident.addr, window_ident.len); memcpy(labname.addr, (TREF(window_ident)).addr, (TREF(window_ident)).len);
labname.len = window_ident.len; labname.len = (TREF(window_ident)).len;
advancewindow(); advancewindow();
if ((TK_PLUS != window_token) && (TK_CIRCUMFLEX != window_token) && !IS_MCODE_RUNNING && can_commarg) if ((TK_PLUS != TREF(window_token)) && (TK_CIRCUMFLEX != TREF(window_token)) && !IS_MCODE_RUNNING && can_commarg)
{ {
rettrip = newtriple(op1); rettrip = newtriple(op1);
rettrip->operand[0] = put_mlab(&labname); rettrip->operand[0] = put_mlab(&labname);
@ -69,7 +69,7 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
case TK_ATSIGN: case TK_ATSIGN:
if(!indirection(&label)) if(!indirection(&label))
return NULL; return NULL;
if ((TK_PLUS != window_token) && (TK_CIRCUMFLEX != window_token) && (TK_COLON != window_token) if ((TK_PLUS != TREF(window_token)) && (TK_CIRCUMFLEX != TREF(window_token)) && (TK_COLON != TREF(window_token))
&& can_commarg) && can_commarg)
{ {
rettrip = ref = maketriple(OC_COMMARG); rettrip = ref = maketriple(OC_COMMARG);
@ -88,21 +88,21 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
label.oprclass = 0; label.oprclass = 0;
break; break;
} }
if (!labref && (TK_PLUS == window_token)) if (!labref && (TK_PLUS == TREF(window_token)))
{ /* Have line offset specified */ { /* Have line offset specified */
advancewindow(); advancewindow();
if (!intexpr(&offset)) if (EXPR_FAIL == expr(&offset, MUMPS_INT))
return NULL; return NULL;
} else } else
offset.oprclass = 0; offset.oprclass = 0;
if (TK_CIRCUMFLEX == window_token) if (TK_CIRCUMFLEX == TREF(window_token))
{ /* Have a routine name specified */ { /* Have a routine name specified */
advancewindow(); advancewindow();
switch(window_token) switch (TREF(window_token))
{ {
case TK_IDENT: case TK_IDENT:
MROUT2XTERN(window_ident.addr, rtnname.addr, window_ident.len); MROUT2XTERN((TREF(window_ident)).addr, rtnname.addr, (TREF(window_ident)).len);
rtn_str.len = rtnname.len = window_ident.len; rtn_str.len = rtnname.len = (TREF(window_ident)).len;
rtn_str.addr = rtnname.addr; rtn_str.addr = rtnname.addr;
advancewindow(); advancewindow();
if (!IS_MCODE_RUNNING) if (!IS_MCODE_RUNNING)
@ -154,7 +154,6 @@ triple *entryref(opctype op1, opctype op2, mint commargcode, boolean_t can_comma
} else } else
routine = put_str(rtn_str.addr, rtn_str.len); routine = put_str(rtn_str.addr, rtn_str.len);
} }
} else } else
{ /* Triples for normal compiled code */ { /* Triples for normal compiled code */
routine = put_str(rtn_str.addr, rtn_str.len); routine = put_str(rtn_str.addr, rtn_str.len);

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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * 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 */ LITREF err_ctl lperrors_ctl; /* Roger thinks that this one may be obsolete */
#endif #endif
const err_ctl *err_check(int errnum) STATICDEF const err_ctl *all_errors[] = {&merrors_ctl, &gdeerrors_ctl, &cmierrors_ctl, &cmerrors_ctl,
{
const err_ctl *all_errors[] = {&merrors_ctl, &gdeerrors_ctl, &cmierrors_ctl, &cmerrors_ctl,
#ifdef VMS #ifdef VMS
&laerrors_ctl, &lperrors_ctl, &laerrors_ctl, &lperrors_ctl,
#endif #endif
NULL}; NULL};
const err_ctl *err_check(int errnum)
{
const err_ctl *fac; const err_ctl *fac;
int errtype; int errtype;
if (0 > errnum) if (0 > errnum)
return 0; return NULL;
for (errtype = 0; all_errors[errtype]; errtype++) for (errtype = 0; all_errors[errtype]; errtype++)
{ {
fac = all_errors[errtype]; fac = all_errors[errtype];
if ((errnum & FACMASK(fac->facnum)) && if ((errnum & FACMASK(fac->facnum))
((MSGMASK(errnum, fac->facnum)) <= fac->msg_cnt)) && ((MSGMASK(errnum, fac->facnum)) <= fac->msg_cnt))
return fac; return fac;
} }
return NULL; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -12,6 +12,7 @@
#define ERROR_TRAP_H #define ERROR_TRAP_H
#define IS_ETRAP (err_act == &dollar_etrap.str) #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_ECODE_MAXINDEX 32 /* maximum of 32 ecodes in $ECODE */
#define DOLLAR_STACK_MAXINDEX 256 /* maximum of 256 levels will be stored for $STACK(level) */ #define DOLLAR_STACK_MAXINDEX 256 /* maximum of 256 levels will be stored for $STACK(level) */
@ -90,6 +91,7 @@ typedef struct
GBLREF stack_frame *error_frame; \ GBLREF stack_frame *error_frame; \
\ \
error_frame = NULL; \ 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 /* Set "error_frame" to point to "frame_pointer" and mark it as an error frame type. This is an indication that
@ -101,9 +103,13 @@ typedef struct
\ \
fp->flags |= SFF_ETRAP_ERR; \ fp->flags |= SFF_ETRAP_ERR; \
error_frame = fp; \ 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 \ #define INVOKE_ERROR_RET_IF_NEEDED \
{ \ { \
GBLREF dollar_ecode_type dollar_ecode; \ 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. \ { /* this is an error frame and $ECODE is non-NULL during QUIT out of this frame. \
* rethrow the error at lower level */ \ * rethrow the error at lower level */ \
(*dollar_ecode.error_return_addr)(); \ (*dollar_ecode.error_return_addr)(); \
/* We dont expect the above call to return in Unix since we either rethrow \ /* While error_return does not usually return in UNIX, it can if we are \
* the error or do a MUM_TSTART which unwinds the C-stack. But in VMS, we dont \ * 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 \ * 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);) \ VMS_ONLY(assert(SFT_DM & frame_pointer->type);) \
} else \ } else \
{ \ { \
assert(FALSE); \ assert(FALSE & 2); \
NULLIFY_ERROR_FRAME; /* don't know how we reached here. reset it in PRO */ \ NULLIFY_ERROR_FRAME; /* don't know how we reached here. reset it in PRO */ \
} \ } \
} else if (error_frame < frame_pointer) \ } 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 */ \ NULLIFY_ERROR_FRAME; /* don't know how we reached here. reset it in PRO */ \
} \ } \
} \ } \

View File

@ -16,9 +16,6 @@
#include "advancewindow.h" #include "advancewindow.h"
#include "compile_pattern.h" #include "compile_pattern.h"
GBLREF triple *curtchain;
GBLREF char director_token, window_token;
error_def(ERR_EXPR); error_def(ERR_EXPR);
error_def(ERR_RHMISSING); error_def(ERR_RHMISSING);
@ -32,24 +29,26 @@ int eval_expr(oprtype *a)
oprtype x1, x2; oprtype x1, x2;
opctype i; opctype i;
unsigned short type; unsigned short type;
bool ind_pat; boolean_t ind_pat;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
if (!expratom(&x1)) if (!expratom(&x1))
{ /* If didn't already add an error of our own, do so now with catch all expression error */ { /* 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); stx_error(ERR_EXPR);
return EXPR_FAIL; 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 (oc_tab[i].octype & OCT_BOOL)
{ {
if (!TREF(shift_side_effects)) 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; TREF(expr_start) = TREF(expr_start_orig) = ref;
} }
@ -59,11 +58,9 @@ int eval_expr(oprtype *a)
case OC_AND: case OC_AND:
case OC_NOR: case OC_NOR:
case OC_OR: 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; TREF(shift_side_effects) = TRUE;
default:
break;
} }
} }
coerce(&x1, type); coerce(&x1, type);
@ -76,7 +73,7 @@ int eval_expr(oprtype *a)
ref1->operand[1] = put_tref(parm); ref1->operand[1] = put_tref(parm);
ref1 = parm; ref1 = parm;
ref1->operand[0] = x1; ref1->operand[0] = x1;
if (TK_UNDERSCORE != window_token) if (TK_UNDERSCORE != TREF(window_token))
{ {
assert(op_count > 1); assert(op_count > 1);
ref->operand[0] = put_ilit(op_count); ref->operand[0] = put_ilit(op_count);
@ -93,10 +90,10 @@ int eval_expr(oprtype *a)
} }
} else } else
{ {
if ((TK_QUESTION == window_token) || (TK_NQUESTION == window_token)) if ((TK_QUESTION == TREF(window_token)) || (TK_NQUESTION == TREF(window_token)))
{ {
ind_pat = FALSE; ind_pat = FALSE;
if (TK_ATSIGN == director_token) if (TK_ATSIGN == TREF(director_token))
{ {
ind_pat = TRUE; ind_pat = TRUE;
advancewindow(); advancewindow();
@ -120,5 +117,5 @@ int eval_expr(oprtype *a)
x1 = put_tref(ref); x1 = put_tref(ref);
} }
*a = x1; *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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -24,26 +24,26 @@ void ex_tail(oprtype *opr)
opctype c; opctype c;
unsigned short w; unsigned short w;
assert(opr->oprclass == TRIP_REF); assert(TRIP_REF == opr->oprclass);
t = opr->oprval.tref; t = opr->oprval.tref;
c = t->opcode; c = t->opcode;
w = oc_tab[c].octype; w = oc_tab[c].octype;
if (w & OCT_EXPRLEAF) if (w & OCT_EXPRLEAF)
return; return;
assert(t->operand[0].oprclass == TRIP_REF); assert(TRIP_REF == t->operand[0].oprclass);
assert(t->operand[1].oprclass == TRIP_REF || t->operand[1].oprclass == 0); assert((TRIP_REF == t->operand[1].oprclass) || (NOCLASS == t->operand[1].oprclass));
if (!(w & OCT_BOOL)) if (!(w & OCT_BOOL))
{ {
for (i = t->operand ; i < ARRAYTOP(t->operand); i++) for (i = t->operand; ARRAYTOP(t->operand) > i; i++)
if (i->oprclass == TRIP_REF) if (TRIP_REF == i->oprclass)
ex_tail(i); 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; opr->oprval.tref = t1;
} else } 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; t2 = t1->operand[0].oprval.tref;
if (!(oc_tab[t2->opcode].octype & OCT_BOOL)) if (!(oc_tab[t2->opcode].octype & OCT_BOOL))
break; break;
@ -52,15 +52,15 @@ void ex_tail(oprtype *opr)
dqins(t1->exorder.bl, exorder, bitrip); dqins(t1->exorder.bl, exorder, bitrip);
t2 = t->exorder.fl; t2 = t->exorder.fl;
assert(&t2->operand[0] == opr); assert(&t2->operand[0] == opr);
assert(t2->opcode == OC_COMVAL || t2->opcode == OC_COMINT); assert((OC_COMVAL == t2->opcode) || (OC_COMINT == t2->opcode));
if (t2->opcode == OC_COMINT) if (OC_COMINT == t2->opcode)
dqdel(t2,exorder); dqdel(t2, exorder);
t1 = maketriple(OC_BOOLFINI); t1 = maketriple(OC_BOOLFINI);
t1->operand[0] = put_tref(bitrip); t1->operand[0] = put_tref(bitrip);
opr->oprval.tref = bitrip; opr->oprval.tref = bitrip;
dqins(t, exorder, t1); dqins(t, exorder, t1);
i = (oprtype *) mcalloc(SIZEOF(oprtype)); i = (oprtype *)mcalloc(SIZEOF(oprtype));
bx_tail(t,(bool) FALSE, i); bx_tail(t, FALSE, i);
*i = put_tnxt(t1); *i = put_tnxt(t1);
} }
return; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -56,9 +56,11 @@ void exfun_frame (void)
rts_error(VARLSTCNT(1) ERR_STACKCRIT); rts_error(VARLSTCNT(1) ERR_STACKCRIT);
} }
sf->temps_ptr = msp; sf->temps_ptr = msp;
assert (msp < stackbase); assert(msp < stackbase);
memset (msp, 0, sf->rvector->temp_size); memset(msp, 0, sf->rvector->temp_size);
sf->for_ctrl_stack = NULL; sf->for_ctrl_stack = NULL;
sf->ret_value = NULL;
sf->dollar_test = -1;
sf->old_frame_pointer = frame_pointer; sf->old_frame_pointer = frame_pointer;
frame_pointer = sf; frame_pointer = sf;
assert((frame_pointer < frame_pointer->old_frame_pointer) || (NULL == frame_pointer->old_frame_pointer)); assert((frame_pointer < frame_pointer->old_frame_pointer) || (NULL == frame_pointer->old_frame_pointer));

View File

@ -18,8 +18,6 @@
#define INDIR_DUMMY -1 #define INDIR_DUMMY -1
GBLREF char window_token;
error_def(ERR_ACTOFFSET); error_def(ERR_ACTOFFSET);
int exfunc(oprtype *a, boolean_t alias_target) 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) # if defined(USHBIN_SUPPORTED) || defined(VMS)
triple *tripsize; triple *tripsize;
# endif # endif
DCL_THREADGBL_ACCESS;
assert(TK_DOLLAR == window_token); SETUP_THREADGBL_ACCESS;
assert(TK_DOLLAR == TREF(window_token));
advancewindow(); advancewindow();
dqinit(&tmpchain, exorder); dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain); oldchain = setcurtchain(&tmpchain);
@ -100,7 +100,7 @@ int exfunc(oprtype *a, boolean_t alias_target)
ref0->operand[0] = calltrip->operand[1]; ref0->operand[0] = calltrip->operand[1];
calltrip->operand[1] = put_tref(ref0); calltrip->operand[1] = put_tref(ref0);
} }
if (TK_LPAREN != window_token) if (TK_LPAREN != TREF(window_token))
{ {
masktrip = newtriple(OC_PARAMETER); masktrip = newtriple(OC_PARAMETER);
counttrip = 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -12,30 +12,35 @@
#include "mdef.h" #include "mdef.h"
#include "compiler.h" #include "compiler.h"
#include "opcode.h" #include "opcode.h"
#include "fullbool.h"
int expr(oprtype *a) int expr(oprtype *a, int m_type)
{ {
triple *triptr; int rval;
int4 rval;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
if (!(TREF(expr_depth))++) if (!(TREF(expr_depth))++)
TREF(expr_start) = TREF(expr_start_orig) = NULL; 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; TREF(expr_depth) = 0;
return FALSE; return FALSE;
} }
coerce(a,OCT_MVAL); coerce(a, (MUMPS_INT == m_type) ? OCT_MINT : OCT_MVAL);
ex_tail(a); ex_tail(a);
if (!(--(TREF(expr_depth))))
TREF(shift_side_effects) = FALSE;
if (TREF(expr_start) != TREF(expr_start_orig)) if (TREF(expr_start) != TREF(expr_start_orig))
{ {
triptr = newtriple(OC_GVRECTARG); assert(TREF(shift_side_effects));
triptr->operand[0] = put_tref(TREF(expr_start)); 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; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -14,12 +14,12 @@
#include "opcode.h" #include "opcode.h"
#include "toktyp.h" #include "toktyp.h"
GBLREF char window_token;
int expratom(oprtype *a) int expratom(oprtype *a)
{ {
DCL_THREADGBL_ACCESS;
switch(window_token) SETUP_THREADGBL_ACCESS;
switch(TREF(window_token))
{ {
case TK_IDENT: case TK_IDENT:
case TK_CIRCUMFLEX: 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -10,27 +10,21 @@
****************************************************************/ ****************************************************************/
#include "mdef.h" #include "mdef.h"
#include "compiler.h" #include "compiler.h"
#include "svnames.h" #include "mdq.h"
#include "opcode.h" #include "opcode.h"
#include "toktyp.h" #include "toktyp.h"
#include "svnames.h"
#include "nametabtyp.h" #include "nametabtyp.h"
#include "funsvn.h" #include "funsvn.h"
#include "advancewindow.h" #include "advancewindow.h"
#include "mdq.h"
#include "stringpool.h" #include "stringpool.h"
#include "namelook.h" #include "namelook.h"
#include "fullbool.h" #include "fullbool.h"
#include "show_source_line.h" #include "show_source_line.h"
GBLREF bool devctlexp; GBLREF bool devctlexp;
GBLREF char director_token;
GBLREF triple *curtchain;
GBLREF boolean_t run_time; GBLREF boolean_t run_time;
GBLREF mident window_ident;
GBLREF mval window_mval;
GBLREF char window_token;
error_def(ERR_BOOLSIDEFFECT); error_def(ERR_BOOLSIDEFFECT);
error_def(ERR_EXPR); error_def(ERR_EXPR);
@ -48,6 +42,21 @@ LITREF mval literal_null;
#define f_char f_zchar #define f_char f_zchar
#endif #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 /* note that svn_index array provides indexes into this array for each letter of the
* alphabet so changes here should be reflected there. * alphabet so changes here should be reflected there.
*/ */
@ -94,6 +103,7 @@ LITDEF nametabent svn_names[] =
,{ 2, "ZL*" } ,{ 2, "ZL*" }
,{ 8, "ZMAXTPTI*" } ,{ 8, "ZMAXTPTI*" }
,{ 3, "ZMO*" } ,{ 3, "ZMO*" }
,{ 5, "ZONLN*"}
,{ 5, "ZPATN" }, {8, "ZPATNUME*" } ,{ 5, "ZPATN" }, {8, "ZPATNUME*" }
,{ 4, "ZPOS*" } ,{ 4, "ZPOS*" }
,{ 5, "ZPROC*" } ,{ 5, "ZPROC*" }
@ -126,7 +136,7 @@ LITDEF nametabent svn_names[] =
LITDEF unsigned char svn_index[27] = { LITDEF unsigned char svn_index[27] = {
0, 0, 0, 0, 2, 8, 8, 8, 10, /* a b c d e f g h i */ 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 */ 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 */ /* 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_ZLEVEL, FALSE, ALL_SYS }
,{ SV_ZMAXTPTIME, TRUE, ALL_SYS } ,{ SV_ZMAXTPTIME, TRUE, ALL_SYS }
,{ SV_ZMODE, FALSE, ALL_SYS } ,{ SV_ZMODE, FALSE, ALL_SYS }
,{ SV_ZONLNRLBK, FALSE, UNIX_OS }
,{ SV_ZPATNUMERIC, FALSE, ALL_SYS }, { SV_ZPATNUMERIC, FALSE, ALL_SYS } ,{ SV_ZPATNUMERIC, FALSE, ALL_SYS }, { SV_ZPATNUMERIC, FALSE, ALL_SYS }
,{ SV_ZPOS, FALSE, ALL_SYS } ,{ SV_ZPOS, FALSE, ALL_SYS }
,{ SV_ZPROC, 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 expritem(oprtype *a)
{ {
int i, index, sv_opcode; int i, index, sv_opcode;
triple *oldchain, *ref, tmpchain, *triptr; triple *oldchain, *ref, tmpchain;
boolean_t parse_warn, save_shift; boolean_t parse_warn;
oprtype x1; oprtype x1;
char source_line_buff[MAX_SRCLINE + SIZEOF(ARROW)];
unsigned char type; unsigned char type;
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
@ -456,42 +466,42 @@ int expritem(oprtype *a)
assert(SIZEOF(svn_names)/SIZEOF(nametabent) == SIZEOF(svn_data)/SIZEOF(svn_data_type)); /* are all SVNs covered? */ 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(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? */ 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(); 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)); assert(MV_IS_NUMERIC(&(TREF(window_mval))));
if (window_mval.mvtype & MV_INT) if ((TREF(window_mval)).mvtype & MV_INT)
window_mval.m[1] = -window_mval.m[1]; (TREF(window_mval)).m[1] = -(TREF(window_mval)).m[1];
else else
window_mval.sgn = 1; (TREF(window_mval)).sgn = 1;
if (TK_NUMLIT == window_token) if (TK_NUMLIT == TREF(window_token))
n2s(&window_mval); n2s(&(TREF(window_mval)));
} else } else
{ {
if (!expratom(&x1)) if (!expratom(&x1))
return FALSE; return FALSE;
coerce(&x1,type); coerce(&x1, type);
ref = newtriple((opctype) i); ref = newtriple((opctype)i);
ref->operand[0] = x1; ref->operand[0] = x1;
*a = put_tref(ref); *a = put_tref(ref);
return TRUE; return TRUE;
} }
} }
switch(i = window_token) /* Note assignment */ switch (i = TREF(window_token)) /* NOTE assignment */
{ {
case TK_INTLIT: case TK_INTLIT:
n2s(&window_mval); n2s(&(TREF(window_mval)));
case TK_NUMLIT: case TK_NUMLIT:
case TK_STRLIT: case TK_STRLIT:
*a = put_lit(&window_mval); *a = put_lit(&(TREF(window_mval)));
advancewindow(); advancewindow();
return TRUE; return TRUE;
case TK_LPAREN: case TK_LPAREN:
advancewindow(); advancewindow();
if (eval_expr(a) && TK_RPAREN == window_token) if (eval_expr(a) && TK_RPAREN == TREF(window_token))
{ {
advancewindow(); advancewindow();
return TRUE; return TRUE;
@ -499,52 +509,26 @@ int expritem(oprtype *a)
stx_error(ERR_RPARENMISSING); stx_error(ERR_RPARENMISSING);
return FALSE; return FALSE;
case TK_DOLLAR: case TK_DOLLAR:
if ((TK_DOLLAR == director_token) || (TK_AMPERSAND == director_token)) if ((TK_DOLLAR == TREF(director_token)) || (TK_AMPERSAND == TREF(director_token)))
{ {
if ((-TRUE == TREF(shift_side_effects)) && !run_time && (FULL_BOOL_WARN == TREF(gtm_fullbool))) ENCOUNTERED_SIDE_EFFECT;
{ /* 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; TREF(temp_subs) = TRUE;
if ((TK_DOLLAR == window_token) ? !exfunc(a, FALSE) : !extern_func(a)) advancewindow();
{ if ((TK_DOLLAR == TREF(window_token)) ? (EXPR_FAIL == exfunc(a, FALSE))
setcurtchain(oldchain); : (EXPR_FAIL == extern_func(a)))
return FALSE; 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 } else
{ {
advancewindow(); advancewindow();
if (TK_IDENT != window_token) if (TK_IDENT != TREF(window_token))
{ {
stx_error(ERR_FCNSVNEXPECTED); stx_error(ERR_FCNSVNEXPECTED);
return FALSE; return FALSE;
} }
parse_warn = FALSE; parse_warn = FALSE;
if (TK_LPAREN == director_token) if (TK_LPAREN == TREF(director_token))
{ {
index = namelook(fun_index, fun_names, window_ident.addr, window_ident.len); index = namelook(fun_index, fun_names, (TREF(window_ident)).addr, (TREF(window_ident)).len);
if (index < 0) if (index < 0)
{ {
STX_ERROR_WARN(ERR_INVFCN); /* sets "parse_warn" to TRUE */ STX_ERROR_WARN(ERR_INVFCN); /* sets "parse_warn" to TRUE */
@ -554,7 +538,7 @@ int expritem(oprtype *a)
if (!VALID_FUN(index)) if (!VALID_FUN(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) } else if ((OC_FNINCR == fun_data[index].opcode) || (OC_FNZCALL == fun_data[index].opcode))
{ /* $INCR is used. This can operate on undefined local variables { /* $INCR is used. This can operate on undefined local variables
* and make them defined. If used in a SET where the left and right * 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 * side of the = operator use this variable (as a subscript on the left
@ -562,12 +546,7 @@ int expritem(oprtype *a)
* error to show up which means we need to set "temp_subs" to TRUE. * error to show up which means we need to set "temp_subs" to TRUE.
*/ */
TREF(temp_subs) = TRUE; TREF(temp_subs) = TRUE;
if ((-TRUE == TREF(shift_side_effects)) && !run_time ENCOUNTERED_SIDE_EFFECT;
&& (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();
@ -585,7 +564,7 @@ int expritem(oprtype *a)
if (!parse_until_rparen_or_space()) if (!parse_until_rparen_or_space())
return FALSE; return FALSE;
} }
if (TK_RPAREN != window_token) if (TK_RPAREN != TREF(window_token))
{ {
stx_error(ERR_RPARENMISSING); stx_error(ERR_RPARENMISSING);
return FALSE; return FALSE;
@ -593,7 +572,7 @@ int expritem(oprtype *a)
advancewindow(); advancewindow();
} else } else
{ {
index = namelook(svn_index, svn_names, window_ident.addr, window_ident.len); index = namelook(svn_index, svn_names, (TREF(window_ident)).addr, (TREF(window_ident)).len);
if (0 > index) if (0 > index)
{ {
STX_ERROR_WARN(ERR_INVSVN); /* sets "parse_warn" to TRUE */ STX_ERROR_WARN(ERR_INVSVN); /* sets "parse_warn" to 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -72,7 +72,9 @@ char *ext2jnl(char *ptr, jnl_record *rec)
muextract_type exttype; muextract_type exttype;
enum jnl_record_type rectype; enum jnl_record_type rectype;
jrec_suffix *suffix; jrec_suffix *suffix;
seq_num strm_seqno;
uint4 nodeflags; uint4 nodeflags;
uint4 strm_num;
DEBUG_ONLY(uint4 tcom_num = 0;) DEBUG_ONLY(uint4 tcom_num = 0;)
ext_stop = ptr + strlen(ptr) + 1; ext_stop = ptr + strlen(ptr) + 1;
@ -200,10 +202,17 @@ char *ext2jnl(char *ptr, jnl_record *rec)
assert(NULL != ptr); assert(NULL != ptr);
ptr = strtok(NULL, "\\"); /* get the client pid field */ ptr = strtok(NULL, "\\"); /* get the client pid field */
assert(NULL != ptr); assert(NULL != ptr);
ptr = strtok(NULL, "\\"); /* get the token or jnl_seqno */ ptr = strtok(NULL, "\\"); /* get the token/jnl_seqno field */
assert(NULL != ptr); assert(NULL != ptr);
rec->jrec_null.jnl_seqno = asc2l((uchar_ptr_t)ptr,STRLEN(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) switch(exttype)
{ {
case MUEXT_NULL: case MUEXT_NULL:
@ -246,7 +255,7 @@ char *ext2jnl(char *ptr, jnl_record *rec)
rec->jrec_set_kill.mumps_node.length = gv_currkey->end; rec->jrec_set_kill.mumps_node.length = gv_currkey->end;
memcpy(rec->jrec_set_kill.mumps_node.text, gv_currkey->base, 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)); 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; temp_reclen += JREC_SUFFIX_SIZE;
reclen = ROUND_UP2(temp_reclen, JNL_REC_START_BNDRY); reclen = ROUND_UP2(temp_reclen, JNL_REC_START_BNDRY);

View File

@ -19,10 +19,8 @@
#include "mmemory.h" #include "mmemory.h"
#endif #endif
GBLREF char director_token;
GBLREF char *lexical_ptr; GBLREF char *lexical_ptr;
GBLREF unsigned char *source_buffer; GBLREF unsigned char *source_buffer;
GBLREF char window_token;
error_def(ERR_RTNNAME); error_def(ERR_RTNNAME);
@ -34,12 +32,12 @@ error_def(ERR_RTNNAME);
/* compiler parse to AVT module for external functions ($&) */ /* compiler parse to AVT module for external functions ($&) */
int extern_func(oprtype *a) int extern_func(oprtype *a)
{ {
boolean_t have_ident;
char *extref; char *extref;
int cnt, actcnt;
mstr extentry, package; mstr extentry, package;
oprtype *nxtopr; oprtype *nxtopr;
triple *calltrip, *ref; triple *calltrip, *ref;
boolean_t have_ident;
int cnt, actcnt;
# ifdef VMS # ifdef VMS
char *extsym, *extern_symbol; char *extsym, *extern_symbol;
oprtype tabent; oprtype tabent;
@ -47,31 +45,31 @@ int extern_func(oprtype *a)
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
assert (TK_AMPERSAND == window_token); assert (TK_AMPERSAND == TREF(window_token));
advancewindow(); advancewindow();
cnt = 0; cnt = 0;
extref = (char *)&source_buffer[TREF(last_source_column) - 1]; extref = (char *)&source_buffer[TREF(last_source_column) - 1];
package.len = 0; package.len = 0;
package.addr = NULL; 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 */ { /* if ident is a package reference, then take it off */
package.addr = extref; package.addr = extref;
package.len = INTCAST(lexical_ptr - extref - 1); 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; extref = lexical_ptr;
advancewindow(); /* get to . */ advancewindow(); /* get to . */
advancewindow(); /* to next token */ advancewindow(); /* to next token */
if (have_ident = (TK_IDENT == window_token)) /* assignment */ if (have_ident = (TK_IDENT == TREF(window_token))) /* NOTE assignment */
advancewindow(); advancewindow();
} else } else
advancewindow(); advancewindow();
} }
if (TK_CIRCUMFLEX == window_token) if (TK_CIRCUMFLEX == TREF(window_token))
{ {
advancewindow(); advancewindow();
if (TK_IDENT == window_token) if (TK_IDENT == TREF(window_token))
{ {
have_ident = TRUE; have_ident = TRUE;
advancewindow(); 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((char *)&source_buffer[TREF(last_source_column) - 1] - extref);
extentry.len = INTCAST(extentry.len > MAX_EXTREF ? MAX_EXTREF : extentry.len); extentry.len = INTCAST(extentry.len > MAX_EXTREF ? MAX_EXTREF : extentry.len);
extentry.addr = extref; extentry.addr = extref;
#ifdef VMS_CASE_SENSITIVE_MACROS # ifdef VMS_CASE_SENSITIVE_MACROS
if (!run_time) if (!run_time)
{ /* this code is disabled because the { /* this code is disabled because the
* external call table macros are not case sensitive * external call table macros are not case sensitive
@ -108,16 +106,16 @@ int extern_func(oprtype *a)
tabent = put_cdlt(&extentry); tabent = put_cdlt(&extentry);
} else } else
{ {
#endif # endif
# ifdef VMS # ifdef VMS
ref = newtriple(OC_FGNLOOKUP); ref = newtriple(OC_FGNLOOKUP);
ref->operand[0] = put_str(package.addr, package.len); ref->operand[0] = put_str(package.addr, package.len);
ref->operand[1] = put_str(extentry.addr, extentry.len); ref->operand[1] = put_str(extentry.addr, extentry.len);
tabent = put_tref(ref); tabent = put_tref(ref);
# endif # endif
#ifdef VMS_CASE_SENSITIVE_MACROS # ifdef VMS_CASE_SENSITIVE_MACROS
} }
#endif # endif
calltrip = maketriple(a ? OC_FNFGNCAL : OC_FGNCAL); calltrip = maketriple(a ? OC_FNFGNCAL : OC_FGNCAL);
nxtopr = &calltrip->operand[1]; nxtopr = &calltrip->operand[1];
ref = newtriple(OC_PARAMETER); ref = newtriple(OC_PARAMETER);
@ -132,7 +130,7 @@ int extern_func(oprtype *a)
nxtopr = &ref->operand[1]; nxtopr = &ref->operand[1];
cnt++; cnt++;
# endif # endif
if (TK_LPAREN != window_token) if (TK_LPAREN != TREF(window_token))
{ {
ref = newtriple(OC_PARAMETER); ref = newtriple(OC_PARAMETER);
ref->operand[0] = put_ilit(0); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -14,21 +14,21 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.h" #include "advancewindow.h"
GBLREF char window_token;
int f_ascii(oprtype *a, opctype op) int f_ascii(oprtype *a, opctype op)
{ {
triple *r; triple *r;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!strexpr(&(r->operand[0]))) if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
r->operand[1] = put_ilit(1); r->operand[1] = put_ilit(1);
else else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(r->operand[1]))) if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT))
return FALSE; return FALSE;
} }
ins_triple(r); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,19 +15,19 @@
#include "indir_enum.h" #include "indir_enum.h"
#include "toktyp.h" #include "toktyp.h"
#include "mdq.h" #include "mdq.h"
#include "fullbool.h"
GBLREF char window_token; error_def(ERR_VAREXPECTED);
int f_data(oprtype *a, opctype op) int f_data(oprtype *a, opctype op)
{ {
triple *oldchain, tmpchain, *r, *triptr; triple *oldchain, *r, tmpchain, *triptr;
error_def(ERR_VAREXPECTED);
DCL_THREADGBL_ACCESS; DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS;
assert(OC_FNDATA == op || OC_FNZDATA == op); assert(OC_FNDATA == op || OC_FNZDATA == op);
r = maketriple(op); r = maketriple(op);
switch (window_token) switch (TREF(window_token))
{ {
case TK_IDENT: case TK_IDENT:
if (!lvn(&(r->operand[0]), OC_SRCHINDX, 0)) if (!lvn(&(r->operand[0]), OC_SRCHINDX, 0))
@ -41,7 +41,8 @@ int f_data(oprtype *a, opctype op)
ins_triple(r); ins_triple(r);
break; break;
case TK_ATSIGN: case TK_ATSIGN:
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); dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain); oldchain = setcurtchain(&tmpchain);

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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,38 +15,35 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.h" #include "advancewindow.h"
GBLREF char window_token; /* $EXTRACT, $ZEXTRACT, and $ZSUBSTR use this compiler routine as all have similar function and identical invocation signatures */
/* 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.
*/
int f_extract(oprtype *a, opctype op) int f_extract(oprtype *a, opctype op)
{ {
triple *first, *last, *r; triple *first, *last, *r;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!strexpr(&(r->operand[0]))) if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE; return FALSE;
first = newtriple(OC_PARAMETER); first = newtriple(OC_PARAMETER);
last = newtriple(OC_PARAMETER); last = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(first); r->operand[1] = put_tref(first);
first->operand[1] = put_tref(last); first->operand[1] = put_tref(last);
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
first->operand[0] = put_ilit(1); first->operand[0] = put_ilit(1);
last->operand[0] = put_ilit((OC_FNZSUBSTR == op) ? MAXPOSINT4 : 1); last->operand[0] = put_ilit((OC_FNZSUBSTR == op) ? MAXPOSINT4 : 1);
} else } else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(first->operand[0]))) if (EXPR_FAIL == expr(&(first->operand[0]), MUMPS_INT))
return FALSE; 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]; last->operand[0] = (OC_FNZSUBSTR == op) ? put_ilit(MAXPOSINT4) : first->operand[0];
else else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(last->operand[0]))) if (EXPR_FAIL == expr(&(last->operand[0]), MUMPS_INT))
return FALSE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.h" #include "advancewindow.h"
GBLREF char window_token; error_def(ERR_COMMA);
int f_find(oprtype *a, opctype op) int f_find(oprtype *a, opctype op)
{ {
triple *delimiter, *start, *r; triple *delimiter, *r, *start;
error_def(ERR_COMMA); DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!strexpr(&(r->operand[0]))) if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_STR))
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
@ -35,14 +36,14 @@ int f_find(oprtype *a, opctype op)
start = newtriple(OC_PARAMETER); start = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(delimiter); r->operand[1] = put_tref(delimiter);
delimiter->operand[1] = put_tref(start); delimiter->operand[1] = put_tref(start);
if (!strexpr(&(delimiter->operand[0]))) if (EXPR_FAIL == expr(&(delimiter->operand[0]), MUMPS_STR))
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
start->operand[0] = put_ilit(1); start->operand[0] = put_ilit(1);
else else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(start->operand[0]))) if (EXPR_FAIL == expr(&(start->operand[0]), MUMPS_INT))
return FALSE; return FALSE;
} }
ins_triple(r); 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -16,26 +16,27 @@
#include "mdq.h" #include "mdq.h"
#include "advancewindow.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; triple *ref, *next, *r;
oprtype z; oprtype z;
error_def(ERR_COMMA); DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!numexpr(&r->operand[0])) if (EXPR_FAIL == expr(&r->operand[0], MUMPS_NUM))
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
} }
advancewindow(); advancewindow();
if (!strexpr(&r->operand[1])) if (EXPR_FAIL == expr(&r->operand[1], MUMPS_STR))
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
ref = newtriple(OC_FORCENUM); ref = newtriple(OC_FORCENUM);
ref->operand[0] = r->operand[0]; ref->operand[0] = r->operand[0];
@ -43,7 +44,7 @@ int f_fnumber( oprtype *a, opctype op)
} else } else
{ {
advancewindow(); advancewindow();
if (!intexpr(&z)) if (EXPR_FAIL == expr(&z, MUMPS_INT))
return FALSE; return FALSE;
ref = newtriple(OC_FNJ3); ref = newtriple(OC_FNJ3);
ref->operand[0] = r->operand[0]; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.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; triple *r, *parm;
error_def(ERR_COMMA); DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */ if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
@ -33,17 +34,16 @@ int f_fnzbitfind( oprtype *a, opctype op)
parm = newtriple(OC_PARAMETER); parm = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(parm); r->operand[1] = put_tref(parm);
advancewindow(); advancewindow();
if (!intexpr(&(parm->operand[0]))) /* truthval */ if (EXPR_FAIL == expr(&(parm->operand[0]), MUMPS_INT)) /* truthval */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
parm->operand[1] = put_ilit(1); parm->operand[1] = put_ilit(1);
else else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(parm->operand[1]))) /* position */ if (EXPR_FAIL == expr(&(parm->operand[1]), MUMPS_INT)) /* position */
return FALSE; return FALSE;
} }
ins_triple(r); ins_triple(r);
*a = put_tref(r); *a = put_tref(r);
return TRUE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -14,25 +14,25 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.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; triple *r;
error_def(ERR_COMMA); DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */ if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
} }
advancewindow(); advancewindow();
if (!intexpr(&(r->operand[1]))) /* position */ if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT)) /* position */
return FALSE; return FALSE;
ins_triple(r); ins_triple(r);
*a = put_tref(r); *a = put_tref(r);
return TRUE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -15,17 +15,18 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.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; triple *r, *parm;
error_def(ERR_COMMA); DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!expr(&(r->operand[0]))) /* bitstring */ if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_EXPR)) /* bitstring */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
@ -33,17 +34,16 @@ int f_fnzbitset( oprtype *a, opctype op)
parm = newtriple(OC_PARAMETER); parm = newtriple(OC_PARAMETER);
r->operand[1] = put_tref(parm); r->operand[1] = put_tref(parm);
advancewindow(); advancewindow();
if (!intexpr(&(parm->operand[0]))) /* position */ if (EXPR_FAIL == expr(&(parm->operand[0]), MUMPS_INT)) /* position */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
{ {
stx_error(ERR_COMMA); stx_error(ERR_COMMA);
return FALSE; return FALSE;
} }
advancewindow(); advancewindow();
if (!intexpr(&(parm->operand[1]))) /* truthval */ if (EXPR_FAIL == expr(&(parm->operand[1]), MUMPS_INT)) /* truthval */
return FALSE; return FALSE;
ins_triple(r); ins_triple(r);
*a = put_tref(r); *a = put_tref(r);
return TRUE; 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 * * This source code contains the intellectual property *
* of its copyright holder(s), and is made available * * of its copyright holder(s), and is made available *
@ -14,24 +14,23 @@
#include "toktyp.h" #include "toktyp.h"
#include "advancewindow.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; triple *r, *parm;
DCL_THREADGBL_ACCESS;
SETUP_THREADGBL_ACCESS;
r = maketriple(op); r = maketriple(op);
if (!intexpr(&(r->operand[0]))) /* size */ if (EXPR_FAIL == expr(&(r->operand[0]), MUMPS_INT)) /* size */
return FALSE; return FALSE;
if (window_token != TK_COMMA) if (TK_COMMA != TREF(window_token))
r->operand[1] = put_ilit(0); r->operand[1] = put_ilit(0);
else else
{ {
advancewindow(); advancewindow();
if (!intexpr(&(r->operand[1]))) /* position */ if (EXPR_FAIL == expr(&(r->operand[1]), MUMPS_INT)) /* position */
return FALSE; return FALSE;
} }
ins_triple(r); ins_triple(r);
*a = put_tref(r); *a = put_tref(r);
return TRUE; return TRUE;

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