@@ -211,13 +211,13 @@ public class Compiler implements Opcodes{
211211static final public Var CONSTANT_IDS = Var .create ().setDynamic ();
212212
213213//vector<keyword>
214- static final public Var KEYWORD_CALLSITES = Var .create ().setDynamic ();
214+ static final public Var KEYWORD_CALLSITES = Var .create (null ).setDynamic ();
215215
216216//vector<var>
217- static final public Var PROTOCOL_CALLSITES = Var .create ().setDynamic ();
217+ static final public Var PROTOCOL_CALLSITES = Var .create (null ).setDynamic ();
218218
219219//set<var>
220- static final public Var VAR_CALLSITES = Var .create ().setDynamic ();
220+ // static final public Var VAR_CALLSITES = Var.create(null ).setDynamic();
221221
222222//keyword->constid
223223static final public Var KEYWORDS = Var .create ().setDynamic ();
@@ -4155,6 +4155,12 @@ static Object sigTag(int argcount, Var v){
41554155 return null ;
41564156 }
41574157
4158+ // Callsites are only registered in a function context
4159+ // In KEYWORD/PROTOCOL_CALLSITES, null indicates "do not register"
4160+ static boolean shouldRegisterCallsites (Var callSiteVar ) {
4161+ return callSiteVar .deref () != null ;
4162+ }
4163+
41584164 public InvokeExpr (String source , int line , int column , Symbol tag , Expr fexpr , IPersistentVector args , boolean tailPosition ) {
41594165 this .source = source ;
41604166 this .fexpr = fexpr ;
@@ -4167,7 +4173,7 @@ public InvokeExpr(String source, int line, int column, Symbol tag, Expr fexpr, I
41674173 {
41684174 Var fvar = ((VarExpr )fexpr ).var ;
41694175 Var pvar = (Var )RT .get (fvar .meta (), protocolKey );
4170- if (pvar != null && PROTOCOL_CALLSITES . isBound ( ))
4176+ if (pvar != null && shouldRegisterCallsites ( PROTOCOL_CALLSITES ))
41714177 {
41724178 this .isProtocol = true ;
41734179 this .siteIndex = registerProtocolCallsite (((VarExpr )fexpr ).var );
@@ -4389,7 +4395,7 @@ static public Expr parse(C context, ISeq form) {
43894395 }
43904396 }
43914397
4392- if (fexpr instanceof KeywordExpr && RT .count (form ) == 2 && KEYWORD_CALLSITES . isBound ( ))
4398+ if (fexpr instanceof KeywordExpr && RT .count (form ) == 2 && shouldRegisterCallsites ( KEYWORD_CALLSITES ))
43934399 {
43944400// fexpr = new ConstantExpr(new KeywordCallSite(((KeywordExpr)fexpr).k));
43954401 Expr target = analyze (context , RT .second (form ));
@@ -4572,7 +4578,7 @@ CONSTANT_IDS, new IdentityHashMap(),
45724578 VARS , PersistentHashMap .EMPTY ,
45734579 KEYWORD_CALLSITES , PersistentVector .EMPTY ,
45744580 PROTOCOL_CALLSITES , PersistentVector .EMPTY ,
4575- VAR_CALLSITES , emptyVarCallSites (),
4581+ // VAR_CALLSITES, emptyVarCallSites(),
45764582 NO_RECUR , null
45774583 ));
45784584
@@ -4652,7 +4658,7 @@ else if(methodArray[f.reqParms.count()] == null)
46524658 fn .constants = (PersistentVector ) CONSTANTS .deref ();
46534659 fn .keywordCallsites = (IPersistentVector ) KEYWORD_CALLSITES .deref ();
46544660 fn .protocolCallsites = (IPersistentVector ) PROTOCOL_CALLSITES .deref ();
4655- fn .varCallsites = (IPersistentSet ) VAR_CALLSITES .deref ();
4661+ // fn.varCallsites = (IPersistentSet) VAR_CALLSITES.deref();
46564662
46574663 fn .constantsID = RT .nextID ();
46584664// DynamicClassLoader loader = (DynamicClassLoader) LOADER.get();
@@ -4757,7 +4763,7 @@ static public class ObjExpr implements Expr{
47574763
47584764 IPersistentVector keywordCallsites ;
47594765 IPersistentVector protocolCallsites ;
4760- IPersistentSet varCallsites ;
4766+ // IPersistentSet varCallsites;
47614767 boolean onceOnly = false ;
47624768
47634769 Object src ;
@@ -5801,9 +5807,9 @@ String cachedVarName(int n){
58015807 return "__cached_var__" + n ;
58025808 }
58035809
5804- String varCallsiteName (int n ){
5805- return "__var__callsite__" + n ;
5806- }
5810+ // String varCallsiteName(int n){
5811+ // return "__var__callsite__" + n;
5812+ // }
58075813
58085814 String thunkNameStatic (int n ){
58095815 return thunkName (n ) + "__" ;
@@ -7800,9 +7806,6 @@ private static KeywordExpr registerKeyword(Keyword keyword){
78007806}
78017807
78027808private static int registerKeywordCallsite (Keyword keyword ){
7803- if (!KEYWORD_CALLSITES .isBound ())
7804- throw new IllegalAccessError ("KEYWORD_CALLSITES is not bound" );
7805-
78067809 IPersistentVector keywordCallsites = (IPersistentVector ) KEYWORD_CALLSITES .deref ();
78077810
78087811 keywordCallsites = keywordCallsites .cons (keyword );
@@ -7811,26 +7814,23 @@ private static int registerKeywordCallsite(Keyword keyword){
78117814}
78127815
78137816private static int registerProtocolCallsite (Var v ){
7814- if (!PROTOCOL_CALLSITES .isBound ())
7815- throw new IllegalAccessError ("PROTOCOL_CALLSITES is not bound" );
7816-
78177817 IPersistentVector protocolCallsites = (IPersistentVector ) PROTOCOL_CALLSITES .deref ();
78187818
78197819 protocolCallsites = protocolCallsites .cons (v );
78207820 PROTOCOL_CALLSITES .set (protocolCallsites );
78217821 return protocolCallsites .count ()-1 ;
78227822}
78237823
7824- private static void registerVarCallsite (Var v ){
7825- if (!VAR_CALLSITES .isBound ())
7826- throw new IllegalAccessError ("VAR_CALLSITES is not bound" );
7827-
7828- IPersistentCollection varCallsites = (IPersistentCollection ) VAR_CALLSITES .deref ();
7829-
7830- varCallsites = varCallsites .cons (v );
7831- VAR_CALLSITES .set (varCallsites );
7832- // return varCallsites.count()-1;
7833- }
7824+ // private static void registerVarCallsite(Var v){
7825+ // if(!VAR_CALLSITES.isBound())
7826+ // throw new IllegalAccessError("VAR_CALLSITES is not bound");
7827+ //
7828+ // IPersistentCollection varCallsites = (IPersistentCollection) VAR_CALLSITES.deref();
7829+ //
7830+ // varCallsites = varCallsites.cons(v);
7831+ // VAR_CALLSITES.set(varCallsites);
7832+ //// return varCallsites.count()-1;
7833+ // }
78347834
78357835static ISeq fwdPath (PathNode p1 ){
78367836 ISeq ret = null ;
@@ -8348,6 +8348,9 @@ public static Object compile(Reader rdr, String sourcePath, String sourceName) t
83488348 COLUMN_AFTER , pushbackReader .getColumnNumber (),
83498349 CONSTANTS , PersistentVector .EMPTY ,
83508350 CONSTANT_IDS , new IdentityHashMap (),
8351+ KEYWORD_CALLSITES , null ,
8352+ PROTOCOL_CALLSITES , null ,
8353+ //VAR_CALLSITES, null,
83518354 KEYWORDS , PersistentHashMap .EMPTY ,
83528355 VARS , PersistentHashMap .EMPTY
83538356 ,RT .UNCHECKED_MATH , RT .UNCHECKED_MATH .deref ()
@@ -8625,7 +8628,7 @@ CONSTANT_IDS, new IdentityHashMap(),
86258628 VARS , PersistentHashMap .EMPTY ,
86268629 KEYWORD_CALLSITES , PersistentVector .EMPTY ,
86278630 PROTOCOL_CALLSITES , PersistentVector .EMPTY ,
8628- VAR_CALLSITES , emptyVarCallSites (),
8631+ // VAR_CALLSITES, emptyVarCallSites(),
86298632 NO_RECUR , null ));
86308633 if (ret .isDeftype ())
86318634 {
@@ -8655,7 +8658,7 @@ VAR_CALLSITES, emptyVarCallSites(),
86558658 ret .constantsID = RT .nextID ();
86568659 ret .keywordCallsites = (IPersistentVector ) KEYWORD_CALLSITES .deref ();
86578660 ret .protocolCallsites = (IPersistentVector ) PROTOCOL_CALLSITES .deref ();
8658- ret .varCallsites = (IPersistentSet ) VAR_CALLSITES .deref ();
8661+ // ret.varCallsites = (IPersistentSet) VAR_CALLSITES.deref();
86598662 }
86608663 finally
86618664 {
0 commit comments