Apache Lucene open-source search software
LUCENE-1677: remove src/gcj
Michael McCandless2735779bf652
diff --git a/CHANGES.txt b/CHANGES.txtindex 612d5b5de35..2561ff085c9 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -242,9 +242,9 @@ Changes in runtime behavior22. LUCENE-1677: The global propertyorg.apache.lucene.SegmentReader.class, and- ReadOnlySegmentReader.class, along with the src/gcj/*- specializations for GCJ, are now deprecated, to be removed in- 3.0. (Earwin Burrfoot via Mike McCandless)+ ReadOnlySegmentReader.class are now deprecated, to be removed in+ 3.0. src/gcj/* has been removed. (Earwin Burrfoot via Mike+ McCandless)23. LUCENE-1673: Deprecated NumberTools in favour of the newNumericRangeQuery and its new indexing format for numeric ordiff --git a/build.xml b/build.xmlindex 7ce7fa56e3b..f0d4f3d385c 100644--- a/build.xml+++ b/build.xml@@ -219,12 +219,6 @@</compile></target>- <!-- GCJ -->- <target name="gcj" depends="jar,jar-demo">- <exec executable="make" dir="src/gcj" failonerror="true"/>- </target>--<!-- TODO: Remove dependency on demo from test --><target name="compile-test" depends="compile-demo,common.compile-test"/>diff --git a/src/gcj/Makefile b/src/gcj/Makefiledeleted file mode 100644index 15e0e2b53ff..00000000000--- a/src/gcj/Makefile+++ /dev/null@@ -1,123 +0,0 @@-# Makefile for Lucene GCJ code-#-# Usually invoked by Ant. Requires that core classes & jars are already built.--ROOT=../..-BUILD=$(ROOT)/build-DEST=$(BUILD)/gcj-CORE=$(BUILD)/classes/java-SRC=.--CORE_OBJ:=$(subst .jar,.a,$(wildcard $(BUILD)/lucene-core-[0-9]*.jar))-CORE_JAVA:=$(shell find $(ROOT)/src/java -name '*.java')--CORE_HEADERS=\- $(CORE)/org/apache/lucene/store/IndexInput.h \- $(CORE)/org/apache/lucene/util/BitVector.h \- $(CORE)/org/apache/lucene/index/SegmentTermDocs.h--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)))-JAVA_OBJ:=$(DEST)/lucene-gcj.a--CNI:=$(wildcard $(SRC)/org/apache/lucene/*/*.cc)-CNI_OBJ:=$(subst $(SRC)/,$(DEST)/,$(subst .cc,.o,$(CNI)))--GCJ ?= gcj-GCJH ?= gcjh-GPLUSPLUS ?= g++--CFLAGS ?= -O3 -ffast-math-GCJFLAGS ?= $(CFLAGS) -fno-bounds-check -fno-store-check--ifdef PROFILE_ARCS- CFLAGS += -fprofile-arcs-endif--ifdef BRANCH_PROBABILITIES- CFLAGS += -fbranch-probabilities-endif--LIBS = -lstdc++--# default rule builds command line executables-all: $(BUILD)/indexFiles $(BUILD)/searchFiles--# 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.-# NOTE: Change when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15501 is fixed.-$(CORE_OBJ) : $(CORE_JAVA)- $(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 $@ $<--# 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)/,,$<)))--# generate object code for c++ code using g++-$(DEST)/%.o : $(SRC)/%.cc $(DEST)/%.h $(CORE_HEADERS) $(JAVA_HEADERS)- $(GPLUSPLUS) $(CFLAGS) -c -I $(CORE) -I $(DEST) -o $@ $<--# generate class from java using gcj-$(DEST)/%.class : $(SRC)/%.java- 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)/%.cc : $(DEST)/%.class- $(GCJH) -stubs --classpath=$(DEST) -d $(DEST) \- $(subst /,.,$(subst .class,,$(subst $(DEST)/,,$<)))--# generate assembly code from c++ code for perusal-$(DEST)/%.s : $(SRC)/%.cc $(DEST)/%.h $(CORE_HEADERS) $(JAVA_HEADERS)- $(GPLUSPLUS) $(CFLAGS) -S -I $(CORE) -I $(DEST) -o $@ $<--# list of all object code to be linked-OBJ = $(CORE_OBJ) $(DEMO_OBJ) $(JAVA_OBJ) $(CNI_OBJ)--USE_GCJ_DIRECTORY =\- -Dorg.apache.lucene.FSDirectory.class=org.apache.lucene.store.GCJDirectory--USE_GCJ_SEGMENT_READER =\- -Dorg.apache.lucene.SegmentReader.class=org.apache.lucene.index.GCJSegmentReader--PROPS = $(USE_GCJ_DIRECTORY) $(USE_GCJ_SEGMENT_READER)--# link together various applications-$(BUILD)/indexFiles: $(OBJ)- $(GCJ) $(GCJFLAGS) $(PROPS) $(LIBS) $^ -o $@ \- --main=org.apache.lucene.demo.IndexFiles--$(BUILD)/searchFiles: $(OBJ)- $(GCJ) $(GCJFLAGS) $(PROPS) $(LIBS) $^ -o $@ \- --main=org.apache.lucene.demo.SearchFiles--# remove generated files-clean:- rm -rf $(DEST) $(BUILD)/{*.a,indexFiles,searchFiles}-diff --git a/src/gcj/org/apache/lucene/index/GCJSegmentReader.java b/src/gcj/org/apache/lucene/index/GCJSegmentReader.javadeleted file mode 100644index 07ea300e7ee..00000000000--- a/src/gcj/org/apache/lucene/index/GCJSegmentReader.java+++ /dev/null@@ -1,37 +0,0 @@-package org.apache.lucene.index;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.io.IOException;--import org.apache.lucene.store.GCJIndexInput;--// @deprecated This will be removed in 3.0.-class GCJSegmentReader extends SegmentReader {-- /** Try to use an optimized native implementation of TermDocs. The optimized- * implementation can only be used when the segment's directory is a- * GCJDirectory and it is not in compound format. */- public final TermDocs termDocs() throws IOException {- if (freqStream instanceof GCJIndexInput) { // it's a GCJIndexInput- return new GCJTermDocs(this); // so can use GCJTermDocs- } else {- return super.termDocs();- }- }-}diff --git a/src/gcj/org/apache/lucene/index/GCJTermDocs.cc b/src/gcj/org/apache/lucene/index/GCJTermDocs.ccdeleted file mode 100644index 44e7e613383..00000000000--- a/src/gcj/org/apache/lucene/index/GCJTermDocs.cc+++ /dev/null@@ -1,56 +0,0 @@-// This file was created by `gcjh -stubs'. -*- c++ -*--//-// This file is intended to give you a head start on implementing native-// methods using CNI.-// Be aware: running `gcjh -stubs ' once more for this class may-// overwrite any edits you have made to this file.--#include <org/apache/lucene/index/GCJTermDocs.h>-#include <org/apache/lucene/store/GCJIndexInput.h>-#include <org/apache/lucene/store/IndexInput.h>-#include <org/apache/lucene/util/BitVector.h>--#include <gcj/cni.h>-#include <gcj/array.h>--using namespace ::std;-using namespace ::java::io;-using namespace ::gnu::gcj;-using namespace ::org::apache::lucene::index;-using namespace ::org::apache::lucene::store;--#define RAW(X) reinterpret_cast< RawData*>(X)-#define BYTES(X) reinterpret_cast< jbyte *>(X)--inline jint readVInt(jbyte*& bytes) {- jbyte b = *(bytes++);- jint i = b & 0x7F;- for (int shift = 7; (b & 0x80) != 0; shift += 7) {- b = *(bytes++);- i |= (b & 0x7F) << shift;- }- return i;-}--jint GCJTermDocs::read(jintArray docs, jintArray freqs) {- jbyte* input = BYTES(((GCJIndexInput*)freqStream)->pointer);- jint length = docs->length;- jint i = 0;- while (i < length && count < df) {- unsigned int docCode = readVInt(input);- doc__ += docCode >> 1; // shift off low bit- if ((docCode & 1) != 0) // if low bit is set- freq__ = 1; // freq is one- else- freq__ = readVInt(input); // else read freq- count++;-- if (deletedDocs == NULL || !deletedDocs->get(doc__)) {- elements(docs)[i] = doc__;- elements(freqs)[i] = freq__;- ++i;- }- }- ((GCJIndexInput*)freqStream)->pointer = RAW(input);- return i;-}diff --git a/src/gcj/org/apache/lucene/index/GCJTermDocs.java b/src/gcj/org/apache/lucene/index/GCJTermDocs.javadeleted file mode 100644index d96e2cba923..00000000000--- a/src/gcj/org/apache/lucene/index/GCJTermDocs.java+++ /dev/null@@ -1,30 +0,0 @@-package org.apache.lucene.index;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.io.IOException;--// @deprecated This will be removed in 3.0.-class GCJTermDocs extends SegmentTermDocs {- public GCJTermDocs(SegmentReader parent) {- super(parent);- }-- public native int read(final int[] docs, final int[] freqs)- throws IOException;-}diff --git a/src/gcj/org/apache/lucene/store/GCJDirectory.java b/src/gcj/org/apache/lucene/store/GCJDirectory.javadeleted file mode 100644index df63bda2423..00000000000--- a/src/gcj/org/apache/lucene/store/GCJDirectory.java+++ /dev/null@@ -1,38 +0,0 @@-package org.apache.lucene.store;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.io.IOException;-import java.io.File;--/** Native file-based {@link Directory} implementation, using GCJ.- * @deprecated This will be removed in 3.0.- */-public class GCJDirectory extends FSDirectory {-- public IndexInput openInput(String name) throws IOException {- // conserve address space by only mmapping the one index file that most- // impacts performance- if (name.endsWith(".frq")) {- return new GCJIndexInput(new File(getFile(), name).getPath());- } else {- return super.openInput(name);- }- }-}-diff --git a/src/gcj/org/apache/lucene/store/GCJIndexInput.cc b/src/gcj/org/apache/lucene/store/GCJIndexInput.ccdeleted file mode 100644index 31421dad849..00000000000--- a/src/gcj/org/apache/lucene/store/GCJIndexInput.cc+++ /dev/null@@ -1,104 +0,0 @@-#include <org/apache/lucene/store/GCJIndexInput.h>-#include <gnu/gcj/RawData.h>-#include <java/io/IOException.h>-#include <gcj/cni.h>-#include <sys/types.h>-#include <sys/stat.h>-#include <fcntl.h>-#include <sys/mman.h>-#include <errno.h>-#include <unistd.h>-#include <iostream>--using namespace ::std;-using namespace ::java::io;-using namespace ::gnu::gcj;-using namespace ::org::apache::lucene::store;--#define RAW(X) reinterpret_cast< RawData*>(X)-#define BYTES(X) reinterpret_cast< jbyte *>(X)--void GCJIndexInput::open() {-- // convert the Java String file name to a char*- char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (file) + 1);- jsize total = JvGetStringUTFRegion (file, 0, file->length(), buf);- buf[total] = '\0';-- // open the file- fd = ::open (buf, O_RDONLY);- if (fd < 0)- throw new IOException(JvNewStringLatin1(strerror(errno)));-- // stat it- struct stat sb;- if (::fstat (fd, &sb))- throw new IOException(JvNewStringLatin1(strerror(errno)));-- // get length from stat- fileLength = sb.st_size;-- // mmap the file- // cout << "mmapping " << buf << "\n";- void* address = ::mmap(0, fileLength, PROT_READ, MAP_SHARED, fd, 0);- if (address == MAP_FAILED)- throw new IOException(JvNewStringLatin1(strerror(errno)));-- // initialize pointer to the start of the file- data = RAW(address);- pointer = data;-}---jbyte GCJIndexInput::readByte() {--// if (getFilePointer() >= fileLength)-// throw new IOException(JvNewStringLatin1("EOF"));-- //return *(BYTES(pointer)++);- jbyte* bytes = BYTES(pointer);- jbyte byte = *(bytes++);- pointer = RAW(bytes);- return byte;-}---void GCJIndexInput::readBytes(jbyteArray buffer, jint start, jint length) {- memcpy(elements(buffer)+start, pointer, length);-- // BYTES(pointer) += length;- jbyte* bytes = BYTES(pointer);- bytes += length;- pointer = RAW(bytes);-}--jint GCJIndexInput::readVInt() {--// if (getFilePointer() >= fileLength)-// throw new IOException(JvNewStringLatin1("EOF"));-- jbyte* bytes = BYTES(pointer);- jbyte b = *(bytes++);- jint i = b & 0x7F;- for (int shift = 7; (b & 0x80) != 0; shift += 7) {- b = *(bytes++);- i |= (b & 0x7F) << shift;- }- pointer = RAW(bytes);- return i;-}--void GCJIndexInput::doClose() {- ::munmap(data, fileLength);- ::close(fd);-}---jlong GCJIndexInput::getFilePointer() {- return BYTES(pointer) - BYTES(data);-}---void GCJIndexInput::seek(jlong offset) {- pointer = RAW(BYTES(data) + offset);-}diff --git a/src/gcj/org/apache/lucene/store/GCJIndexInput.java b/src/gcj/org/apache/lucene/store/GCJIndexInput.javadeleted file mode 100644index a9690a9a77b..00000000000--- a/src/gcj/org/apache/lucene/store/GCJIndexInput.java+++ /dev/null@@ -1,69 +0,0 @@-package org.apache.lucene.store;--/**- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.io.IOException;-import gnu.gcj.RawData;--/** Native file-based {@link IndexInput} implementation, using GCJ.- * @deprecated This will be removed in 3.0.- */-public class GCJIndexInput extends IndexInput {-- private String file;- private int fd;- private long fileLength;- public RawData data;- public RawData pointer;- private boolean isClone;-- public GCJIndexInput(String file) throws IOException {- this.file = file;- open();- }-- private native void open() throws IOException;-- public native byte readByte() throws IOException;-- public native void readBytes(byte[] b, int offset, int len)- throws IOException;-- public native int readVInt() throws IOException;-- public native long getFilePointer();-- public native void seek(long pos) throws IOException;-- public long length() { return fileLength; }-- public Object clone() {- GCJIndexInput clone = (GCJIndexInput)super.clone();- clone.isClone = true;- return clone;- }-- public void close() throws IOException {- if (!isClone)- doClose();- }- private native void doClose() throws IOException;--}--