From ff3815a13aa6a57852f28c789f8a8d22f2a1f26e Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:41:31 +0000 Subject: [PATCH] 2003/11/16 09:03:16 darcs-hash:20040130074131-2ba56-8994cb76eb9d5a10fe21997a409f08816c9f15b8.gz --- Makefile | 24 +++++++++++++++++++----- src/org/xwt/Font.java | 2 +- src/org/xwt/mips/Compiler.java | 2 +- src/org/xwt/mips/ELF.java | 7 +++++-- src/org/xwt/mips/Runtime.java | 6 +++--- src/org/xwt/translators/Freetype.java | 5 +++-- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e057fbd..ea56dea 100644 --- a/Makefile +++ b/Makefile @@ -46,16 +46,24 @@ jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) | include Makefile.upstream # figure out what stuff in org.xwt.plat.* this platform requires (its superclasses) -all_java_sources := $(patsubst src/%.java, build/java/%.java, $(shell find src -name '*.java')) +all_java_sources := $(filter-out build/java/org/xwt/mips/%, $(patsubst src/%.java, build/java/%.java, $(shell find src -name '*.java'))) +all_java_sources += build/java/org/xwt/translators/FreetypeVM.java java_sources := $(all_java_sources) nonplat_java_sources := $(filter-out build/java/org/xwt/plat/%, $(all_java_sources)) plat_java_sources := $(filter build/java/org/xwt/plat/%, $(all_java_sources)) +build/java/org/xwt/translators/FreetypeVM.java: build/res/freetype.mips build/class/org/xwt/mips/Compiler.class + mkdir -p build/java/org/xwt/translators + (echo -e 'package org.xwt.translators;\nimport org.xwt.mips.*;\n'; \ + java -Xint -cp build/class org.xwt.mips.Compiler FreetypeVM build/res/freetype.mips)\ + > $@ + build/java/org/xwt/%.java: src/org/xwt/%.java make build/class/org/xwt/util/Preprocessor.class @echo -e "\n\033[1mpreprocessing .java -> .java: $<\033[0m" mkdir -p `dirname $@`; java -cp build/class org.xwt.util.Preprocessor < $< > $@ + build/java/%.java: src/%.java ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@ build/cc/%.cc: src/%.c ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@ @@ -68,6 +76,12 @@ build/class/org/xwt/util/Preprocessor.class: src/org/xwt/util/Preprocessor.java mkdir -p build/class/org/xwt/util/ ./.jikes $< +build/class/org/xwt/mips/Compiler.class: src/org/xwt/mips/*.* .jikes + @echo -e "\n\033[1mcompiling .java -> .class: $<\033[0m" + mkdir -p build/class/org/xwt/mips/ + ./.jikes $< + + # this forces a clean build every time because jikes is so damn buggy preprocess: $(all_java_sources) compile: .compile @@ -194,8 +208,8 @@ build/res/freetype.mips: build/mips/org/xwt/translators/Freetype.c.o build/mips/ -Lupstream/freetype-2.1.4/src/objs \ -o $@ \ $^ \ - -Wl,-s \ - -lfreetype + -lfreetype \ +# -Wl,-s \ .install_libmspack-20030726:; make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o @@ -212,8 +226,8 @@ build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/o -Lupstream/libmspack-20030726/build-mips-unknown-elf \ -o $@ \ $^ \ - -Wl,-s \ - -lmspack + -lmspack \ +# -Wl,-s \ diff --git a/src/org/xwt/Font.java b/src/org/xwt/Font.java index 9f1fad4..19c1a5c 100644 --- a/src/org/xwt/Font.java +++ b/src/org/xwt/Font.java @@ -14,7 +14,7 @@ public class Font { public final Res res; public int max_ascent; public int max_descent; - boolean latinCharsPreloaded = true; ///< true if a request to preload ASCII 32-127 has begun + boolean latinCharsPreloaded = false; ///< true if a request to preload ASCII 32-127 has begun Glyph[] glyphs = new Glyph[65535]; public static class Glyph { diff --git a/src/org/xwt/mips/Compiler.java b/src/org/xwt/mips/Compiler.java index ff6369e..80d127c 100644 --- a/src/org/xwt/mips/Compiler.java +++ b/src/org/xwt/mips/Compiler.java @@ -71,7 +71,7 @@ public class Compiler implements Registers { p("// This file was generated by MipsToJava"); if (packageName != null) p("package " + packageName + ";"); - p("public class " + className + " extends Runtime {"); + p("public class " + className + " extends org.xwt.mips.Runtime {"); p(""); p(" // program counter"); p(" private int pc = 0;"); diff --git a/src/org/xwt/mips/ELF.java b/src/org/xwt/mips/ELF.java index 12821f0..2a9b611 100644 --- a/src/org/xwt/mips/ELF.java +++ b/src/org/xwt/mips/ELF.java @@ -143,8 +143,11 @@ public class ELF { } public ELF(Object img) throws IOException, ELFException { - if (img instanceof String) image = new MyRandomAccessFile((String)img,"r"); - image = img; + if (img instanceof String) { + image = fd = new MyRandomAccessFile((String)img, "r"); + } else { + image = img; + } seek(0); header = new ELFHeader(); pheaders = new PHeader[header.phnum]; diff --git a/src/org/xwt/mips/Runtime.java b/src/org/xwt/mips/Runtime.java index 89918a7..be050bf 100644 --- a/src/org/xwt/mips/Runtime.java +++ b/src/org/xwt/mips/Runtime.java @@ -6,9 +6,9 @@ import java.io.*; public abstract class Runtime implements Syscalls, Errno,Registers { /** Pages are 4k in size */ - final static int PAGE_SIZE = 4096; - final static int PAGE_WORDS = (int)(PAGE_SIZE >>> 2); - final static int PAGE_SHIFT = 12; + public final static int PAGE_SIZE = 4096; + public final static int PAGE_WORDS = (int)(PAGE_SIZE >>> 2); + public final static int PAGE_SHIFT = 12; /** There are 65536 pages available for a total of 256mb of addressable memory */ protected final static int TOTAL_PAGES = 65536; /** The top 256 pages are reserved for the stack. Arguments and userdata info use up the first few pages */ diff --git a/src/org/xwt/translators/Freetype.java b/src/org/xwt/translators/Freetype.java index 3079606..f1e11fe 100644 --- a/src/org/xwt/translators/Freetype.java +++ b/src/org/xwt/translators/Freetype.java @@ -15,7 +15,7 @@ public class Freetype { private static byte[] image = null; private int mem_allocated = 0; - private org.xwt.mips.Interpreter vm = null; + private org.xwt.mips.Runtime vm = null; private Res loadedStream = null; @@ -26,7 +26,8 @@ public class Freetype { InputStream is = res.getInputStream(); byte[] fontstream = InputStreamToByteArray.convert(is); if (image == null) image = InputStreamToByteArray.convert(Main.builtin.getInputStream("freetype.mips")); - vm = new org.xwt.mips.Interpreter(image); + //vm = new org.xwt.mips.Interpreter(image); + vm = new FreetypeVM(); int baseAddr = vm.sbrk(fontstream.length); vm.copyout(fontstream, baseAddr, fontstream.length); vm.setUserInfo(0, baseAddr); -- 1.7.10.4