Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Broken.
  • Loading branch information
donaldh committed Mar 2, 2013
1 parent ce3ee72 commit d5207b0
Show file tree
Hide file tree
Showing 15 changed files with 875 additions and 420 deletions.
4 changes: 3 additions & 1 deletion .classpath
Expand Up @@ -2,6 +2,8 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="3rdparty/bcel/bcel-5.2.jar"/>
<classpathentry kind="lib" path="3rdparty/bcel/bcel-5.2.jar" sourcepath="/Users/donaldh/work/bcel/src/main/java"/>
<classpathentry kind="lib" path="3rdparty/asm/asm-4.1.jar" sourcepath="/Users/donaldh/Downloads/asm-4.1/src.zip"/>
<classpathentry kind="lib" path="3rdparty/asm/asm-commons-4.1.jar" sourcepath="/Users/donaldh/Downloads/asm-4.1/src.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file added 3rdparty/asm/asm-4.1.jar
Binary file not shown.
Binary file added 3rdparty/asm/asm-commons-4.1.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -28,7 +28,7 @@ all: $(NQPLIBS)

bin: $(JAVAS)
$(PERL) -MExtUtils::Command -e mkpath bin
$(JAVAC) -source 1.7 -cp 3rdparty/bcel/bcel-5.2.jar -d bin $(JAVAS)
$(JAVAC) -source 1.7 -cp 3rdparty/asm/asm-4.1.jar:3rdparty/bcel/bcel-5.2.jar -d bin $(JAVAS)

