private void load() { if(fn == null) { try { fn = (IFn) Class.forName(fnClassName,true,loader).newInstance(); } catch(Exception e) { throw Util.sneakyThrow(e); } v.root = fn; } }
public static int hashUnordered(Iterable xs){ int hash = 0; int n = 0; for(Object x : xs) { hash += Util.hasheq(x); ++n; } return mixCollHash(hash, n); }
public int findIndex(Object key){ for(int i = 0; i < 2*count; i+=2) { if(Util.equiv(key, array[i])) return i; } return -1; }
public int indexOf(Object o) { if(array != null) for (int j = i; j < array.length; j++) if (Util.equals(o, array[j])) return j - i; return -1; }
throw Util.runtimeException("No such namespace: " + sym.ns); throw Util.runtimeException("No such var: " + sym); else if(v.ns != currentNS() && !v.isPublic() && !allowPrivate) throw new IllegalStateException("var: " + sym + " is not public"); else if(Util.equals(sym, COMPILE_STUB_SYM.get())) return COMPILE_STUB_CLASS.get(); Object o = n.getMapping(sym); throw Util.runtimeException("Unable to resolve symbol: " + sym + " in this context");
public int hashCode(){ return Util.hashCombine(name.hashCode(), Util.hash(ns)); }
public Class defineClass(String name, byte[] bytes, Object srcForm){ Util.clearCache(rq, classCache); Class c = defineClass(name, bytes, 0, bytes.length); classCache.put(name, new SoftReference(c,rq)); return c; }
public int compare(Object o1, Object o2){ return Util.compare(o1, o2); }
private int indexOfObject(Object key){ Util.EquivPred ep = Util.equivPred(key); for(int i = 0; i < array.length; i += 2) { if(ep.equiv(key, array[i])) return i; } return -1; }
public static int hasheq(Object o){ if(o == null) return 0; if(o instanceof IHashEq) return dohasheq((IHashEq) o); if(o instanceof Number) return Numbers.hasheq((Number)o); return o.hashCode(); }
Type constantType(int id){ Object o = constants.nth(id); Class c = clojure.lang.Util.classOf(o); if(c!= null && Modifier.isPublic(c.getModifiers())) { //can't emit derived fn types due to visibility if(LazySeq.class.isAssignableFrom(c)) return Type.getType(ISeq.class); else if(c == Keyword.class) return Type.getType(Keyword.class); // else if(c == KeywordCallSite.class) // return Type.getType(KeywordCallSite.class); else if(RestFn.class.isAssignableFrom(c)) return Type.getType(RestFn.class); else if(AFn.class.isAssignableFrom(c)) return Type.getType(AFn.class); else if(c == Var.class) return Type.getType(Var.class); else if(c == String.class) return Type.getType(String.class); // return Type.getType(c); } return OBJECT_TYPE; }
static boolean equalKey(Object k1, Object k2){ if(k1 instanceof Keyword) return k1 == k2; return Util.equiv(k1, k2); }
public boolean equals(Object o){ if(this == o) return true; if(!(o instanceof Symbol)) return false; Symbol symbol = (Symbol) o; return Util.equals(ns,symbol.ns) && name.equals(symbol.name); }
public int hasheq() { if(_hasheq == 0){ _hasheq = Util.hashCombine(Murmur3.hashUnencodedChars(name), Util.hash(ns)); } return _hasheq; }
public Class defineClass(String name, byte[] bytes, Object srcForm){ Util.clearCache(rq, classCache); Class c = defineClass(name, bytes, 0, bytes.length); classCache.put(name, new SoftReference(c,rq)); return c; }
public int compare(Object o1, Object o2){ return Util.compare(o1, o2); }
private int indexOfObject(Object key){ Util.EquivPred ep = Util.equivPred(key); for(int i = 0; i < array.length; i += 2) { if(ep.equiv(key, array[i])) return i; } return -1; }
public static int hasheq(Object o){ if(o == null) return 0; if(o instanceof IHashEq) return dohasheq((IHashEq) o); if(o instanceof Number) return Numbers.hasheq((Number)o); if(o instanceof String) return Murmur3.hashInt(o.hashCode()); return o.hashCode(); }
Type constantType(int id){ Object o = constants.nth(id); Class c = clojure.lang.Util.classOf(o); if(c!= null && Modifier.isPublic(c.getModifiers())) { //can't emit derived fn types due to visibility if(LazySeq.class.isAssignableFrom(c)) return Type.getType(ISeq.class); else if(c == Keyword.class) return Type.getType(Keyword.class); // else if(c == KeywordCallSite.class) // return Type.getType(KeywordCallSite.class); else if(RestFn.class.isAssignableFrom(c)) return Type.getType(RestFn.class); else if(AFn.class.isAssignableFrom(c)) return Type.getType(AFn.class); else if(c == Var.class) return Type.getType(Var.class); else if(c == String.class) return Type.getType(String.class); // return Type.getType(c); } return OBJECT_TYPE; }