/
mk_native_pbc
executable file
·126 lines (114 loc) · 3.47 KB
/
mk_native_pbc
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
# sh tools/dev/mk_native_pbc [--noconf] [config_opts...]
#
# Generate/update t/native_pbc/*_*.pbc
# This should only be run on known systems to regenerate the native pbcs.
# You need at least a multilib 64bit intel and powerpc machine to generate all.
# QEMU images of big-endian 64bit machines are still being worked on,
# still openbios problems on SPARC64 qemu.
#
# Without --noconf all known floatval types are tried to be generated.
# float, double, long double, __float128
#
# NOTE: Installing ccache speeds this process up considerably.
# E.g.
# tools/dev/mk_native_pbc --m=32 --cc='ccache cc' --without-icu
# tools/dev/mk_native_pbc --cc='ccache cc' --without-icu
i_id=
n_id=
conf="$@"
exe=
targets="parrot parrot_config pbc_dump"
initconfig () {
test -e parrot_config || exit
byteorder=$(./parrot_config byteorder)
ptrsize=$(./parrot_config ptrsize)
intvalsize=$(./parrot_config intvalsize)
# 4, 8, 12, 16
numvalsize=$(./parrot_config numvalsize)
hugefloatvalsize=$(./parrot_config hugefloatvalsize)
# 4, 8, 10, 16, 16PPC, 16AIX, 16MIPS
floattype=$(./parrot_config floattype|sed 's,FLOATTYPE_,,')
if [ "$(echo $byteorder|cut -c1-2)" = "12" ]; then
suffix=le
else
suffix=be
fi
i_id=${intvalsize}_${suffix}
n_id=${intvalsize}_${floattype}_${suffix}
}
createpbc () {
for T in integer string
do
./parrot -o t/native_pbc/${T}_${i_id}.pbc t/native_pbc/testdata/${T}.pasm && \
echo "t/native_pbc/${T}_${i_id}.pbc updated"
done
for T in number
do
./parrot -o t/native_pbc/${T}_${n_id}.pbc t/native_pbc/testdata/${T}.pasm && \
echo "t/native_pbc/${T}_${n_id}.pbc updated"
done
}
echo ""
tail -n4 myconfig
echo make -s $targets
make -s $targets || exit 1
initconfig
if [ "$(./parrot_config osname)" = "cygwin" ]; then exe=.exe; fi
if [ "$ptrsize" = "4" -a "$intvalsize" != "4" ]; then
echo "Sorry, unsupported perl - probably using use64bitint. ptrsize/intvalsize mismatch."
exit
fi
createpbc
#make pbc_dump$exe
#./pbc_dump -h t/native_pbc/number_${id}.pbc
perl tools/dev/pbc_header.pl t/native_pbc/number_${n_id}.pbc
perl t/harness t/native_pbc/integer.t t/native_pbc/number.t t/native_pbc/string.t
# reconfigure with various floatvals
reconfig () {
floatval="$1"
shift
make -s prog-clean
echo perl Configure.pl --floatval="$floatval" --nomanicheck $@
perl Configure.pl --floatval="$floatval" $conf --nomanicheck $@
tail -n4 myconfig
echo make -s $targets
make -s $targets || return
initconfig
./parrot -o t/native_pbc/number_${n_id}.pbc t/native_pbc/testdata/number.pasm \
&& echo "t/native_pbc/number_${n_id}.pbc updated"
perl tools/dev/pbc_header.pl t/native_pbc/number_${n_id}.pbc
perl t/harness t/native_pbc/number.t
}
if [ "x$1" != "x--noconf" ]
then
case "$numvalsize" in
"4")
reconfig "double" $conf
reconfig "long double" $conf
reconfig "__float128" $conf
;;
"8")
if [ "$hugefloatvalsize" != "8" ]; then
reconfig "long double" $conf
fi
reconfig "float" $conf
reconfig "__float128" $conf
;;
"12")
reconfig "double" $conf
reconfig "float" $conf
reconfig "__float128" $conf
;;
"16")
reconfig "double" $conf
reconfig "float" $conf
if [ "$floattype" != "16" ]; then
reconfig "__float128" $conf
fi
;;
esac
fi
echo "You should run these commands to update the PBC files in your repo:"
echo "git add t/native_pbc/*.pbc"
echo "git commit -m 'native_pbc platform updates'"