test: all
$(PROVE) --exec=$(NQP) t/jast/*.t t/qast/*.t
Expand All @@ -37,7 +37,7 @@ nqptest: all
$(PROVE) --exec="$(NQP) nqp-jvm-cc.nqp" t/nqp/*.t

selftest: all
$(PROVE) --exec="java -cp .;bin;3rdparty/bcel/bcel-5.2.jar NQPJVM" t/nqp/*.t
$(PROVE) --exec="java -cp .:bin:3rdparty/asm/asm-4.1.jar:3rdparty/bcel/bcel-5.2.jar NQPJVM" t/nqp/*.t

clean:
$(PERL) -MExtUtils::Command -e rm_rf bin *.pir *.pbc *.class *.dump
Expand Down
118 changes: 118 additions & 0 deletions Makefile~
@@ -0,0 +1,118 @@
NQP = nqp
PARROT = parrot
JAVAC = javac
PERL = perl
PROVE = prove

NQPLIBS = NQPCOREJVM.setting.class nqp-mo.class ModuleLoader.class QASTNodeJVM.class \
QRegexJVM.class NQPHLLJVM.class JASTNodesJVM.class QASTJVM.class \
NQPP6QRegexJVM.class NQPJVM.class
NQPLIBPIRS = NQPCOREJVM.setting.pir nqp-mo.pir QASTNodeJVM.pir QRegexJVM.pir NQPHLLJVM.pir \
JASTNodesJVM.pir QASTJVM.pir NQPP6QRegexJVM.pir NQPJVM.pir
CROSSPBCS = JASTNodes.pbc QASTJASTCompiler.pbc helper.pbc

JAVAS = src/org/perl6/nqp/jast2bc/*.java \
src/org/perl6/nqp/runtime/*.java \
src/org/perl6/nqp/sixmodel/*.java \
src/org/perl6/nqp/sixmodel/reprs/*.java

COMPILE = $(NQP) --target=pir --output=$@
PRECOMPILE = $(NQP) --target=pir --no-regex-lib --stable-sc --setting=NQPCOREJVM --output=$@
CROSSCOMPILE = $(NQP) nqp-jvm-cc.nqp --no-regex-lib --target=classfile --output=$@
PRECOMPILE_NS = $(NQP) --target=pir --setting=NULL --stable-sc --output=$@
CROSSCOMPILE_NS = $(NQP) nqp-jvm-cc.nqp --setting=NULL --target=classfile --output=$@

.SUFFIXES: .pir .pbc

all: $(NQPLIBS)

bin: $(JAVAS)
$(PERL) -MExtUtils::Command -e mkpath bin
$(JAVAC) -source 1.7 -cp 3rdparty/bcel/bcel-5.2.jar -d bin $(JAVAS)

test: all
$(PROVE) --exec=$(NQP) t/jast/*.t t/qast/*.t

nqptest: all
$(PROVE) --exec="$(NQP) nqp-jvm-cc.nqp" t/nqp/*.t

selftest: all
$(PROVE) --exec="java -cp .;bin;3rdparty/bcel/bcel-5.2.jar NQPJVM" t/nqp/*.t

clean:
$(PERL) -MExtUtils::Command -e rm_rf bin *.pir *.pbc *.class *.dump

$(NQPLIBS): bin nqp-jvm-cc.nqp $(CROSSPBCS)
$(NQPLIBPIRS): $(CROSSPBCS)

.pir.pbc:
$(PARROT) -o $@ $*.pir

nqp-src/QASTJVM.nqp: lib/QAST/JASTCompiler.nqp
nqp build/usefiddle.nqp

JASTNodes.pir: lib/JAST/Nodes.nqp
$(COMPILE) lib/JAST/Nodes.nqp

QASTJASTCompiler.pir: lib/QAST/JASTCompiler.nqp JASTNodes.pbc
$(COMPILE) lib/QAST/JASTCompiler.nqp

helper.pir: t/helper.nqp QASTJASTCompiler.pbc
$(COMPILE) t/helper.nqp

nqp-mo.pir: nqp-src/nqp-mo.pm
$(PRECOMPILE_NS) nqp-src/nqp-mo.pm

NQPCOREJVM.setting.pir: nqp-src/NQPCORE.setting nqp-mo.pbc
$(PRECOMPILE_NS) nqp-src/NQPCORE.setting

QASTNodeJVM.pir: nqp-src/QASTNodes.nqp NQPCOREJVM.setting.pbc
$(PRECOMPILE) nqp-src/QASTNodes.nqp

QRegexJVM.pir: nqp-src/QRegex.nqp QASTNodeJVM.pbc
$(PRECOMPILE) nqp-src/QRegex.nqp

NQPHLLJVM.pir: nqp-src/NQPHLL.pm QRegexJVM.pbc
$(PRECOMPILE) nqp-src/NQPHLL.pm

JASTNodesJVM.pir: nqp-src/NQPHLL.pm NQPHLLJVM.pbc
$(PRECOMPILE) lib/JAST/Nodes.nqp

QASTJVM.pir: nqp-src/QASTJVM.nqp JASTNodesJVM.pbc
$(PRECOMPILE) nqp-src/QASTJVM.nqp

NQPP6QRegexJVM.pir: nqp-src/NQPP6QRegex.pm QASTJVM.pbc
$(PRECOMPILE) nqp-src/NQPP6QRegex.pm

NQPJVM.pir: nqp-src/NQP.pm NQPP6QRegexJVM.pbc
$(PRECOMPILE) nqp-src/NQP.pm

nqp-mo.class: nqp-src/nqp-mo.pm nqp-mo.pbc
$(CROSSCOMPILE_NS) nqp-src/nqp-mo.pm

ModuleLoader.class: nqp-src/ModuleLoader.pm
$(CROSSCOMPILE_NS) nqp-src/ModuleLoader.pm

NQPCOREJVM.setting.class: nqp-src/NQPCORE.setting NQPCOREJVM.setting.pbc
$(CROSSCOMPILE_NS) nqp-src/NQPCORE.setting

QASTNodeJVM.class: nqp-src/QASTNodes.nqp QASTNodeJVM.pbc
$(CROSSCOMPILE) nqp-src/QASTNodes.nqp

QRegexJVM.class: nqp-src/QRegex.nqp QRegexJVM.pbc
$(CROSSCOMPILE) nqp-src/QRegex.nqp

NQPHLLJVM.class: nqp-src/NQPHLL.pm NQPHLLJVM.pbc
$(CROSSCOMPILE) nqp-src/NQPHLL.pm

JASTNodesJVM.class: lib/JAST/Nodes.nqp JASTNodesJVM.pbc
$(CROSSCOMPILE) lib/JAST/Nodes.nqp

QASTJVM.class: nqp-src/QASTJVM.nqp QASTJVM.pbc
$(CROSSCOMPILE) nqp-src/QASTJVM.nqp

NQPP6QRegexJVM.class: nqp-src/NQPP6QRegex.pm NQPP6QRegexJVM.pbc
$(CROSSCOMPILE) nqp-src/NQPP6QRegex.pm

NQPJVM.class: nqp-src/NQP.pm NQPJVM.pbc
$(NQP) nqp-jvm-cc.nqp --no-regex-lib --target=classfile --output=NQPJVM.class --javaclass=NQPJVM nqp-src/NQP.pm
2 changes: 2 additions & 0 deletions ex/add.nqp
@@ -0,0 +1,2 @@
my $i := 1;
$i := $i + 1;
2 changes: 2 additions & 0 deletions ex/assign.nqp
@@ -0,0 +1,2 @@
my $i := 1;
$i := $i;
3 changes: 3 additions & 0 deletions ex/inc.nqp
@@ -0,0 +1,3 @@
my $i := 0;
$i++;
nqp::say($i);
8 changes: 8 additions & 0 deletions ex/loop.nqp
@@ -0,0 +1,8 @@
#! nqp
# Example of a while loop

my $i := 0;
while $i < 10 {
say($i);
$i := $i + 1;
}
5 changes: 5 additions & 0 deletions ex/split.nqp
@@ -0,0 +1,5 @@
my @items := nqp::split(' ', 'Mary had a little lamb');

for @items {
say($_);
}
13 changes: 6 additions & 7 deletions src/org/perl6/nqp/sixmodel/REPR.java
@@ -1,8 +1,7 @@
package org.perl6.nqp.sixmodel;

import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.Instruction;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.perl6.nqp.runtime.ThreadContext;

/**
Expand Down Expand Up @@ -108,16 +107,16 @@ public void deserialize_repr_data(ThreadContext tc, STable st, SerializationRead
/**
* Flattening related functions.
*/
public void inlineStorage(ThreadContext tc, STable st, ClassGen c, ConstantPoolGen cp, String prefix) {
public void inlineStorage(ThreadContext tc, STable st, ClassWriter cw, String prefix) {
throw new RuntimeException("This representation cannot inline itself into another");
}
public Instruction[] inlineBind(ThreadContext tc, STable st, ClassGen c, ConstantPoolGen cp, String prefix) {
public void inlineBind(ThreadContext tc, STable st, MethodVisitor mv, String prefix) {
throw new RuntimeException("This representation cannot inline itself into another");
}
public Instruction[] inlineGet(ThreadContext tc, STable st, ClassGen c, ConstantPoolGen cp, String prefix) {
public void inlineGet(ThreadContext tc, STable st, MethodVisitor mv, String prefix) {
throw new RuntimeException("This representation cannot inline itself into another");
}
public void generateBoxingMethods(ThreadContext tc, STable st, ClassGen c, ConstantPoolGen cp, String prefix) {
public void generateBoxingMethods(ThreadContext tc, STable st, ClassWriter cw, String prefix) {
throw new RuntimeException("This representation does not support being a box target");
}
public void deserialize_inlined(ThreadContext tc, STable st, SerializationReader reader,
Expand Down

0 comments on commit d5207b0

Please sign in to comment.