diff --git a/groovy/groovy-native/README b/groovy/groovy-native/README deleted file mode 100644 index 9049c270e7..0000000000 --- a/groovy/groovy-native/README +++ /dev/null @@ -1,120 +0,0 @@ -This is a proof-of-concept for compiling Groovy to native code. - -Goals: - - Better performance / reduced overheads (cpu, memory, start-up time). - - Appealing alternative to Perl/Python/Ruby/shell-scripts. - - Simple install (src tarball, RPM, dpkg, windows installer, OS-X whatever). - - No JVM required. - - Ability to use Groovy to access less Javaish libraries (POSIXy stuff, MFC, .NET). - - Ability to use Groovy (and Java) objects from other languages (C, C++, Perl, Python, Ruby, .NET, etc) - -WARNING: This is an experiment. It's a proof-of-concept. It probably won't work. But maybe it will. - -The first attempt at this package uses the GNU GCJ compiler. This is built on top of GCC and is -available for UNIXy platforms (including Linux and OS-X) and Windows (with Cygwin). - -These are the first set of goals for the experiment. - - - -*** Goal 1 : Native standalone executable of .groovy file. -[Complete] - -The existing Groovy compiler (running on a JVM) can compile .groovy files to .class files. -GCJ can then compile these .class files to .o binary objects. -GCJ can link these objects (together with a native version of the Groovy runtime library) into a -native executable. - -The challenge is building the native runtime library. In particular, identifying if the runtime -byte-code generation, custom class-loaders and dynamic proxies will cause problems when moved to -native code. - -Certain features of the Groovy language may be excluded to meet this goal and a JVM is still -required at build time. - - - -*** Goal 2 : Native Groovy libraries. -[In progress] - -Compile a collection of .groovy files into a .so that can be linked to from other Groovy or native -libraries. - -Provide samples for Groovy, C and C++ apps all linking to another Groovy library. - - - -*** Goal 3 : Native .groovy compiler. -[Not started] - -The actual Groovy compiler should be native (as well as the runtime) allowing Groovy to be developed -entirely without a JVM present. - - - -*** Goal 4 : Usable tool set. -[In progress] - -A set of simple wrapper tools should be provided for common features: - - Compiling and linking a Groovy library or standalone executable. - - JIT style interpreter (like Python) that runs a Groovy script directly by recompiling if necessary. - - #!/usr/local/bin/groovy style declaration for scripts allowing direct invocation. - - - -*** Goal 5 : Runtime interpreter. -[Not started] - -Allow Groovy snippets to be evaluated dynamically at runtime (the functionality of GroovyClassLoader). -This could get tricky. - - - -*** Goal 6 : Complete language features. -[Not started] - -Get all the unit tests running on the native Groovy. This excludes Java specific extras such as JMS -and Servlets. - - - -*** Goal 7 : Installation bundle. -[Not started] - -Provide a UNIX installation bundle that contains scripts and instructions for getting native Groovy -running on a machine. - - - -*** Goal 8 : Optimizations. -[Not started] - -Profile code to see how it can be made snappier. Especially important is the startup time. A plain -GCJ compiled Java file starts within <50ms, whereas Groovy is taking much longer. - - - -*** Goal 9 : Provide Groovy with simple access to native libraries. -[Not started] - -Extend the Groovy library and build tools to allow easy access to code outside of Groovy/Java from -Groovy classes. - -Something like: - -import ncurses // use libncurses/ncurses.h -class Thingy { - void doStuff(name) { - ncurses.printw("Hello ${name}") // print string - ncurses.refresh() // display it on screen - ncurses.getch() // wait for key press - } -} - - - - - - - -- Joe Walnes diff --git a/groovy/groovy-native/examples/001-standalone-executable/README b/groovy/groovy-native/examples/001-standalone-executable/README deleted file mode 100644 index fefdd4d018..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/README +++ /dev/null @@ -1,15 +0,0 @@ -Read README in parent directory first. And read the README in the grand-parent directory -before that! Seriously, it's important! - - - -This demo simply compiles a single Simple.groovy class into a native executable that can -be invoked using ./Simple - -Steps: - * Read the other README files. - * ./build.sh - * ./Simple - - -- Joe Walnes diff --git a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy b/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy deleted file mode 100644 index b67e0d3e04..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy +++ /dev/null @@ -1,19 +0,0 @@ -class Simple { - doSomething() { - data = ["name": "James", "location": "London"] - for (e in data) { - println("entry ${e.key} is ${e.value}") - } - } - - closureExample(collection) { - collection.each { println("value ${it}") } - } - - static void main(args) { - values = [1, 2, 3, "abc", "moo"] - foo = new Simple() - foo.closureExample(values) - foo.doSomething() - } -} diff --git a/groovy/groovy-native/examples/001-standalone-executable/build.sh b/groovy/groovy-native/examples/001-standalone-executable/build.sh deleted file mode 100644 index e1ca0b147a..0000000000 --- a/groovy/groovy-native/examples/001-standalone-executable/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -$GROOVY_HOME/bin/groovyc Simple.groovy -CLASSPATH=../../libgroovy/libgroovy.jar gcj --main=Simple -o Simple -L../../libgroovy -lgroovy *.class -rm -rf *.class - diff --git a/groovy/groovy-native/examples/README b/groovy/groovy-native/examples/README deleted file mode 100644 index a01ddda7dd..0000000000 --- a/groovy/groovy-native/examples/README +++ /dev/null @@ -1,16 +0,0 @@ -These are the examples for libgroovy. If you don't know what I'm talking about, read -the README in the parent directory. - -Before running any of the examples: - * Build libgroovy (instructions in libgroovy directory). - * Set GROOVY_HOME to wherever Groovy may reside. - * Append the libgroovy directory to LD_LIBRARY_PATH if not already present. - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/groovy-native/libgroovy - -The example directory names are prefixed with a number so you can step through the -examples in a logical order. - - -- Joe Walnes - diff --git a/groovy/groovy-native/libgroovy/README b/groovy/groovy-native/libgroovy/README deleted file mode 100644 index 0314b9d48f..0000000000 --- a/groovy/groovy-native/libgroovy/README +++ /dev/null @@ -1,59 +0,0 @@ -See README in parent directory before reading on. - -Okay, so now you know what this is all about. - - - -*** Introduction - -libgroovy is the core native Groovy library for runtime use. Any Groovy application -requires this library (and the standard libgcj libraries) to run. - -libgroovy only contains a subset of the standard Groovy library. Currently it only -runs basic Groovy scripts. - -You may notice that there are no actual source files here. This is because libgroovy -is built from the Java source files from Groovy. The source files for the Java ASM -library are also required. - - - -*** Building the library. - -This library currently only compiles on UNIX. - -You need: - - JDK. - - GCJ. - - The Java source for Groovy and ASM. - - Bash. - -Edit build.sh and set the appropriate variables at the top of the script. - -./build.sh -(may take some time and generate a collection of warnings - but hopefully no errors). - -If all goes to plan, you should end up with libgroovy.so and libgroovy.jar in the current -directory. - - - -*** Notes on how the library is built. - -The stripped down library only tries to compile the classes listed in groovy-src and asm-src. - -Certain tweaks needed to be made to get the source to compile as GCJ only partially supports -the J2SE1.4 library. Rather than modify the Groovy source, build.sh patches the source using -patch.diff to get the code to compile (although nobbling some features in doing so). - - - -*** How to use the library. - -Coming soon. In the mean time, look at one of the examples. - - - -- Joe Walnes - - diff --git a/groovy/groovy-native/libgroovy/asm-src b/groovy/groovy-native/libgroovy/asm-src deleted file mode 100644 index e89f128638..0000000000 --- a/groovy/groovy-native/libgroovy/asm-src +++ /dev/null @@ -1,10 +0,0 @@ -org/objectweb/asm/ClassVisitor.java -org/objectweb/asm/ClassWriter.java -org/objectweb/asm/CodeVisitor.java -org/objectweb/asm/Constants.java -org/objectweb/asm/CodeWriter.java -org/objectweb/asm/Edge.java -org/objectweb/asm/Item.java -org/objectweb/asm/Label.java -org/objectweb/asm/Type.java -org/objectweb/asm/ByteVector.java diff --git a/groovy/groovy-native/libgroovy/build.sh b/groovy/groovy-native/libgroovy/build.sh deleted file mode 100644 index fd1be84e63..0000000000 --- a/groovy/groovy-native/libgroovy/build.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Ensure these paths are correct - -#JAVA_HOME=/usr/local/java -GROOVY_HOME=~/groovy-1.0-beta-2 -GROOVY_SRC=$GROOVY_HOME/src/main -ASM_SRC=~/ASM/dev/src - -# End of paths - - - - -BUILD_DIR=build -LIB_NAME=groovy - -rm -rf $BUILD_DIR lib$LIB_NAME.{jar,so} -mkdir -p $BUILD_DIR - -BASE_DIR=`pwd` -cd $BUILD_DIR -BUILD_DIR=`pwd` -cd $BASE_DIR - -# Copy mimimum required source files to temp directory -(cd $GROOVY_SRC && cp --parents `grep -v '#' $BASE_DIR/groovy-src` $BUILD_DIR) -(cd $ASM_SRC && cp --parents `grep -v '#' $BASE_DIR/asm-src` $BUILD_DIR) - -# Patch the source files -patch --silent -f -p0 -d $BUILD_DIR < patch.diff - -# .java -> .class -find $BUILD_DIR -name \*.java | xargs gcj -C - -# .class -> .jar -jar -cf lib$LIB_NAME.jar -C $BUILD_DIR . - -# .class -> .so -gcj -shared -o lib$LIB_NAME.so lib$LIB_NAME.jar - -# clean up -rm -rf $BUILD_DIR - diff --git a/groovy/groovy-native/libgroovy/groovy-src b/groovy/groovy-native/libgroovy/groovy-src deleted file mode 100644 index 0030e97725..0000000000 --- a/groovy/groovy-native/libgroovy/groovy-src +++ /dev/null @@ -1,128 +0,0 @@ -groovy/lang/Closure.java -groovy/lang/ClosureException.java -groovy/lang/GString.java -groovy/lang/GroovyClassLoader.java -groovy/lang/GroovyLog.java -groovy/lang/GroovyObject.java -groovy/lang/GroovyObjectSupport.java -groovy/lang/GroovyShell.java -groovy/lang/IntRange.java -groovy/lang/MetaClass.java -groovy/lang/MetaClassRegistry.java -groovy/lang/NonEmptySequence.java -groovy/lang/ObjectRange.java -groovy/lang/Range.java -groovy/lang/Reference.java -groovy/lang/Script.java -groovy/lang/ScriptContext.java -groovy/lang/Sequence.java -groovy/lang/Tuple.java -groovy/util/Bitwise.java -groovy/util/BuilderSupport.java -groovy/util/ClosureComparator.java -groovy/util/IndentPrinter.java -groovy/util/MapEntry.java -groovy/util/Node.java -groovy/util/NodeBuilder.java -groovy/util/NodePrinter.java -groovy/util/OrderBy.java -org/codehaus/groovy/GroovyException.java -org/codehaus/groovy/ast/ASTNode.java -org/codehaus/groovy/ast/ClassNode.java -org/codehaus/groovy/ast/CodeVisitorSupport.java -org/codehaus/groovy/ast/CompileUnit.java -org/codehaus/groovy/ast/ConstructorNode.java -org/codehaus/groovy/ast/FieldNode.java -org/codehaus/groovy/ast/GroovyClassVisitor.java -org/codehaus/groovy/ast/GroovyCodeVisitor.java -org/codehaus/groovy/ast/InnerClassNode.java -org/codehaus/groovy/ast/MetadataNode.java -org/codehaus/groovy/ast/MethodNode.java -org/codehaus/groovy/ast/MixinNode.java -org/codehaus/groovy/ast/ModuleNode.java -org/codehaus/groovy/ast/Parameter.java -org/codehaus/groovy/ast/PropertyNode.java -org/codehaus/groovy/ast/expr/ArgumentListExpression.java -org/codehaus/groovy/ast/expr/ArrayExpression.java -org/codehaus/groovy/ast/expr/BinaryExpression.java -org/codehaus/groovy/ast/expr/BooleanExpression.java -org/codehaus/groovy/ast/expr/ClassExpression.java -org/codehaus/groovy/ast/expr/ClosureExpression.java -org/codehaus/groovy/ast/expr/ConstantExpression.java -org/codehaus/groovy/ast/expr/ConstructorCallExpression.java -org/codehaus/groovy/ast/expr/Expression.java -org/codehaus/groovy/ast/expr/FieldExpression.java -org/codehaus/groovy/ast/expr/GStringExpression.java -org/codehaus/groovy/ast/expr/ListExpression.java -org/codehaus/groovy/ast/expr/MapEntryExpression.java -org/codehaus/groovy/ast/expr/MapExpression.java -org/codehaus/groovy/ast/expr/MethodCallExpression.java -org/codehaus/groovy/ast/expr/NamedArgumentListExpression.java -org/codehaus/groovy/ast/expr/NotExpression.java -org/codehaus/groovy/ast/expr/PostfixExpression.java -org/codehaus/groovy/ast/expr/PrefixExpression.java -org/codehaus/groovy/ast/expr/PropertyExpression.java -org/codehaus/groovy/ast/expr/RangeExpression.java -org/codehaus/groovy/ast/expr/RegexExpression.java -org/codehaus/groovy/ast/expr/StaticMethodCallExpression.java -org/codehaus/groovy/ast/expr/TupleExpression.java -org/codehaus/groovy/ast/expr/VariableExpression.java -org/codehaus/groovy/ast/stmt/AssertStatement.java -org/codehaus/groovy/ast/stmt/BlockStatement.java -org/codehaus/groovy/ast/stmt/BreakStatement.java -org/codehaus/groovy/ast/stmt/CaseStatement.java -org/codehaus/groovy/ast/stmt/CatchStatement.java -org/codehaus/groovy/ast/stmt/ContinueStatement.java -org/codehaus/groovy/ast/stmt/DoWhileStatement.java -org/codehaus/groovy/ast/stmt/EmptyStatement.java -org/codehaus/groovy/ast/stmt/ExpressionStatement.java -org/codehaus/groovy/ast/stmt/ForStatement.java -org/codehaus/groovy/ast/stmt/IfStatement.java -org/codehaus/groovy/ast/stmt/ReturnStatement.java -org/codehaus/groovy/ast/stmt/Statement.java -org/codehaus/groovy/ast/stmt/SwitchStatement.java -org/codehaus/groovy/ast/stmt/SynchronizedStatement.java -org/codehaus/groovy/ast/stmt/ThrowStatement.java -org/codehaus/groovy/ast/stmt/TryCatchStatement.java -org/codehaus/groovy/ast/stmt/WhileStatement.java -org/codehaus/groovy/classgen/ClassGenerator.java -org/codehaus/groovy/classgen/ClassGeneratorException.java -org/codehaus/groovy/classgen/VariableScopeCodeVisitor.java -org/codehaus/groovy/classgen/CompilerFacade.java -org/codehaus/groovy/classgen/GeneratorContext.java -org/codehaus/groovy/classgen/MethodCaller.java -org/codehaus/groovy/classgen/Variable.java -org/codehaus/groovy/classgen/Verifier.java -org/codehaus/groovy/classgen/VerifierCodeVisitor.java -org/codehaus/groovy/runtime/ClassExtender.java -org/codehaus/groovy/runtime/DefaultGroovyMethods.java -org/codehaus/groovy/runtime/Invoker.java -org/codehaus/groovy/runtime/InvokerException.java -org/codehaus/groovy/runtime/InvokerHelper.java -org/codehaus/groovy/runtime/InvokerInvocationException.java -org/codehaus/groovy/runtime/IteratorClosureAdapter.java -org/codehaus/groovy/runtime/MethodClosure.java -org/codehaus/groovy/runtime/MethodHelper.java -org/codehaus/groovy/runtime/NoSuchClassException.java -org/codehaus/groovy/runtime/NoSuchMethodException.java -org/codehaus/groovy/runtime/NoSuchPropertyException.java -org/codehaus/groovy/syntax/AbstractTokenStream.java -org/codehaus/groovy/syntax/LookAheadExhaustionException.java -org/codehaus/groovy/syntax/SyntaxException.java -org/codehaus/groovy/syntax/Token.java -org/codehaus/groovy/syntax/TokenStream.java -org/codehaus/groovy/syntax/TokenMismatchException.java -org/codehaus/groovy/syntax/lexer/AbstractCharStream.java -org/codehaus/groovy/syntax/lexer/CharStream.java -org/codehaus/groovy/syntax/lexer/InputStreamCharStream.java -org/codehaus/groovy/syntax/lexer/Lexer.java -org/codehaus/groovy/syntax/lexer/LexerTokenStream.java -org/codehaus/groovy/syntax/lexer/UnexpectedCharacterException.java -org/codehaus/groovy/syntax/lexer/LexerException.java -org/codehaus/groovy/syntax/lexer/UnterminatedStringLiteralException.java -org/codehaus/groovy/syntax/parser/ASTBuilder.java -org/codehaus/groovy/syntax/parser/CSTNode.java -org/codehaus/groovy/syntax/parser/UnexpectedTokenException.java -org/codehaus/groovy/syntax/parser/ParserException.java -org/codehaus/groovy/syntax/parser/Parser.java -org/codehaus/groovy/syntax/lexer/StringCharStream.java diff --git a/groovy/groovy-native/libgroovy/patch.diff b/groovy/groovy-native/libgroovy/patch.diff deleted file mode 100644 index 68b0bce4bd..0000000000 --- a/groovy/groovy-native/libgroovy/patch.diff +++ /dev/null @@ -1,82 +0,0 @@ ---- org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:37:49.000000000 +0000 -+++ org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:38:46.000000000 +0000 -@@ -62,8 +62,6 @@ - import java.util.regex.Matcher; - import java.util.regex.Pattern; - --import com.mockobjects.util.NotImplementedException; -- - /** - * A helper class to invoke methods or extract properties on arbitrary Java objects dynamically - * -@@ -244,7 +242,7 @@ - return matcher.group(); - } - public void remove() { -- throw new NotImplementedException(); -+ throw new UnsupportedOperationException(); - } - }; - } ---- ./org/codehaus/groovy/runtime/InvokerHelper.java.orig 2004-01-06 17:13:41.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/InvokerHelper.java 2004-01-06 17:14:24.000000000 +0000 -@@ -170,7 +170,7 @@ - } - else if (object instanceof Matcher) { - Matcher matcher = (Matcher) object; -- return matcher.find(); -+ throw new UnsupportedOperationException("Matcher.find()"); - } - else if (object instanceof Collection) { - Collection collection = (Collection) object; ---- ./org/codehaus/groovy/runtime/Invoker.java.orig 2004-01-06 17:14:52.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/Invoker.java 2004-01-06 17:17:41.000000000 +0000 -@@ -227,8 +227,7 @@ - public boolean hasNext() { - if (done) return false; - if (!found) { -- found = matcher.find(); -- if (!found) done = true; -+ throw new UnsupportedOperationException("Matcher.find()"); - } - return found; - } -@@ -239,7 +238,7 @@ - } - } - found = false; -- return matcher.group(); -+ throw new UnsupportedOperationException("Matcher.group()"); - } - public void remove() { - throw new UnsupportedOperationException(); -@@ -485,7 +484,7 @@ - pattern = Pattern.compile(toString(right)); - } - String stringToCompare = toString(left); -- return pattern.matcher(stringToCompare).matches(); -+ throw new UnsupportedOperationException("Matcher"); - } - - /** ---- ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java.orig 2004-01-06 17:18:17.000000000 +0000 -+++ ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java 2004-01-06 17:19:36.000000000 +0000 -@@ -221,7 +221,7 @@ - } - - public static boolean isCase(Pattern caseValue, Object switchValue) { -- return caseValue.matcher(switchValue.toString()).matches(); -+ throw new UnsupportedOperationException("Matcher.matches()"); - } - - // Collection based methods -@@ -850,8 +850,7 @@ - } - - public static String minus(String left, Object value) { -- String text = toString(value); -- return left.replaceFirst(text, ""); -+ throw new UnsupportedOperationException("String.replaceFirst()"); - } - - public static String multiply(String self, Number factor) {