File: indir_lits.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (53 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/****************************************************************
 *								*
 *	Copyright 2001, 2009 Fidelity Information Services, Inc	*
 *								*
 *	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 "compiler.h"
#include "mdq.h"
#include "stringpool.h"
#include <rtnhdr.h>
#include "copy.h"
#include "obj_file.h"
#include "cache.h"

GBLREF mliteral	literal_chain;
GBLREF spdesc	stringpool, indr_stringpool;

void indir_lits(ihdtyp *ihead)
{
	ssize_t		size, lits_pad_len, hdr_pad_len;
	int4		long_temp;
	mliteral	*lit;

	hdr_pad_len = PADLEN(SIZEOF(ihdtyp), NATIVE_WSIZE);
	if (hdr_pad_len) /* additional padding to ihdtyp so that the literal text pool begins at the aligned boundary */
		emit_immed(PADCHARS, (uint4)hdr_pad_len);
	size = indr_stringpool.free - indr_stringpool.base;
	emit_immed((char *)indr_stringpool.base, (uint4)size);
	lits_pad_len = PADLEN(size, NATIVE_WSIZE);	/* Length to pad to put instructions on even bdy */
	if (lits_pad_len)
		emit_immed(PADCHARS, (uint4)lits_pad_len);	/* Pad out with extraneous info */
	size += (SIZEOF(ihdtyp) + hdr_pad_len + lits_pad_len);
	ihead->fixup_vals_off = (int4)(ROUND_UP2(size, NATIVE_WSIZE));
	ihead->fixup_vals_num = 0;
	dqloop(&literal_chain, que, lit)
	{
		if (lit->rt_addr < 0)
		{
			ihead->fixup_vals_num++;
			lit->rt_addr = (INTPTR_T)stringpool.free;
			lit->v.str.addr =  (char *)((lit->v.str.addr - (char *)indr_stringpool.base) +
						SIZEOF(ihdtyp) + hdr_pad_len);
			emit_immed((char *)&lit->v, SIZEOF(mval));
		}
	}
}