Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use new kilim from asm-4.0 branch

Also implement the new R15 line opcode
For now, just ignore; it doesn't do anything yet

Bump version to 0.3
  • Loading branch information...
commit cbc4101298fea2db8182f2c9ff5aacd4b2aa4795 1 parent 8449498
Kresten Krab Thorup krestenkrab authored
2  .classpath
View
@@ -6,8 +6,8 @@
<classpathentry kind="lib" path="lib/OtpErlang.jar"/>
<classpathentry kind="lib" path="lib/antlr-3.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <classpathentry kind="lib" path="lib/kilim-0.6-krab.jar" sourcepath="/kilim-erjang/src"/>
<classpathentry kind="lib" path="lib/js.jar"/>
<classpathentry kind="lib" path="lib/clj-ds.jar"/>
+ <classpathentry kind="lib" path="lib/kilim.jar" sourcepath="/kilim-gburd"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
16 build.xml
View
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<project name="erjang" default="all">
- <property name="erjang.version" value="0.2" />
+ <property name="erjang.version" value="0.3" />
<property file="erjang_cfg.properties" />
<path id="erjang.classpath">
<pathelement location="target/classes/" />
<pathelement location="lib/js.jar" />
- <pathelement location="lib/kilim-0.6-krab.jar" />
+ <pathelement location="lib/kilim.jar" />
<pathelement location="lib/OtpErlang.jar" />
<pathelement location="lib/junit.jar" />
<pathelement location="lib/clj-ds.jar" />
@@ -16,7 +16,7 @@
<path id="erjang.testwovenclasspath">
<pathelement location="target/classes/" />
<pathelement location="target/test-classes/" />
- <pathelement location="lib/kilim-0.6-krab.jar" />
+ <pathelement location="lib/kilim.jar" />
<pathelement location="lib/OtpErlang.jar" />
<pathelement location="lib/clj-ds.jar" />
<pathelement location="lib/junit.jar" />
@@ -60,7 +60,15 @@
<target name="compile" depends="gen-interpreter,create-dirs">
<echo message="Compiling src ===================" />
- <javac debug="true" srcdir="src/main/java" destdir="target/classes" classpathref="erjang.classpath" deprecation="on" debuglevel="lines,vars,source"/>
+ <javac debug="true"
+ srcdir="src/main/java"
+ destdir="target/classes"
+ classpathref="erjang.classpath"
+ deprecation="on"
+ debuglevel="lines,vars,source"
+ source="1.5"
+ target="1.5"
+ includeantruntime="false" />
</target>
<target name="testcompile" depends="compile">
4 ej
View
@@ -7,13 +7,13 @@ EJ_CMD=`which "$0"`
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 -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y \
exec java \
-server \
-Xmx1g -Xss50m \
-XX:PermSize=128m \
- -jar $ERJANG_DIR/erjang-0.2.jar \
+ -jar $ERJANG_DIR/erjang-0.3.jar \
\
-progname ej \
+A 10 \
6 erjang_cfg.properties
View
@@ -1,6 +1,6 @@
-#erjang.otp.root = /usr/local/lib/erlang
-#erjang.erts.version = 5.8.3
-#erjang.otp.version = R14B02
+erjang.otp.root = /usr/local/lib/erlang
+erjang.erts.version = 5.9
+erjang.otp.version = R15B
# erjang.debug.port=true
# erjang.debug.inet=true
BIN  lib/kilim-0.6-krab.jar
View
Binary file not shown
BIN  lib/kilim.jar
View
Binary file not shown
7 src/main/java/erjang/EFun.java
View
@@ -219,7 +219,7 @@ private static String erlangNameOfMethod(Method method) {
String self_type = EFUN_TYPE.getInternalName() + arity;
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT,
self_type, null, EFUN_TYPE.getInternalName(), null);
@@ -286,7 +286,7 @@ public static EFun get_fun_with_handler(String module, String function, int arit
.append(module).append(safe_function)
.append("Handler").append(arity).toString();
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
String super_class_name = EFUN_TYPE.getInternalName() + arity;
cw.visit(Opcodes.V1_4, ACC_PUBLIC, self_type, null,
super_class_name, null);
@@ -554,7 +554,7 @@ private static String make_valid_java_id(CharSequence seq) {
String super_type = EFUN_TYPE.getInternalName() + arity;
String self_type = super_type + "Exported";
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT,
self_type, null, super_type, null);
@@ -632,6 +632,7 @@ private static void push_int(MethodVisitor mv, int i) {
public static byte[] weave(byte[] data) {
ClassWeaver w = new ClassWeaver(data, new Compiler.ErjangDetector("/xx/", (Set<String>)Collections.EMPTY_SET));
+ w.weave();
for (ClassInfo ci : w.getClassInfos()) {
// ETuple.dump(ci.className, ci.bytes);
1  src/main/java/erjang/EInternalPID.java
View
@@ -20,7 +20,6 @@
package erjang;
import erjang.m.erlang.DistEntry;
-import kilim.Mailbox;
import kilim.Pausable;
import kilim.Task;
222 src/main/java/erjang/EMailbox.java
View
@@ -0,0 +1,222 @@
+
+
+package erjang;
+
+import kilim.*;
+import java.util.TimerTask;
+
+public class EMailbox extends kilim.Mailbox<EObject> {
+
+ public EMailbox() {
+ super(10, ETask.MAX_MAILBOX_SIZE);
+ }
+
+ public EObject get(long timeout) throws Pausable {
+ if (untilHasMessage(timeout)) {
+ return get();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return non-null message.
+ * @throws Pausable
+ */
+ public void untilHasMessage() throws Pausable{
+ while (hasMessage(Task.getCurrentTask()) == false) {
+ Task.pause(this);
+ }
+ }
+
+ /**
+ * @return non-null message.
+ * @throws Pausable
+ */
+ public boolean untilHasMessage(long timeoutMillis) throws Pausable {
+ final Task t = Task.getCurrentTask();
+ boolean has_msg = hasMessage(t);
+ long begin = System.currentTimeMillis();
+ while (has_msg == false) {
+ TimerTask tt = new TimerTask() {
+ public void run() {
+ EMailbox.this.removeMsgAvailableListener(t);
+ t.onEvent(EMailbox.this, timedOut);
+ }
+ };
+ Task.timer.schedule(tt, timeoutMillis);
+ Task.pause(this);
+ tt.cancel();
+ if (System.currentTimeMillis() - begin > timeoutMillis) {
+ break;
+ }
+ has_msg = hasMessage(t);
+ }
+ return has_msg;
+ }
+
+ /**
+ * @return non-null message.
+ * @throws Pausable
+ */
+ public void untilHasMessages(int num) throws Pausable {
+ while (hasMessages(num, Task.getCurrentTask()) == false) {
+ Task.pause(this);
+ }
+ }
+
+ /**
+ * @return non-null message.
+ * @throws Pausable
+ */
+ public boolean untilHasMessages(int num, long timeoutMillis)
+ throws Pausable {
+ final Task t = Task.getCurrentTask();
+ final long end = System.currentTimeMillis() + timeoutMillis;
+
+ boolean has_msg = hasMessages(num, t);
+ while (has_msg == false) {
+ TimerTask tt = new TimerTask() {
+ public void run() {
+ EMailbox.this.removeMsgAvailableListener(t);
+ t.onEvent(EMailbox.this, timedOut);
+ }
+ };
+ Task.timer.schedule(tt, timeoutMillis);
+ Task.pause(this);
+ if (!tt.cancel()) {
+ removeMsgAvailableListener(t);
+ }
+
+ has_msg = hasMessages(num, t);
+ timeoutMillis = end - System.currentTimeMillis();
+ if (!has_msg && timeoutMillis <= 0) {
+ removeMsgAvailableListener(t);
+ break;
+ }
+ }
+ return has_msg;
+ }
+
+
+
+ /**
+ * Non-blocking, nonpausing "wait-until-message-available".
+ *
+ * @param eo
+ * . If non-null, registers this observer and calls it with a
+ * MessageAvailable event when a put() is done.
+ * @return true's one, or false
+ */
+ public boolean hasMessage(EventSubscriber eo) {
+ boolean has_msg;
+ synchronized (this) {
+ int n = numMsgs;
+ if (n > 0) {
+ has_msg = true;
+ } else {
+ has_msg = false;
+ addMsgAvailableListener(eo);
+ }
+ }
+ return has_msg;
+ }
+
+ public boolean hasMessages(int num, EventSubscriber eo) {
+ boolean has_msg;
+ synchronized (this) {
+ int n = numMsgs;
+ if (n >= num) {
+ has_msg = true;
+ } else {
+ has_msg = false;
+ addMsgAvailableListener(eo);
+ }
+ }
+ return has_msg;
+ }
+
+ private EObject _get(int i) {
+ return (EObject)(msgs()[i]);
+ }
+
+ private int _msg_len() {
+ return msgs().length;
+ }
+
+ /**
+ * Non-blocking, nonpausing peek.
+ * @return buffered message if there's one, or null
+ */
+ public EObject peek() {
+ EObject msg;
+ synchronized(this) {
+ int n = numMsgs;
+ if (n > 0) {
+ int ic = icons;
+ msg = _get(ic);
+ } else {
+ msg = null;
+ }
+ }
+ return msg;
+ }
+
+ /**
+ * Non-blocking, nonpausing peek.
+ *
+ * @return buffered message if there's one, or null
+ */
+ public EObject peek(int idx) {
+ assert idx >= 0 : "negative index";
+ EObject msg;
+ synchronized (this) {
+ int n = numMsgs;
+ if (idx < n) {
+ int ic = icons;
+ msg = _get((ic + idx) % _msg_len());
+
+ assert msg != null : "peeked null message!";
+ } else {
+ msg = null;
+ }
+ }
+ return msg;
+ }
+
+ public EObject remove(final int idx) {
+ assert idx >= 0 : "negative index";
+ EObject msg;
+ synchronized (this) {
+ int n = numMsgs;
+ assert idx < numMsgs;
+ if (idx < n) {
+ int ic = icons;
+ int mlen = _msg_len();
+ msg = _get((ic + idx) % mlen);
+ for (int i = idx; i > 0; i--) {
+ msgs()[(ic + i) % mlen] = msgs()[(ic + i - 1) % mlen];
+ }
+ msgs()[icons] = null;
+ numMsgs -= 1;
+ icons = (icons + 1) % mlen;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+ return msg;
+ }
+
+
+ public synchronized Object[] messages() {
+ synchronized (this) {
+ Object[] result = new Object[numMsgs];
+ for (int i = 0; i < numMsgs; i++) {
+ result[i] = _get((icons + i) % _msg_len());
+ }
+ return result;
+ }
+
+ }
+
+}
12 src/main/java/erjang/ETask.java
View
@@ -27,7 +27,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import kilim.Mailbox;
import kilim.Pausable;
import com.trifork.clj_ds.IPersistentSet;
@@ -46,6 +45,11 @@
private static final EAtom am_DOWN = EAtom.intern("DOWN");
private static final EAtom am_process = EAtom.intern("process");
+ int priority;
+
+ public void setPriority(int pri) { priority = pri; }
+ public int getPriority() { return priority; }
+
/**
* @return
*/
@@ -248,8 +252,8 @@ public EObject get_monitored_object(ERef monitor) {
- static final int MAX_MAILBOX_SIZE = 1000;
- protected final Mailbox<EObject> mbox = new Mailbox<EObject>(10, MAX_MAILBOX_SIZE);
+ public static final int MAX_MAILBOX_SIZE = 1000;
+ protected final EMailbox mbox = new EMailbox();
public static final int STATE_INIT = 0; // has not started yet
public static final int STATE_RUNNING = 1; // is live
@@ -382,7 +386,7 @@ public void checkKill() {
/**
* @return
*/
- public Mailbox<EObject> mbox() {
+ public EMailbox mbox() {
return mbox;
}
20 src/main/java/erjang/ETuple.java
View
@@ -25,7 +25,7 @@
import java.util.Map;
import java.util.Set;
-import org.objectweb.asm.ClassAdapter;
+import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
@@ -204,7 +204,7 @@ static public Class get_tuple_class(int num_cells) {
}
static byte[] make_tuple_class_data(int num_cells) {
- ClassWriter cww = new ClassWriter(true);
+ ClassWriter cww = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
CheckClassAdapter cw = new CheckClassAdapter(cww);
@@ -247,7 +247,7 @@ static public Class get_tuple_class(int num_cells) {
return data;
}
- private static void create_tuple_copy(int i, ClassAdapter cw,
+ private static void create_tuple_copy(int i, ClassVisitor cw,
String this_class_name, String super_class_name) {
MethodVisitor mv;
make_blank_bridge(cw, this_class_name, super_class_name);
@@ -266,7 +266,7 @@ private static void create_tuple_copy(int i, ClassAdapter cw,
mv.visitEnd();
}
- private static void make_blank_bridge(ClassAdapter cw,
+ private static void make_blank_bridge(ClassVisitor cw,
String this_class_name, String super_class_name) {
MethodVisitor mv;
mv = cw.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC
@@ -281,7 +281,7 @@ private static void make_blank_bridge(ClassAdapter cw,
mv.visitEnd();
}
- private static void create_tuple_nth(int n_cells, ClassAdapter cw,
+ private static void create_tuple_nth(int n_cells, ClassVisitor cw,
String this_class_name) {
MethodVisitor mv;
mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "elm", "(I)"
@@ -321,7 +321,7 @@ private static void create_tuple_nth(int n_cells, ClassAdapter cw,
mv.visitEnd();
}
- private static void create_tuple_set(int n_cells, ClassAdapter cw,
+ private static void create_tuple_set(int n_cells, ClassVisitor cw,
String this_class_name) {
MethodVisitor mv;
mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "set", "(I"
@@ -368,7 +368,7 @@ protected final EObject bad_nth(int i) {
throw ERT.badarg(this);
}
- private static void create_count(ClassAdapter cw, int n) {
+ private static void create_count(ClassVisitor cw, int n) {
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "arity", "()I",
null, null);
mv.visitCode();
@@ -383,7 +383,7 @@ private static void create_count(ClassAdapter cw, int n) {
mv.visitEnd();
}
- private static void create_cast(ClassAdapter cw, int n) {
+ private static void create_cast(ClassVisitor cw, int n) {
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC
| Opcodes.ACC_STATIC, "cast", "(L" + ETUPLE_NAME + ";)L"
+ ETUPLE_NAME + n + ";", null, null);
@@ -414,7 +414,7 @@ private static void create_cast(ClassAdapter cw, int n) {
}
- private static void create_cast2(ClassAdapter cw, int n) {
+ private static void create_cast2(ClassVisitor cw, int n) {
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC
| Opcodes.ACC_STATIC, "cast", "(L" + Type.getInternalName(EObject.class) + ";)L"
+ ETUPLE_NAME + n + ";", null, null);
@@ -439,7 +439,7 @@ private static void create_cast2(ClassAdapter cw, int n) {
mv.visitEnd();
}
- private static void create_constructor(ClassAdapter cw,
+ private static void create_constructor(ClassVisitor cw,
String super_class_name) {
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V",
null, null);
95 src/main/java/erjang/Lock.java
View
@@ -0,0 +1,95 @@
+package erjang;
+
+import kilim.*;
+import java.util.LinkedList;
+
+/**
+ * Simple reentrant lock that uses Kilim's means for suspending
+ *
+ * @author krab@trifork.com
+ */
+public class Lock implements PauseReason, EventPublisher {
+
+ Task owner = null;
+ int count;
+ LinkedList<Task> waiters;
+
+ static boolean $isWoven = true;
+
+ public void lock() throws Pausable {
+ Task.errNotWoven();
+ }
+
+ public void lock(Fiber f) {
+ while (!lock(f.task)) {
+ f.down();
+ Task.pause(this, f);
+ if(f.up() == Fiber.PAUSING__NO_STATE) {
+ f.setState(/* this, */ null);
+ }
+ }
+ }
+
+ private boolean lock(Task currentTask) {
+ synchronized (this) {
+ if (owner == null) {
+ owner = currentTask;
+ count = 1;
+ return true;
+ } else if (owner == currentTask) {
+ count = count + 1;
+ return true;
+ } else {
+ addListener(currentTask);
+ return false;
+ }
+ }
+ }
+
+ private synchronized Task _unlock(Task currentTask) {
+ Task next = null;
+
+ if (owner != currentTask) {
+ throw new IllegalStateException();
+ }
+
+ if ((count = count-1) == 0) {
+ owner = null;
+ if (waiters != null && !waiters.isEmpty()) {
+ next = waiters.removeFirst();
+ }
+ }
+
+ return next;
+ }
+
+ public void unlock() throws Pausable {
+ Task.errNotWoven();
+ }
+
+ public void unlock(Fiber f) {
+ Task next = _unlock(f.task);
+ _unlock2(next);
+ }
+
+ private void _unlock2(Task next) {
+ if (next != null) {
+ next.resume();
+ }
+ }
+
+ private void addListener(Task eo) {
+ if (waiters == null) {
+ waiters = new LinkedList<Task>();
+ }
+
+ waiters.add(eo);
+ }
+
+ public boolean isValid(Task t) {
+ synchronized(this) {
+ return waiters != null && waiters.contains(t);
+ }
+ }
+
+}
2  src/main/java/erjang/beam/BeamOpcode.java
View
@@ -148,6 +148,8 @@
recv_mark (0x96),
recv_set (0x97),
+ line (0x99),
+
// Opcode groups
test,
7 src/main/java/erjang/beam/Compiler.java
View
@@ -35,6 +35,7 @@
import kilim.analysis.Detector;
import kilim.mirrors.ClassMirrorNotFoundException;
import kilim.mirrors.Mirrors;
+import kilim.mirrors.RuntimeClassMirrors;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
@@ -70,7 +71,7 @@ public static void compile(BeamFileData data, ClassRepo repo) throws IOException
ClassWeaver.reset();
// class writer, phase 4
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
// class checker, optional phase
//CheckClassAdapter ca = new CheckClassAdapter(cw);
@@ -102,6 +103,8 @@ public static void compile(BeamFileData data, ClassRepo repo) throws IOException
boolean written = false;
ClassWeaver cwe = new ClassWeaver(byteArray, new ErjangDetector(
cv.getInternalClassName(), cv.non_pausable_methods));
+ cwe.weave();
+
for (ClassInfo ci : cwe.getClassInfos()) {
String name = ci.className;
byte[] bytes = ci.bytes;
@@ -137,7 +140,7 @@ public void compile(File file, BeamLoader beam_parser) throws IOException {
* @param mirrors
*/
public ErjangDetector(String className, Set<String> nonPausableMethods) {
- super(Mirrors.getRuntimeMirrors());
+ super(new RuntimeClassMirrors());
this.className = className;
this.nonPausableMethods = nonPausableMethods;
}
44 src/main/java/erjang/beam/CompilerVisitor.java
View
@@ -127,8 +127,8 @@
*/
static final String ECOMPILEDMODULE_NAME = ECOMPILEDMODULE_TYPE.getInternalName();
static final Type ENUMBER_TYPE = Type.getType(ENumber.class);
- static final Type EOBJECT_TYPE = Type.getType(EObject.class);
- static final String EOBJECT_DESC = EOBJECT_TYPE.getDescriptor();
+ static final Type EOBJECT_TYPE;
+ static final String EOBJECT_DESC;
static final Type EPROC_TYPE = Type.getType(EProc.class);
static final String EPROC_NAME = EPROC_TYPE.getInternalName();
static final String EPROC_DESC = EPROC_TYPE.getDescriptor();
@@ -139,6 +139,11 @@
static final Type EEXCEPTION_TYPE = Type.getType(ErlangException.class);
static final String EEXCEPTION_DESC = EEXCEPTION_TYPE.getDescriptor();
+ static {
+ EOBJECT_TYPE = Type.getType(EObject.class);
+ EOBJECT_DESC = EOBJECT_TYPE.getDescriptor();
+ }
+
/**/
static final String GO_DESC = "(" + EPROC_TYPE.getDescriptor() + ")"
@@ -636,24 +641,37 @@ public void visitEnd() {
byte[] data = CompilerVisitor.make_invoker(module_name.getName(), fun_name.getName(), self_type, mname, mname,
arity, true, is_exported, lambda, EOBJECT_TYPE, funInfo.may_return_tail_marker, funInfo.is_pausable|funInfo.call_is_pausable);
+ boolean debug = full_inner_name.indexOf("pathtype") != -1;
+ if (debug) {
+ System.out.println("debug...");
+ }
+
ClassWeaver w = new ClassWeaver(data, new Compiler.ErjangDetector(
self_type.getInternalName(), non_pausable_methods));
- if (w.getClassInfos().size() == 0) { // Class did not need weaving
- try {
- classRepo.store(full_inner_name, data);
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else {
+ w.weave();
+
+ boolean written = false;
for (ClassInfo ci : w.getClassInfos()) {
+ try {
+ if (debug) System.out.println("> did weave "+ci.className);
+
+ String iname = ci.className.replace('.', '/');
+ if (iname.equals(full_inner_name)) {
+ written = true;
+ }
+
+ classRepo.store(iname, ci.bytes);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (!written) {
try {
- // System.out.println("> storing "+ci.className);
- classRepo.store(ci.className, ci.bytes);
+ classRepo.store(full_inner_name, data);
} catch (IOException e) {
e.printStackTrace();
}
}
- }
}
@@ -3066,7 +3084,7 @@ public Lambda get_lambda_freevars(EAtom fun, int arity_plus) {
String inner_name = "FN_" + mname;
String full_inner_name = outer_name + "$" + inner_name;
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
int residual_arity = arity - freevars;
String super_class_name = EFUN_NAME + residual_arity +
(exported ? "Exported" : "");
2  src/main/java/erjang/beam/analysis/BeamTypeAnalysis.java
View
@@ -656,6 +656,7 @@ private void accept_2(BlockVisitor2 vis, BeamExceptionHandler exh) {
case recv_mark:
case recv_set:
+ case line: // ignore
break;
case call_ext_last:
@@ -1832,6 +1833,7 @@ public void analyze0() {
case recv_mark:
case recv_set:
+ case line:
continue next_insn;
3  src/main/java/erjang/beam/interpreter/ops.spec
View
@@ -42,6 +42,9 @@ allocate slots:
deallocate slots:
STACK_DEALLOC(GET(slots));
+line number:
+ {}
+
%class II(i1:I, i2:I)
allocate_zero slots _live:
STACK_ALLOC(GET(slots));
1  src/main/java/erjang/beam/loader/BeamLoader.java
View
@@ -546,6 +546,7 @@ public Insn readInstruction() throws IOException {
case deallocate:
case call_fun:
case apply:
+ case line:
{
int i1 = readCodeInteger();
if (log.isLoggable(Level.FINE) && opcode==BeamOpcode.label) log.fine("DB| ### label "+i1+"###");
2  src/main/java/erjang/driver/LockingDriverInstance.java
View
@@ -23,7 +23,7 @@
import java.nio.channels.SelectableChannel;
import java.util.concurrent.locks.ReentrantLock;
-import kilim.Lock;
+import erjang.Lock;
import kilim.Pausable;
import kilim.Task;
2  src/main/java/erjang/driver/efile/Driver.java
View
@@ -21,7 +21,7 @@
import java.util.concurrent.locks.ReentrantLock;
-import kilim.Lock;
+import erjang.Lock;
import erjang.EString;
import erjang.NotImplemented;
import erjang.driver.EDriver;
2  src/main/java/erjang/driver/ram_file/Driver.java
View
@@ -21,7 +21,7 @@
import java.util.concurrent.locks.ReentrantLock;
-import kilim.Lock;
+import erjang.Lock;
import erjang.EString;
import erjang.driver.EDriver;
import erjang.driver.EDriverControl;
50 src/main/java/erjang/m/init/Native.java
View
@@ -0,0 +1,50 @@
+/**
+ * This file is part of Erjang - A JVM-based Erlang VM
+ *
+ * Copyright (c) 2009 by Trifork
+ *
+ * Licensed 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.
+ **/
+
+package erjang.m.init;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.Map;
+
+import erjang.BIF;
+import erjang.EAtom;
+import erjang.ENative;
+import erjang.EObject;
+import erjang.ERT;
+import erjang.EString;
+import erjang.ETuple2;
+import erjang.ECons;
+import erjang.NotImplemented;
+
+/**
+ * Native methods (BIFs) for the Erlang module 'os'.
+ *
+ * The fact that this class represents the module os is deduced from the package
+ * name,
+ */
+public class Native extends ENative {
+
+ @BIF public static EObject run_on_load_handlers() {
+ return ERT.TRUE;
+ }
+
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.