private static EObject send_to_remote( EProc proc, ETuple dest, EAtom node_name, EAtom reg_name, EObject msg, EObject options) throws Pausable { // INVARIANT: t == ETuple.make(node_name, reg_name) if (node_name == getLocalNode().node) { // We're talking to ourselves send_to_locally_registered(proc, reg_name, msg); return am_ok; // Even if the process does not exist. // TODO: Return 'noconnect' if options contain noconnect?... } else { // We're talking to another node if (ipclog.isLoggable(Level.FINE)) { ipclog.fine("sending msg " + dest + " ! " + msg); } EAbstractNode node = EPeer.get(node_name); if (node == null) { EObject[] args = (options != null ? new EObject[] {dest, msg, options} : new EObject[] {dest, msg, ERT.NIL}); return erlang__dsend__3.invoke(proc, args); } else { node.dsig_reg_send(proc.self_handle(), reg_name, msg); return am_ok; } } }
public static EObject apply_list_last(EProc proc, EObject mod, EObject fun, ESeq seq, int len) throws Pausable { EAtom f = fun.testAtom(); ESeq a = seq.testSeq(); if (f == null || a == null) throw ERT.badarg(mod, fun, seq); EFun found = resolve_fun(mod, fun, len); if (len > 9) { // TODO: make it real tail recursion in stead return found.invoke(proc, a.toArray()); } proc.tail = found; a = a.reverse(); switch (len) { default: throw new NotImplemented(); case 9: proc.arg8 = a.head(); a = a.tail(); case 8: proc.arg7 = a.head(); a = a.tail(); case 7: proc.arg6 = a.head(); a = a.tail(); case 6: proc.arg5 = a.head(); a = a.tail(); case 5: proc.arg4 = a.head(); a = a.tail(); case 4: proc.arg3 = a.head(); a = a.tail(); case 3: proc.arg2 = a.head(); a = a.tail(); case 2: proc.arg1 = a.head(); a = a.tail(); case 1: proc.arg0 = a.head(); a = a.tail(); case 0: } return EProc.TAIL_MARKER; }