Commit a303f67a authored by Kevin Modzelewski's avatar Kevin Modzelewski

Do the same for float

parent affb88b1
...@@ -62,10 +62,8 @@ static CompilerType* unboxedType(ConcreteCompilerType* t) { ...@@ -62,10 +62,8 @@ static CompilerType* unboxedType(ConcreteCompilerType* t) {
return BOOL; return BOOL;
if (t == BOXED_INT) if (t == BOXED_INT)
return INT; return INT;
#if ENABLE_UNBOXED_VALUES
if (t == BOXED_FLOAT) if (t == BOXED_FLOAT)
return FLOAT; return FLOAT;
#endif
return t; return t;
} }
......
This diff is collapsed.
...@@ -418,8 +418,13 @@ CompilerVariable* makeInt(llvm::Value*); ...@@ -418,8 +418,13 @@ CompilerVariable* makeInt(llvm::Value*);
CompilerVariable* makeUnboxedInt(IREmitter&, ConcreteCompilerVariable*); CompilerVariable* makeUnboxedInt(IREmitter&, ConcreteCompilerVariable*);
CompilerVariable* makeUnboxedInt(IREmitter&, llvm::Value*); CompilerVariable* makeUnboxedInt(IREmitter&, llvm::Value*);
// Same for floats:
CompilerVariable* makeFloat(llvm::Value*);
CompilerVariable* makeFloat(double);
CompilerVariable* makeUnboxedFloat(IREmitter&, ConcreteCompilerVariable*);
CompilerVariable* makeUnboxedFloat(IREmitter&, llvm::Value*);
ConcreteCompilerVariable* makeBool(bool); ConcreteCompilerVariable* makeBool(bool);
ConcreteCompilerVariable* makeFloat(double);
ConcreteCompilerVariable* makeLong(Box*); ConcreteCompilerVariable* makeLong(Box*);
ConcreteCompilerVariable* makePureImaginary(Box*); ConcreteCompilerVariable* makePureImaginary(Box*);
CompilerVariable* makeStr(BoxedString*); CompilerVariable* makeStr(BoxedString*);
......
...@@ -1521,13 +1521,9 @@ private: ...@@ -1521,13 +1521,9 @@ private:
if (t == BOXED_INT) { if (t == BOXED_INT) {
return makeUnboxedInt(emitter, v); return makeUnboxedInt(emitter, v);
} }
#if ENABLE_UNBOXED_VALUES
if (t == BOXED_FLOAT) { if (t == BOXED_FLOAT) {
llvm::Value* unboxed = emitter.getBuilder()->CreateCall(g.funcs.unboxFloat, v); return makeUnboxedFloat(emitter, v);
ConcreteCompilerVariable* rtn = new ConcreteCompilerVariable(FLOAT, unboxed, true);
return rtn;
} }
#endif
if (t == BOXED_BOOL) { if (t == BOXED_BOOL) {
llvm::Value* unboxed = emitter.getBuilder()->CreateCall(g.funcs.unboxBool, v); llvm::Value* unboxed = emitter.getBuilder()->CreateCall(g.funcs.unboxBool, v);
return boolFromI1(emitter, unboxed); return boolFromI1(emitter, unboxed);
...@@ -2211,10 +2207,8 @@ private: ...@@ -2211,10 +2207,8 @@ private:
converted_args.push_back(var); converted_args.push_back(var);
assert(var->getType() != BOXED_INT); assert(var->getType() != BOXED_INT);
#if ENABLE_UNBOXED_VALUES
assert(var->getType() != BOXED_FLOAT assert(var->getType() != BOXED_FLOAT
&& "should probably unbox it, but why is it boxed in the first place?"); && "should probably unbox it, but why is it boxed in the first place?");
#endif
// This line can never get hit right now for the same reason that the variables must already be // This line can never get hit right now for the same reason that the variables must already be
// concrete, // concrete,
...@@ -2672,9 +2666,6 @@ public: ...@@ -2672,9 +2666,6 @@ public:
ASSERT(var->getType()->isUsable(), "%s", name.c_str()); ASSERT(var->getType()->isUsable(), "%s", name.c_str());
#if ENABLE_UNBOXED_VALUES
assert(var->getType() != BOXED_FLOAT);
#endif
CompilerVariable*& cur = symbol_table[name]; CompilerVariable*& cur = symbol_table[name];
assert(cur == NULL); assert(cur == NULL);
cur = var; cur = var;
......
...@@ -51,12 +51,6 @@ extern bool ENABLE_ICS, ENABLE_ICGENERICS, ENABLE_ICGETITEMS, ENABLE_ICSETITEMS, ...@@ -51,12 +51,6 @@ extern bool ENABLE_ICS, ENABLE_ICGENERICS, ENABLE_ICGETITEMS, ENABLE_ICSETITEMS,
extern bool BOOLS_AS_I64; extern bool BOOLS_AS_I64;
#define ENABLE_SAMPLING_PROFILER 0 #define ENABLE_SAMPLING_PROFILER 0
// Our current implementation of unbox values has some minor compatibility issues, where it can
// change the apparent id() / is-equality of a boxed value (by inserting extra unbox+box pairs).
// I think it can be rescued (we need the unboxed compilertype to remember the boxed value),
// but for now it's just turned off with this flag.
#define ENABLE_UNBOXED_VALUES 0
} }
} }
......
...@@ -93,10 +93,10 @@ template <class V> class ValuedCompilerType; ...@@ -93,10 +93,10 @@ template <class V> class ValuedCompilerType;
typedef ValuedCompilerType<llvm::Value*> ConcreteCompilerType; typedef ValuedCompilerType<llvm::Value*> ConcreteCompilerType;
ConcreteCompilerType* typeFromClass(BoxedClass*); ConcreteCompilerType* typeFromClass(BoxedClass*);
extern ConcreteCompilerType* UNBOXED_INT, *BOXED_INT, *LONG, *FLOAT, *BOXED_FLOAT, *UNKNOWN, *BOOL, *STR, *NONE, *LIST, extern ConcreteCompilerType* UNBOXED_INT, *BOXED_INT, *LONG, *UNBOXED_FLOAT, *BOXED_FLOAT, *UNKNOWN, *BOOL, *STR, *NONE, *LIST,
*SLICE, *ELLIPSIS, *MODULE, *DICT, *BOOL, *BOXED_BOOL, *BOXED_TUPLE, *SET, *FROZENSET, *CLOSURE, *GENERATOR, *SLICE, *ELLIPSIS, *MODULE, *DICT, *BOOL, *BOXED_BOOL, *BOXED_TUPLE, *SET, *FROZENSET, *CLOSURE, *GENERATOR,
*BOXED_COMPLEX, *FRAME_INFO; *BOXED_COMPLEX, *FRAME_INFO;
extern CompilerType* UNDEF, *INT; extern CompilerType* UNDEF, *INT, *FLOAT;
class CompilerVariable; class CompilerVariable;
template <class V> class ValuedCompilerVariable; template <class V> class ValuedCompilerVariable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment