Skip to content

Commit

Permalink
Replace the C VM with the RPython VM.
Browse files Browse the repository at this point in the history
The RPython VM will still need work e.g. for portability, but for many
purposes it's now a complete replacement.
  • Loading branch information
ltratt committed Dec 19, 2011
1 parent c43538b commit 84bb9d6
Show file tree
Hide file tree
Showing 175 changed files with 190 additions and 27,365 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -7,7 +7,6 @@
autom4te.cache
config.log
config.status
configure
*.core
*.cvb
*.cvl
Expand Down
3 changes: 0 additions & 3 deletions Makefile.bootstrap

This file was deleted.

7 changes: 3 additions & 4 deletions Makefile.in
Expand Up @@ -29,7 +29,7 @@ clean:
cd manuals && ${MAKE} ${MFLAGS} clean
cd tests && ${MAKE} ${MFLAGS} clean

ifdef TARGET
ifdef CON_TARGET
cross: all
cd lib && ${MAKE} ${MFLAGS} cross
cd compiler && ${MAKE} ${MFLAGS} cross
Expand All @@ -47,16 +47,15 @@ distclean:
cd examples && ${MAKE} ${MFLAGS} distclean
cd manuals && ${MAKE} ${MFLAGS} distclean
cd tests && ${MAKE} ${MFLAGS} distclean
rm -rf autom4te.cache Makefile Makefile.inc configure config.log config.status
rm -rf Makefile Makefile.inc

regress: all
cd examples && ${MAKE} ${MFLAGS} regress
cd tests && ${MAKE} ${MFLAGS} regress

release: distclean
mkdir converge-@CONVERGE_VERSION@
${MAKE} -f Makefile.bootstrap configure
find . -type d | grep -v "\.git" | grep -v "^\.$$" | sed "s/^\..//" | grep -v "^autom4te.cache" | grep -v "converge-@CONVERGE_VERSION@" | xargs -I {} mkdir -p converge-@CONVERGE_VERSION@/{}
find . -type d | grep -v "\.git" | grep -v "^\.$$" | sed "s/^\..//" | grep -v "converge-@CONVERGE_VERSION@" | xargs -I {} mkdir -p converge-@CONVERGE_VERSION@/{}
find . \! -type d | grep -v "\.git" | sed "s/^\..//" | grep -v "^autom4te.cache" | grep -v "config\..*" | grep -v "\.binaries" | grep -v "\.gitignore" | grep -v "\.core$$" | grep -v ".depend$$" | grep -v "converge-@CONVERGE_VERSION@" | xargs -I {} cp -r {} converge-@CONVERGE_VERSION@/{}
tar cfz converge-@CONVERGE_VERSION@.tar.gz converge-@CONVERGE_VERSION@
@echo "\nMake sure that this distribution has the correct version and date!\n @CONVERGE_VERSION@ (@CONVERGE_DATE@)"
Expand Down
2 changes: 1 addition & 1 deletion Makefile.inc.in
@@ -1,4 +1,4 @@
CONVERGE_DIR=@abs_srcdir@
CONVERGE_DIR=@abs_top_srcdir@

CONVERGE_VM_DIR=${CONVERGE_DIR}/vm
CONVERGE_VM=${CONVERGE_VM_DIR}/converge
Expand Down
22 changes: 10 additions & 12 deletions compiler/Makefile.in
@@ -1,7 +1,5 @@
include @abs_top_srcdir@/Makefile.inc

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
conlibdir = ${libdir}/converge-@CONVERGE_VERSION@
Expand Down Expand Up @@ -43,21 +41,21 @@ endif
${INSTALL} -c -m 444 Compiler.cvl ${DESTDIR}${conlibdir}


ifdef TARGET
CROSS_OBJS = ${OBJS:.cvb=.${TARGET}.cvb}
ifdef CON_TARGET
CROSS_OBJS = ${OBJS:.cvb=.${CON_TARGET}.cvb}

%.${TARGET}.cvb: %.cv
${CONVERGE_VM} ${CONVERGEC} -T ${TARGET} -I ${CONVERGE_STDLIB_DIR} -o $@ $<
%.${CON_TARGET}.cvb: %.cv
${CONVERGE_VM} ${CONVERGEC} -T ${CON_TARGET} -I ${CONVERGE_STDLIB_DIR} -o $@ $<

%.${TARGET}.cvb: %
${CONVERGE_VM} ${CONVERGEC} -T ${TARGET} -o $@ $<
%.${CON_TARGET}.cvb: %
${CONVERGE_VM} ${CONVERGEC} -T ${CON_TARGET} -o $@ $<

