lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: jakarta-lucene/src/gcj Makefile
Date Thu, 23 Sep 2004 16:59:10 GMT
cutting     2004/09/23 09:59:10

  Modified:    src/gcj  Makefile
  Compile most of Lucene's core code with a single call to gcj.  This
  permits more cross-class inlining.  In particular, the final method
  PriorityQueue.size() can inline, which speeds things 7.5% in my
  benchmarks.  Note that 'final' declarations *do* sometimes make things
  faster in GCJ.  So let's not remove them all!
  Revision  Changes    Path
  1.3       +44 -20    jakarta-lucene/src/gcj/Makefile
  Index: Makefile
  RCS file: /home/cvs/jakarta-lucene/src/gcj/Makefile,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile	22 Sep 2004 18:32:25 -0000	1.2
  +++ Makefile	23 Sep 2004 16:59:10 -0000	1.3
  @@ -2,23 +2,29 @@
   # Usually invoked by Ant.  Requires that core classes & jars are already built.
  -LUCENE_OBJ=$(subst .jar,.a,$(wildcard $(BUILD)/lucene-*.jar))
  +CORE_OBJ:=$(subst .jar,.a,$(wildcard $(BUILD)/lucene-[0-9]*.jar))
  +CORE_JAVA:=$(shell find $(ROOT)/src/java -name '*.java')
     $(CORE)/org/apache/lucene/store/IndexInput.h \
     $(CORE)/org/apache/lucene/util/BitVector.h \
  -JAVA=$(wildcard $(SRC)/org/apache/lucene/*/*.java)
  -JAVA_HEADERS=$(subst $(SRC)/,$(DEST)/,$(subst .java,.h,$(JAVA)))
  +DEMO_JAR:=$(wildcard $(BUILD)/lucene-demo*.jar)
  +DEMO_OBJ:=$(subst .jar,.a,$(DEMO_JAR))
  +JAVA:=$(wildcard $(SRC)/org/apache/lucene/*/*.java)
  +JAVA_HEADERS:=$(subst $(SRC)/,$(DEST)/,$(subst .java,.h,$(JAVA)))
  -CNI=$(wildcard $(SRC)/org/apache/lucene/*/*.cc)
  -CNI_OBJ=$(subst $(SRC)/,$(DEST)/,$(subst .cc,.o,$(CNI)))
  +CNI:=$(wildcard $(SRC)/org/apache/lucene/*/*.cc)
  +CNI_OBJ:=$(subst $(SRC)/,$(DEST)/,$(subst .cc,.o,$(CNI)))
   CFLAGS ?= -O3 -ffast-math 
   GCJFLAGS ?= $(CFLAGS) -fno-bounds-check -fno-store-check
  @@ -33,43 +39,61 @@
   LIBS = -lstdc++
  -# default rule build's command line executables
  +# default rule builds command line executables
   all: $(BUILD)/indexFiles $(BUILD)/searchFiles
  -# pattern rules to generate various things
  +# Compile Lucene Core code specially
  +# GCJ can do more inlining when it compiles .java files than .class
  +# files, but not all of Lucene's core .java files are yet compilable
  +# by GCJ. (In particular, GCJ has problems with anonymous ctors that
  +# throw exceptions used in the Span and Sort code.)  So we compile
  +# those that GCJ accepts from .java files, and those that GCJ does not
  +# yet accept from .class files.
  +	gcj $(GCJFLAGS) -c -I $(CORE) -o $@ `find $(ROOT)/src/java -name '*.java' -not -name '*Sort*'
-not -name 'Span*'` `find $(CORE) -name '*.class' -name '*Sort*' -or -name 'Span*'`
  +# generate object code from jar files using gcj
   %.a : %.jar
   	gcj $(GCJFLAGS) -c -I $(CORE) -o $@ $<
  -$(DEST)/%.class : $(SRC)/
  -	mkdir -p $(dir $@)
  -	gcj -C -I $(CORE) -d $(DEST) $<
  +# don't delete generated headers -- they're handy for debugging
   .PRECIOUS : $(CORE)/%.h $(DEST)/%.h
  +# generate headers from .class files using gcjh
   $(CORE)/%.h : $(CORE)/%.class
   	gcjh --classpath=$(CORE) -d $(CORE) \
   	 $(subst /,.,$(subst .class,,$(subst $(CORE)/,,$<)))
  +# generate headers from .class files using gcjh
   $(DEST)/%.h : $(DEST)/%.class
   	gcjh --classpath=$(DEST) -d $(DEST) \
   	 $(subst /,.,$(subst .class,,$(subst $(DEST)/,,$<)))
  -$(DEST)/ : $(DEST)/%.class
  -	gcjh -stubs --classpath=$(DEST) -d $(DEST) \
  -	 $(subst /,.,$(subst .class,,$(subst $(DEST)/,,$<)))
  +# generate object code for c++ code using g++
   $(DEST)/%.o : $(SRC)/ $(DEST)/%.h $(CORE_HEADERS) $(JAVA_HEADERS)
   	g++ $(CFLAGS) -c -I $(CORE) -I $(DEST) -o $@ $<
  -$(DEST)/%.s : $(SRC)/ $(DEST)/%.h $(CORE_HEADERS) $(JAVA_HEADERS)
  -	g++ $(CFLAGS) -S -I $(CORE) -I $(DEST) -o $@ $<
  +# generate class from java using gcj
  +$(DEST)/%.class : $(SRC)/
  +	mkdir -p $(dir $@)
  +	gcj -C -I $(CORE) -d $(DEST) $<
  +# generate object code for .java files using gcj
   $(JAVA_OBJ) : $(JAVA)
   	mkdir -p $(dir $@)
   	gcj $(GCJFLAGS) -c -I $(CORE) -I $(DEST) -o $@ $^
  +# generate c++ stubs for a class using gcjh
  +$(DEST)/ : $(DEST)/%.class
  +	gcjh -stubs --classpath=$(DEST) -d $(DEST) \
  +	 $(subst /,.,$(subst .class,,$(subst $(DEST)/,,$<)))
  +# generate assembly code from c++ code for perusal
  +$(DEST)/%.s : $(SRC)/ $(DEST)/%.h $(CORE_HEADERS) $(JAVA_HEADERS)
  +	g++ $(CFLAGS) -S -I $(CORE) -I $(DEST) -o $@ $<
   # list of all object code to be linked

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message