Skip to content

Commit fed9bc8

Browse files
committed
Merge branch '1.3-860/add-disable-locals-clearing' into pallet-1.3
2 parents f38f901 + 6303805 commit fed9bc8

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/jvm/clojure/lang/Compile.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ public class Compile{
2525
private static final String PATH_PROP = "clojure.compile.path";
2626
private static final String REFLECTION_WARNING_PROP = "clojure.compile.warn-on-reflection";
2727
private static final String UNCHECKED_MATH_PROP = "clojure.compile.unchecked-math";
28+
private static final String LOCALS_CLEARING_PROP = "clojure.compile.locals-clearing";
2829
private static final Var compile_path = RT.var("clojure.core", "*compile-path*");
2930
private static final Var compile = RT.var("clojure.core", "compile");
3031
private static final Var warn_on_reflection = RT.var("clojure.core", "*warn-on-reflection*");
3132
private static final Var unchecked_math = RT.var("clojure.core", "*unchecked-math*");
33+
private static final Var compiler_options = RT.var("clojure.core", "*compiler-options*");
3234

3335
public static void main(String[] args) throws IOException{
3436

@@ -47,10 +49,15 @@ public static void main(String[] args) throws IOException{
4749

4850
boolean warnOnReflection = System.getProperty(REFLECTION_WARNING_PROP, "false").equals("true");
4951
boolean uncheckedMath = System.getProperty(UNCHECKED_MATH_PROP, "false").equals("true");
52+
boolean localsClearing = System.getProperty(LOCALS_CLEARING_PROP, "true").equals("true");
5053

5154
try
5255
{
53-
Var.pushThreadBindings(RT.map(compile_path, path, warn_on_reflection, warnOnReflection, unchecked_math, uncheckedMath));
56+
Var.pushThreadBindings(RT.map(compile_path, path,
57+
warn_on_reflection, warnOnReflection,
58+
unchecked_math, uncheckedMath,
59+
compiler_options,
60+
((PersistentHashMap)compiler_options.deref()).assoc(RT.localsClearing, localsClearing)));
5461

5562
for(String lib : args)
5663
{

src/jvm/clojure/lang/Compiler.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ public class Compiler implements Opcodes{
239239
static final public Var ADD_ANNOTATIONS = Var.intern(Namespace.findOrCreate(Symbol.intern("clojure.core")),
240240
Symbol.intern("add-annotations"));
241241

242-
243242
//Integer
244243
static final public Var LINE = Var.create(0).setDynamic();
245244

@@ -5426,8 +5425,8 @@ public static class LocalBinding{
54265425
public final int idx;
54275426
public final String name;
54285427
public final boolean isArg;
5429-
public final PathNode clearPathRoot;
5430-
public boolean canBeCleared = true;
5428+
public final PathNode clearPathRoot;
5429+
public boolean canBeCleared = (Boolean)((PersistentHashMap)RT.COMPILER_OPTIONS.deref()).valAt(RT.localsClearing);
54315430
public boolean recurMistmatch = false;
54325431

54335432
public LocalBinding(int num, Symbol sym, Symbol tag, Expr init, boolean isArg,PathNode clearPathRoot)

src/jvm/clojure/lang/RT.java

+3
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ public class RT{
213213
final static Var WARN_ON_REFLECTION = Var.intern(CLOJURE_NS, Symbol.intern("*warn-on-reflection*"), F).setDynamic();
214214
final static Var ALLOW_UNRESOLVED_VARS = Var.intern(CLOJURE_NS, Symbol.intern("*allow-unresolved-vars*"), F).setDynamic();
215215

216+
final static Keyword localsClearing = Keyword.intern("locals-clearing");
217+
final static Var COMPILER_OPTIONS = Var.intern(CLOJURE_NS, Symbol.intern("*compiler-options*"), PersistentHashMap.create(localsClearing, true)).setDynamic();
218+
216219
final static Var IN_NS_VAR = Var.intern(CLOJURE_NS, Symbol.intern("in-ns"), F);
217220
final static Var NS_VAR = Var.intern(CLOJURE_NS, Symbol.intern("ns"), F);
218221
final static Var FN_LOADER_VAR = Var.intern(CLOJURE_NS, Symbol.intern("*fn-loader*"), null).setDynamic();

0 commit comments

Comments
 (0)