cross: ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${TARGET}.cvl
${CONVERGE_VM} ${CONVERGEL} -T ${TARGET} -o convergec.${TARGET} convergec.${TARGET}.cvb ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${TARGET}.cvl
${CONVERGE_VM} ${CONVERGEL} -T ${TARGET} -o convergel.${TARGET} convergel.${TARGET}.cvb ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${TARGET}.cvl
cross: ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${CON_TARGET}.cvl
${CONVERGE_VM} ${CONVERGEL} -T ${CON_TARGET} -o convergec.${CON_TARGET} convergec.${CON_TARGET}.cvb ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${CON_TARGET}.cvl
${CONVERGE_VM} ${CONVERGEL} -T ${CON_TARGET} -o convergel.${CON_TARGET} convergel.${CON_TARGET}.cvb ${CROSS_OBJS} ${CONVERGE_LIB_DIR}/Stdlib.${CON_TARGET}.cvl

cross-clean:
rm -f ${CROSS_OBJS} convergec.${TARGET} convergel.${TARGET}
rm -f ${CROSS_OBJS} convergec.${CON_TARGET} convergel.${CON_TARGET}
endif


Expand Down
108 changes: 108 additions & 0 deletions configure
@@ -0,0 +1,108 @@
#! /bin/sh

# If shipping a production release, these two variables should be changed
# to e.g.:
#
# converge_version=0.7
# converge_date=2006/01/04

converge_version=current
converge_date=`date '+%Y/%m/%d %H:%M:%S'`

prefix=""
rpython_opt="jit"
while [ $# -ge 1 ]; do
case $1 in
--prefix=* ) prefix=`echo $1 | sed "s/--prefix=//g"`; shift;;
--opt=* ) rpython_opt=`echo $1 | sed "s/--opt=//g"`; shift;;
* ) echo "Unknown switch $1"; exit 1;;
esac
done

if [[ X$prefix == "X" ]]; then
prefix="/usr/local/"
fi

echo -n "Checking for Python interpreter... "

which pypy-c 2> /dev/null > /dev/null
if [ $? -eq 0 ]; then
PYTHON=`which pypy-c`
elif [ $? -ne 0 ]; then
which python 2> /dev/null > /dev/null
if [ $? -eq 0 ]; then
PYTHON=`which python`
else
echo "not found."
exit 1
fi
fi
echo $PYTHON

echo -n "Checking for RPython translate.py... "
if [[ X$PYPY_SRC != "X" ]]; then
TRANSLATE_PY=$PYPY_SRC/pypy/translator/goal/translate.py
if [[ ! -f $TRANSLATE_PY ]]; then
TRANSLATE_PY=""
fi
fi

if [[ X$TRANSLATE_PY == "X" ]]; then
echo "not found (try setting \$PYPY_SRC)."
fi
echo $TRANSLATE_PY

operating_system=`uname -s`
machine_type=`uname -m`
if [[ $operating_system == "Darwin" && $machine_type == "i386" ]]; then
# On modern Darwin machine it now seems that it's easier to build 64 bit
# binaries than 32 bit. Why? I don't know.
machine_type=x86_64
fi
case $operating_system in
CYGWIN_NT* | MINGW* )
EXEC_EXT=".exe"
DIR_SEP="\\";;
* )
DIR_SEP="/";;
esac

case $machine_type in
i386 | i686 )
bootstrap_dir="bootstrap/32bit_little_endian";;
amd64 | x86_64 )
bootstrap_dir="bootstrap/64bit_little_endian";;
*) echo Unknown machine type "$machine_type"; exit 1;;
esac

echo -n "Copying bootstrap compiler... "

cp -p $bootstrap_dir/convergec.bootstrap compiler/convergec
cp -p $bootstrap_dir/convergel.bootstrap compiler/convergel

echo "done."

echo -n "Writing .in files... "

rewriter=`mktemp`
cat << EOF > $rewriter
import sys
fin=file(sys.argv[1], "r")
d=fin.read(-1)
fin.close()
i = 3
while i < len(sys.argv):
d=d.replace(sys.argv[i], sys.argv[i + 1])
i += 2
fout=file(sys.argv[2], "w")
fout.write(d)
fout.close()
EOF
abs_top_srcdir=`pwd`
for p_in in `find . -name "*.in"`; do
p=`echo $p_in | sed "s/.in$//g"`
$PYTHON $rewriter $p_in $p "@abs_top_srcdir@" "$abs_top_srcdir" "@PYTHON@" "$PYTHON" "@TRANSLATE_PY@" "$TRANSLATE_PY" "@RPYTHON_OPT@" "$rpython_opt" "@prefix@" "$prefix" "@bindir@" "$prefix/bin" "@libdir@" "$prefix/share" "@libdir@" "$prefix/lib" "@INSTALL@" "$abs_top_srcdir/install.sh" "@CONVERGE_VERSION@" "$converge_version" "@CONVERGE_DATE@" "$converge_date" "@PLATFORM@" "$operating_system" "@EXEC_EXT" "$exec_ext" "@DIR_SEP@" "$DIR_SEP"
done
rm -f $rewriter

echo "done."

0 comments on commit 84bb9d6

Please sign in to comment.