File: machine.h

package info (click to toggle)
mercury 0.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 18,488 kB
  • ctags: 9,800
  • sloc: objc: 146,680; ansic: 51,418; sh: 6,436; lisp: 1,567; cpp: 1,040; perl: 854; makefile: 450; asm: 232; awk: 203; exp: 32; fortran: 3; csh: 1
file content (55 lines) | stat: -rw-r--r-- 1,546 bytes parent folder | download
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
54
55
/*
** Copyright (C) 1997 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
**
** $Id: machine.h,v 1.6 1997/07/27 14:59:23 fjh Exp $
*/

#ifndef MB_MACHINE_H
#define	MB_MACHINE_H

#define	MB_MAX_REGISTERS	40

#define	MB_MAX_INT_STACK	10000
#define	MB_MAX_INT_HEAP		10000
#define	MB_MAX_CODE		10000

/*
**	XXX: Currently we store full bloated bytecodes in the
**	code area (text segment). This is extremely inefficient.
**	We should alter design a stripped-down streamlined `machine
**	code' that is a minimalist bytecode with all symbolic information
**	stripped out and and placed in tables (`data segment'), and all 
**	labels replaced with offsets into the text segment
*/

/*
** An Address is an index into code, heap, or stack area.
** This should be identical to a pointer since we will need
** to use the same heap as the compiled Mercury when we interface
** with compiled code.
*/
typedef Word
	MB_Address;

typedef struct MB_Machine_struct {

	Word	reg[MB_MAX_REGISTERS];	/* Machine registers */

	Word	maxfr;		/* Top stack frame pointer */
	Word	curfr;		/* Current stack frame pointer */
	Word	ip;		/* Instruction pointer */

	Word	hp;	/* Heap pointer */
	Word	sp;	/* Stack pointer */

	Word	stack[MB_MAX_INT_STACK]; /* Interpreter stack */
	Word	heap[MB_MAX_INT_HEAP];	/* Interpreter heap */

	MB_Bytecode
		code[MB_MAX_CODE];	/* Data area for storing bytecodes */
} MB_Machine;


#endif	/* MB_MACHINE_H */