2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2024-07-19 11:43:27 -04:00
|
|
|
* Copyright 2001, 2012 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
|
|
|
|
#include "gtm_string.h"
|
|
|
|
|
|
|
|
#include "advancewindow.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "hashtab_objcode.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
#include "copy.h"
|
|
|
|
#include "indir_enum.h"
|
|
|
|
#include "mvalconv.h"
|
|
|
|
#include "op.h"
|
|
|
|
#include "opcode.h"
|
|
|
|
#include "stringpool.h"
|
|
|
|
#include "toktyp.h"
|
2024-07-19 11:43:27 -04:00
|
|
|
#include <rtnhdr.h>
|
2012-02-05 11:35:58 -05:00
|
|
|
#include "mv_stent.h"
|
|
|
|
|
|
|
|
GBLREF unsigned char *source_buffer;
|
|
|
|
GBLREF short int source_column;
|
|
|
|
GBLREF spdesc stringpool;
|
|
|
|
GBLREF mv_stent *mv_chain;
|
|
|
|
GBLREF unsigned char *msp, *stackwarn, *stacktop;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_STACKOFLOW);
|
|
|
|
error_def(ERR_STACKCRIT);
|
|
|
|
|
2012-02-05 11:35:58 -05:00
|
|
|
void op_indtext(mval *lab, mint offset, mval *rtn, mval *dst)
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
icode_str indir_src;
|
|
|
|
int rval;
|
2012-02-05 11:35:58 -05:00
|
|
|
mstr *obj, object;
|
|
|
|
mval mv_off;
|
2024-07-19 11:43:27 -04:00
|
|
|
oprtype opt, getdst;
|
2012-02-05 11:35:58 -05:00
|
|
|
triple *ref;
|
2012-03-24 14:06:46 -04:00
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
MV_FORCE_STR(lab);
|
|
|
|
indir_src.str.len = lab->str.len;
|
|
|
|
indir_src.str.len += SIZEOF("+^") - 1;
|
|
|
|
indir_src.str.len += MAX_NUM_SIZE;
|
|
|
|
indir_src.str.len += rtn->str.len;
|
|
|
|
ENSURE_STP_FREE_SPACE(indir_src.str.len);
|
|
|
|
DBG_MARK_STRINGPOOL_UNEXPANDABLE; /* Now that we have ensured enough space in the stringpool, we dont expect any more
|
|
|
|
* garbage collections or expansions until we are done with the below initialization.
|
|
|
|
*/
|
|
|
|
/* Push an mval pointing to the complete entry ref on to the stack so the string is valid even
|
2012-03-24 14:06:46 -04:00
|
|
|
* if garbage collection occurs before cache_put
|
|
|
|
*/
|
2012-02-05 11:35:58 -05:00
|
|
|
PUSH_MV_STENT(MVST_MVAL);
|
2012-03-24 14:06:46 -04:00
|
|
|
mv_chain->mv_st_cont.mvs_mval.mvtype = 0; /* so stp_gcol, which may be invoked below, does not get confused by
|
|
|
|
* this otherwise incompletely initialized mval in the M-stack
|
|
|
|
*/
|
2012-02-05 11:35:58 -05:00
|
|
|
mv_chain->mv_st_cont.mvs_mval.str.addr = (char *)stringpool.free;
|
|
|
|
memcpy(stringpool.free, lab->str.addr, lab->str.len);
|
|
|
|
stringpool.free += lab->str.len;
|
|
|
|
*stringpool.free++ = '+';
|
|
|
|
MV_FORCE_MVAL(&mv_off, offset);
|
2012-03-24 14:06:46 -04:00
|
|
|
MV_FORCE_STRD(&mv_off); /* goes at stringpool.free. we already made enough space in the stp_gcol call */
|
2012-02-05 11:35:58 -05:00
|
|
|
*stringpool.free++ = '^';
|
|
|
|
memcpy(stringpool.free, rtn->str.addr, rtn->str.len);
|
|
|
|
stringpool.free += rtn->str.len;
|
|
|
|
mv_chain->mv_st_cont.mvs_mval.str.len = INTCAST(stringpool.free - (unsigned char*)mv_chain->mv_st_cont.mvs_mval.str.addr);
|
|
|
|
mv_chain->mv_st_cont.mvs_mval.mvtype = MV_STR; /* initialize mvtype now that mval has been otherwise completely set up */
|
|
|
|
DBG_MARK_STRINGPOOL_EXPANDABLE; /* Now that we are done with stringpool.free initializations, mark as free for expansion */
|
|
|
|
indir_src.str = mv_chain->mv_st_cont.mvs_mval.str;
|
|
|
|
indir_src.code = indir_text;
|
|
|
|
if (NULL == (obj = cache_get(&indir_src)))
|
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
obj = &object;
|
2024-07-19 11:43:27 -04:00
|
|
|
comp_init(&indir_src.str, &getdst);
|
2012-02-05 11:35:58 -05:00
|
|
|
rval = f_text(&opt, OC_FNTEXT);
|
2024-07-19 11:43:27 -04:00
|
|
|
if (EXPR_FAIL == comp_fini(rval, obj, OC_IRETMVAL, &opt, &getdst, indir_src.str.len))
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(MVST_MVAL == mv_chain->mv_st_type);
|
2012-02-05 11:35:58 -05:00
|
|
|
POP_MV_STENT();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
indir_src.str.addr = mv_chain->mv_st_cont.mvs_mval.str.addr;
|
2012-03-24 14:06:46 -04:00
|
|
|
cache_put(&indir_src, obj);
|
|
|
|
/* Fall into code activation below */
|
2012-02-05 11:35:58 -05:00
|
|
|
}
|
2024-07-19 11:43:27 -04:00
|
|
|
TREF(ind_result) = dst; /* Where to store return value */
|
2012-03-24 14:06:46 -04:00
|
|
|
assert(MVST_MVAL == mv_chain->mv_st_type);
|
2012-02-05 11:35:58 -05:00
|
|
|
POP_MV_STENT(); /* unwind the mval entry before the new frame gets added by comp_indir below */
|
|
|
|
comp_indr(obj);
|
|
|
|
return;
|
|
|
|
}
|