From: adam Date: Tue, 11 May 2004 09:01:15 +0000 (-0700) Subject: added gnuplots X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=commitdiff_plain;h=078ff4840f2024d159a77080e966c7133517c908;hp=3d0b454c857586f3b5e5d35df2d7de709353a6f2 added gnuplots darcs-hash:20040511090115-5007d-c749ab64c542dd42bcafeb486efc795d6f68b9ab.gz --- diff --git a/Makefile b/Makefile index 6d7a771..4d5c279 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,7 @@ runtime.jar: $(runtime_classes:%=build/org/ibex/nestedvm/%.class) $(runtime_classes:%=org/ibex/nestedvm/%.class) \ org/ibex/nestedvm/Runtime\$$*.class \ org/ibex/nestedvm/util/Seekable\$$*.class - + .manifest: echo -ne "Manifest-Version: 1.0\nMain-Class: org.ibex.nestedvm.RuntimeCompiler\n" > $@ @@ -214,7 +214,7 @@ rebuild-constants: $(tasks)/build_newlib s/ *# *define \([A-Z_][A-Za-z0-9_]*\) \([0-9][0-9x]*\)/ public static final int \1 = \2;/p'; \ echo "}"; \ ) > src/org/ibex/nestedvm/UsermodeConstants.java - + # # Tests # These are simply here for convenience. They aren't required @@ -252,7 +252,7 @@ Paranoia_CFLAGS = "-Wno-error" Paranoia_LDFLAGS = -lm paranoiatest: build/tests/Paranoia.class $(JAVA) -cp build tests.Paranoia - + # # Freetype Stuff # @@ -301,7 +301,7 @@ BusyBox_COMPILERFLAGS = -o unixruntime build/tests/BusyBox.mips: $(mips_objects) $(tasks)/build_busybox @mkdir -p `dirname $@` cp upstream/build/busybox/busybox $@ - + busyboxtest: build/tests/BusyBox.class $(JAVA) -cp $(classpath) tests.BusyBox ash @@ -373,9 +373,16 @@ compiletests: $(patsubst %,build/tests/%.class,FTBench MSPackBench DJpeg Test Fr @true +charts := $(shell find doc/charts -name \*.dat) + # IVME Paper -doc/nestedvm.ivme04.pdf: doc/nestedvm.ivme04.tex doc/acmconf.cls - cd doc; pdflatex nestedvm.ivme04.tex && ./pst2pdf && pdflatex nestedvm.ivme04.tex +doc/charts/%.pdf: doc/charts/%.dat doc/charts/%.gnuplot + cd doc/charts; gnuplot $*.gnuplot + cd doc/charts; chmod +x boxfill.pl; ./boxfill.pl -g -o unfilled.eps $*.eps + cd doc/charts; ps2pdf $*.eps + +doc/ivme04.pdf: doc/ivme04.tex doc/acmconf.cls $(charts:%.dat=%.pdf) + cd doc; pdflatex ivme04.tex && ./pst2pdf && pdflatex ivme04.tex -pdf: doc/nestedvm.ivme04.pdf - open doc/nestedvm.ivme04.pdf +pdf: doc/ivme04.pdf + open doc/ivme04.pdf diff --git a/doc/charts/boxfill.pl b/doc/charts/boxfill.pl new file mode 100755 index 0000000..91b8464 --- /dev/null +++ b/doc/charts/boxfill.pl @@ -0,0 +1,259 @@ +#!/usr/bin/perl -w + +# Copyright 2001, Felix Ritter (Felix.Ritter@gmx.de) +# +# Original script (color mode) Copyright 2000, +# Andreas Widmann (widmann@rz.uni-leipzig.de) +# +# This script is free software; permission to use, copy, modify, and +# distribute this software and its documentation for any purpose without +# fee is hereby granted, provided that both the above copyright notice +# and this permission notice appear in all copies and in supporting +# documentation. +# +# This software is provided "as is" without express or implied warranty +# of any kind. + +#introstuff +sub usage_info() { + print "gnuplot-boxfill.pl\n"; + print " fills (and outlines) boxes in gnuplot 3.7.1 postscript files\n"; + print "usage:\n"; + print " gnuplot-boxfill.pl [-c | -g | -p] [-o] [-r] [-z] \n"; + print "options:\n"; + print " -c color fill (default)\n"; + print " -g gray fill\n"; + print " -p pattern fill\n"; + print " -o draw outline\n"; + print " -r remove \"currentpoint stroke M\" (experimental!)\n"; + print " -z outline zero height boxes (experimental!)\n"; + print "arguments:\n"; + print " postscript input file\n"; + print " postscript output file\n"; +} +if ($#ARGV < 1) { + &usage_info(); + exit(0); +} + +$prolog = '/graymode true def + +/BfDict 400 dict def + +/dpiranges [ 2540 2400 1693 1270 1200 635 600 0 ] def +/PatFreq [ 10.5833 10.0 9.4055 10.5833 10.0 10.5833 10.0 9.375 ] def + +/dpi 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt def + +/screenIndex { + 0 1 dpiranges length 1 sub { dup dpiranges exch get 1 sub dpi le {exit} {pop} ifelse } for +} bind def + +/CurColors [ 0 0 0 1 0 0 0 1] def + +/RealSetgray /setgray load def +/RealSetrgbcolor /setrgbcolor load def +/RealSetcmykcolor { + 4 1 roll + 3 { 3 index add 0 max 1 min 1 exch sub 3 1 roll} repeat + RealSetrgbcolor pop +} bind def + +/tintCMYK { + 1 tintGray sub CurColors 0 4 getinterval aload pop + 4 index mul 5 1 roll + 3 index mul 5 1 roll + 2 index mul 5 1 roll + mul 4 1 roll +}bind def +/tintRGB { + 1 tintGray sub CurColors 4 3 getinterval aload pop + 1 exch sub 3 index mul 1 exch sub 4 1 roll + 1 exch sub 2 index mul 1 exch sub 4 1 roll + 1 exch sub mul 1 exch sub 3 1 roll +}bind def +/combineColor { + /tintGray 1 1 CurGray sub CurColors 7 get mul sub def + graymode not { + [/Pattern [/DeviceCMYK]] setcolorspace + tintCMYK CurPat setcolor + } { + CurColors 3 get 1.0 ge { + tintGray RealSetgray + } { + graymode { + tintCMYK + RealSetcmykcolor + } { + tintRGB + RealSetrgbcolor + } ifelse + } ifelse + } ifelse +} bind def + +/patProcDict 5 dict dup begin + <0f1e3c78f0e1c387> { 3 setlinewidth -1 -1 moveto 9 9 lineto stroke + 4 -4 moveto 12 4 lineto stroke + -4 4 moveto 4 12 lineto stroke} bind def + <0f87c3e1f0783c1e> { 3 setlinewidth -1 9 moveto 9 -1 lineto stroke + -4 4 moveto 4 -4 lineto stroke + 4 12 moveto 12 4 lineto stroke} bind def + <8142241818244281> { 1 setlinewidth -1 9 moveto 9 -1 lineto stroke + -1 -1 moveto 9 9 lineto stroke } bind def + <03060c183060c081> { 1 setlinewidth -1 -1 moveto 9 9 lineto stroke + 4 -4 moveto 12 4 lineto stroke + -4 4 moveto 4 12 lineto stroke} bind def + <8040201008040201> { 1 setlinewidth -1 9 moveto 9 -1 lineto stroke + -4 4 moveto 4 -4 lineto stroke + 4 12 moveto 12 4 lineto stroke} bind def +end def +/patDict 15 dict dup begin + /PatternType 1 def + /PaintType 2 def + /TilingType 3 def + /BBox [ 0 0 8 8 ] def + /XStep 8 def + /YStep 8 def + /PaintProc { + begin + patProcDict bstring known { + patProcDict bstring get exec + } { + 8 8 true [1 0 0 -1 0 8] bstring imagemask + } ifelse + end + } bind def +end def + +/setPatternMode { + pop pop + dup patCache exch known { + patCache exch get + } { + dup + patDict /bstring 3 -1 roll put + patDict + 65 PatFreq screenIndex get div dup matrix scale + makepattern + dup + patCache 4 -1 roll 3 -1 roll put + } ifelse + /CurGray 0 def + /CurPat exch def + /graymode false def + combineColor +} bind def +/setGrayScaleMode { + graymode not { + /graymode true def + } if + /CurGray exch def + combineColor +} bind def + +BfDict begin [ + /fillvals +] { 0 def } forall + +/SetPattern { + fillvals exch get + dup type /stringtype eq + {8 1 setPatternMode} + {setGrayScaleMode} + ifelse + } bind def + +/InitPattern { + BfDict begin dup + array /fillvals exch def + dict /patCache exch def + end + } def +/DefPattern { + BfDict begin + fillvals 3 1 roll put + end + } def + +7 InitPattern +0 <03060c183060c081> DefPattern +1 <8040201008040201> DefPattern +2 <0f1e3c78f0e1c387> DefPattern +3 <0f87c3e1f0783c1e> DefPattern +4 <8142241818244281> DefPattern +5 <111111ff111111ff> DefPattern +6 0 DefPattern'; + +$outlinestyle = 'LTb'; +if(grep(/^-o$/, @ARGV) == 1) { $outline = "\ngsave\ncurrentpoint $outlinestyle M redo stroke\ngrestore" } +else { $outline = '' } + +#read input file +open(IN, $ARGV[$#ARGV - 1]) || die "Cannot open $ARGV[$#ARGV - 1]\n"; +$content = join('', ); +close(IN); + +#search patterns +$key = '(-*\d+ -*\d+ M\n)(-*\d+)( -*\d+ V\n)(-*\d+ -*\d+ [RM]\n-*\d+ -*\d+ V\n-*\d+ -*\d+ V\n-*\d+ -*\d+ V\n-*\d+ -*\d+ V\n)'; +#$key = '(-*\d+ -*\d+ M\n)(-*\d+)( -*\d+ V\n)(-*\d+ -*\d+ [RM]\n-*\d+ -*\d+ V\n-*\d+ -*\d+ V\n)'; #experimental +$box = '(?$ARGV[$#ARGV]") || die "Cannot open $ARGV[$#ARGV]\n"; +print OUT "$content"; +close(OUT); diff --git a/doc/charts/chart1.dat b/doc/charts/chart1.dat new file mode 100644 index 0000000..a3d6dcd --- /dev/null +++ b/doc/charts/chart1.dat @@ -0,0 +1,3 @@ +3 59 97 159 256 + + diff --git a/doc/charts/chart1.gnuplot b/doc/charts/chart1.gnuplot new file mode 100644 index 0000000..f4ba07f --- /dev/null +++ b/doc/charts/chart1.gnuplot @@ -0,0 +1,23 @@ +# don't touch this +set terminal postscript landscape color "Helvetica" 19 +set output 'unfilled.eps' + +set yrange [0:300] +set xrange [1.8:4.5] +set data style boxes +set boxwidth 0.4 +set xtics (" " 3) +set xlabel "X Axis Label" +set ylabel "Y Axis Label" +set grid +set label "59" at 2.15, 69 +set label "97" at 2.55, 107 +set label "159" at 2.95, 169 +set label "256" at 3.35, 266 +plot \ + 'chart1.dat' using ($1-0.8):($2) title "x86", \ + 'chart1.dat' using ($1-0.4):($3) title "Sparc", \ + 'chart1.dat' using ($1):($4) title "HPL-PD", \ + 'chart1.dat' using ($1+0.4):($5) title "Canonical" + + diff --git a/doc/nestedvm.ivme04.tex b/doc/ivme04.tex similarity index 96% rename from doc/nestedvm.ivme04.tex rename to doc/ivme04.tex index c6cccbb..b1bfa6d 100644 --- a/doc/nestedvm.ivme04.tex +++ b/doc/ivme04.tex @@ -31,28 +31,36 @@ Complete Translation of Unsafe Native Code to Safe Bytecode \maketitle +{\it This document was typeset using D. E. Knuth's original \TeX 89 + Pascal source code, which was both compiled and executed entirely + within a Java Virtual Machine. No native code was utilized.} + \begin{abstract} Most existing techniques for using code written in an unsafe language within a safe virtual machine involve transformations from one source -code language (such as C) to another (such as Java) and then to -virtual machine bytecodes. We present an alternative approach which -uses a standard compiler to turn unsafe source code into unsafe MIPS -binaries, which are then translated into safe virtual machine -bytecodes. This approach offers four key advantages over existing -techniques: +code language (such as C, Pascal, or Fortran) to another (such as +Java) and then to virtual machine bytecodes. We present an +alternative approach which can translate MIPS binaries produced by any +compiler into safe virtual machine bytecodes. This approach offers +four key advantages over existing techniques: \begin{itemize} -\item Total coverage of all language features +\item Language-agnostic +\item Bug-for-bug compiler compatability \item No post-translation human intervention \item No build process modifications -\item Bug-for-bug compiler compatability \end{itemize} -We have implemented this technique in NestedVM, a binary-to-source and -binary-to-binary translator targeting the Java Virtual Machine. -NestedVM-translated versions of the {\tt libfreetype}, {\tt libjpeg}, -and {\tt libmspack} libraries are currently in production use. +We also present NestedVM, a complete implementation of this technique, +which we have used to translate a number of programs. Six examples +are discussed in this paper: LINPACK (Fortran source), which was used +as one of our performance tests, \TeX (Pascal source), which was used +to typeset this document, {\tt libjpeg}, {\tt libmspack}, and FreeType +(all C source), which are currently in production use as part of the +Ibex Project, and {\tt gcc}, which was used to compile all of the +aforementioned. + Performance measurements indicate a best case performance within 3x of native code and worst case typically within 10x, making it an attractive solution for code which is not performance-critical. @@ -535,7 +543,7 @@ sequences, a straightforward mapping of the general purpose hardware registers to 32 {\tt int} fields turned out to be optimal. -\epsfig{file=chart1,width=3in} +\epsfig{file=charts/chart1,width=3in} Unfortunately, Java imposes a 64kb limit on the size of the bytecode for a single method. This presents a problem for NestedVM, and