Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Misc cleanup

  • Loading branch information...
commit 06de40cf053fb943f91a16ca72fe836103173b8a 1 parent 6469ca8
Kresten Krab Thorup krestenkrab authored
8 ej
View
@@ -8,11 +8,17 @@ while LINK=`readlink "$EJ_CMD"`; do EJ_CMD=$LINK; done
ERJANG_DIR=`dirname "$EJ_CMD"`
## -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=n,suspend=n \
+## -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n \
+
+## -XX:+UnlockCommercialFeatures \
+## -XX:+FlightRecorder \
+## -XX:FlightRecorderOptions=disk=true,dumponexit=true,defaultrecording=true \
exec java \
-server \
- -XX:MaxJavaStackTraceDepth=100000 \
-Derjang.inline_calls=true \
+ -Derjang.declare_missing_imports=true \
+ -Djava.library.path=/Users/krab/Projects/erjang/jnif \
-Xmx1g -Xss50m \
-XX:PermSize=128m \
-jar $ERJANG_DIR/erjang-0.2.jar \
1  src/main/java/erjang/EFun.java
View
@@ -25,6 +25,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Set;
1  src/main/java/erjang/EInternalPID.java
View
@@ -34,6 +34,7 @@
private DistEntry distEntry;
// used by JNIF to hold a unique GlobalRef to this object
+ // TODO: figure out a way to garbage collect such global refs.
private long gref;
public EInternalPID testInternalPID() {
2  src/main/java/erjang/Main.java
View
@@ -61,7 +61,7 @@ public static void main(String[] args) throws Exception {
ErjangConfig.setenv(args[i+1], args[i+2]);
i += 2;
} else if ("+e".equals(args[i]) && i < args.length) {
- erts_version = "erts-" + args[i+1];
+ erts_version = args[i+1];
i += 1;
}
}
6 src/main/java/erjang/beam/CompilerVisitor.java
View
@@ -34,7 +34,6 @@
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.logging.Level;
-import java.util.logging.Logger;
import kilim.Pausable;
import kilim.analysis.ClassInfo;
@@ -50,9 +49,8 @@
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Method;
-import com.trifork.clj_ds.IPersistentCollection;
-
import erjang.EAtom;
+import erjang.EBig;
import erjang.EBinMatchState;
import erjang.EBinary;
import erjang.EBitString;
@@ -61,7 +59,6 @@
import erjang.EDouble;
import erjang.EFun;
import erjang.EInteger;
-import erjang.EBig;
import erjang.EInternalPID;
import erjang.EList;
import erjang.EModuleManager;
@@ -92,7 +89,6 @@
import erjang.beam.ModuleAnalyzer.FunInfo;
import erjang.beam.repr.ExtFun;
import erjang.beam.repr.Insn;
-import erjang.m.erlang.ErlBif;
import erjang.m.erlang.ErlConvert;
/**
17 src/main/java/erjang/beam/analysis/BeamTypeAnalysis.java
View
@@ -77,6 +77,7 @@
import erjang.beam.repr.Insn;
import erjang.beam.repr.ExtFun;
+import erjang.beam.repr.Insn.S;
import erjang.beam.repr.Operands;
import erjang.beam.repr.Operands.Int;
import erjang.beam.repr.Operands.XReg;
@@ -905,7 +906,16 @@ private void accept_2(BlockVisitor2 vis, BeamExceptionHandler exh) {
break;
}
- case K_try:
+ case K_try:{
+ Insn.YL insn = (Insn.YL) insn_;
+ TypeMap type_map_after = this.map[insn_idx+1];
+ vis.visitCatchBlockStart(opcode,
+ decode_labelref(insn.label, type_map.exh),
+ src_arg(insn_idx, insn.y),
+ type_map_after.exh);
+ break;
+ }
+
case K_catch: {
Insn.YL insn = (Insn.YL) insn_;
TypeMap type_map_after = this.map[insn_idx+1];
@@ -2153,7 +2163,12 @@ boolean may_terminate_exceptionally(BeamOpcode code) {
case K_catch:
case try_end:
case catch_end:
+ case line:
+ case try_case:
+ case is_eq_exact:
return false;
+
+ case case_end:
default:
return true;
}
1  src/main/java/erjang/beam/analysis/TypeMap.java
View
@@ -30,6 +30,7 @@
import erjang.EObject;
import erjang.ETuple;
+@SuppressWarnings("rawtypes")
class TypeMap {
private static Logger log = Logger.getLogger("erjang.beam");
private static Type TYPE_EOBJECT = Type.getType(EObject.class);
2  src/main/java/erjang/beam/interpreter/ErjIG_Main.pl
View
@@ -199,7 +199,7 @@ ($$)
} elsif ($macro eq 'SET') {
return "$var = (";
} elsif ($macro eq 'GOTO') {
- return "pc = $var";
+ return "do { pc = $var; break insn_switch; } while(false)";
} elsif ($macro eq 'TABLEJUMP') {
return "pc = $var.lookup(";
} else {die;}
2  src/main/java/erjang/beam/interpreter/Interpreter.template
View
@@ -229,6 +229,7 @@ public class Interpreter extends AbstractInterpreter {
return interpret(proc, pc, reg);
}
+ @SuppressWarnings("unused")
public EObject interpret(final EProc proc, int pc, EObject[] reg) throws Pausable {
final char[] code = Module.this.code;
EObject stack[] = proc.stack;
@@ -260,6 +261,7 @@ public class Interpreter extends AbstractInterpreter {
}
log.finer("INTP|"+proc.self_handle()+" (pc="+(pc-1)+"; sp="+sp+")"+opcode+" "+reg[0]);
*/
+ insn_switch:
switch (opcode) {
case ENSURE_REG_CAPACITY: {
int max_x = code[pc++];
6 src/main/java/erjang/beam/interpreter/ops.spec
View
@@ -243,6 +243,12 @@ gc_bif1 bif arg1 dest onFail:
gc_bif2 bif arg1 arg2 dest onFail:
{EObject tmp = GET(bif).invoke(proc, new EObject[]{GET(arg1), GET(arg2)}); if (tmp==null) GOTO(onFail); SET(dest, tmp);}
+
+%class GcBif(ext_fun:EG args[0]:S args[1]:S args[2]:S dest:D label:L)
+
+gc_bif3 bif arg1 arg2 arg3 dest onFail:
+ {EObject tmp = GET(bif).invoke(proc, new EObject[]{GET(arg1), GET(arg2), GET(arg3)}); if (tmp==null) GOTO(onFail); SET(dest, tmp);}
+
# TODO: Streamline these calls - e.g. cast to EFun2 instead of creating array
5 src/main/java/erjang/driver/NIOSelector.java
View
@@ -71,7 +71,12 @@ public void run() {
try {
run0();
} catch (Throwable e) {
+ System.err.println("Exception in select loop");
+ System.err.println("Exception in select loop: " + e.getClass());
+ System.err.println("Exception in select loop: " + e);
+ log.severe("unhandled exception in Select loop: " +e);
log.severe("unhandled exception in Select loop: " +e.getMessage());
+ e.printStackTrace(System.err);
log.log(Level.FINE, "details: ", e);
}
}
1  src/main/java/erjang/driver/efile/EFile.java
View
@@ -1491,7 +1491,6 @@ public void run() {
break;
}
-
case FILE_PWD: {
d = new FileAsync() {
1  src/main/java/erjang/epmd/EPMDConnection.java
View
@@ -37,6 +37,7 @@ public EPMDConnection(int epmdPort, SelectionKey dsk) {
this.epmdPort = epmdPort;
}
+ @SuppressWarnings("unused")
@Override
protected void receivePacket(ByteBuffer buf) {
4 src/main/java/erjang/m/ets/EMatchSpec.java
View
@@ -463,6 +463,10 @@ public GuardCall(ETuple t, ParseContext ctx) {
}
this.bif = BIFUtil.getMethod("erlang", guard.getName(), args.length, true, false);
+
+ if (bif == null) {
+ System.err.println("NO GUARD BIF erlang:"+guard.toString()+"/"+args.length);
+ }
}
/**
4 src/main/java/erjang/m/ets/ETableBag.java
View
@@ -29,6 +29,7 @@
import com.trifork.clj_ds.PersistentHashSet;
import com.trifork.clj_ds.PersistentHashMap;
import com.trifork.clj_ds.Seqable;
+
import erjang.EAtom;
import erjang.ECons;
import erjang.EInteger;
@@ -46,6 +47,7 @@
/**
*
*/
+@SuppressWarnings("rawtypes")
public class ETableBag extends ETable {
/** holds an Integer with the bag size */
@@ -207,6 +209,7 @@ int size() {
return sizeRef.get();
}
+ @SuppressWarnings("rawtypes")
@Override
public ESeq match(EPattern matcher) {
@@ -237,6 +240,7 @@ public ESeq match(EPattern matcher) {
}
+ @SuppressWarnings("rawtypes")
@Override
public ESeq match_object(final EPattern matcher) {
1  src/main/java/erjang/m/ets/ETableSet.java
View
@@ -50,6 +50,7 @@
/**
*
*/
+@SuppressWarnings("rawtypes")
public class ETableSet extends ETable {
private boolean ordered;
1  src/main/java/erjang/m/ets/PersistentBag.java
View
@@ -29,6 +29,7 @@
/**
*
*/
+@SuppressWarnings("rawtypes")
public class PersistentBag extends Object implements IPersistentBag {
public static PersistentBag EMPTY = new PersistentBag(PersistentHashMap.EMPTY, 0);
3  test_server/estone_SUITE.erl
View
@@ -18,7 +18,7 @@
-module(estone_SUITE).
%% Test functions
--export([all/1,estone/1]).
+-export([all/1,all/0,estone/1]).
-export([init_per_testcase/2, fin_per_testcase/2]).
%% Internal exports for EStone tests
@@ -76,6 +76,7 @@ fin_per_testcase(_Case, Config) ->
?t:timetrap_cancel(Dog),
ok.
+all() -> all(suite).
all(suite) -> [estone].
estone(suite) ->
2  test_server/ts.erl
View
@@ -25,7 +25,7 @@ list(Mod) when is_atom(Mod) ->
{module, ModSuite} = compile_and_load(Mod),
lists:map(fun(Test) -> get_list(ModSuite,Test) end,
- ModSuite:all(suite)).
+ ModSuite:all()).
get_list(Mod,Test) ->
case catch Mod:Test(suite) of
Please sign in to comment.
Something went wrong with that request. Please try again.