summaryrefslogtreecommitdiff
path: root/ghc/docs/NOTES.arbitary-ints
blob: 964a2cf5be22246c407d73ce990824e9a079d7fa (plain)
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

Boxed structure of BigInts


---->	Info1	Pointer
		|		Pointer passed to BigNum package
	   	|		|
	  	\/		\/
	 	Info2	Size	Integer ....

			(size excludes info ptr & size field)

Unboxed (Compiler must place on pointer stack not data stack
	 Must also tell GC if it is in a register when GC invoked)

---->	Info2	Size	Integer



Info1:
	SPEC_INFO_TABLE(Info1, BigNum_entry, 1, 1);	(Min Size 2 ?)

	Entering this returns the BigNum using agreed return convention

Info2:
	DATA_INFO_TABLE(Info2, Dummy_entry);

	This never actually entered -- just required for GC.

------------------------------------------------------------------------------

Boxed structure of BigInts (the alternative one)

			Pointer passed to BigNum package
	   		|
	  		\/
---->	Info	Size	Integer ....

		(size excludes info ptr & size field)

Unboxed (Compiler must place on pointer stack not data stack
	 Must also tell GC if it is in a register when GC invoked)


Info:
	DATA_INFO_TABLE(Info, BigNum_entry);

	Entering this returns the BigNum using agreed return convention



Note that the Boxed and Unboxed representation are identical !!!

(unboxing represents evaluationhood, not pointerhood)