Num should be an unboxed double
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mars |
Fix Committed
|
Medium
|
Matt Giuca |
Bug Description
In the LLVM backend, Num is currently represented as a double*. Every time a number value is created, a new 8-byte cell is malloced, the number is written to it, and it has to be garbage collected. The rationale for this is to support 32-bit platforms: all Mars values must be castable to %Any (currently an i8*), which is 4 bytes on a 32-bit platform and cannot hold a double value.
Num should be represented as an unboxed double, allowing for much faster creation of number values, as well as less storage. This means the %Any representation has to change. Change it to i64. On 64-bit platforms, there will be no change at runtime. On 32-bit platforms, this will change the generic type from a 1-word value to a 2-word value. This is not ideal for 32-bit platforms, but it will still make Num much more efficient (it's just a blow to the efficiency of the other types, which are pointers, and will therefore have 4 bytes of wasted space).
Related branches
- Matt Giuca: Pending requested
-
Diff: 204 lines (+32/-45)2 files modifiedlib/runtime.ll (+20/-34)
src/backend_llvm.m (+12/-11)
Fixed in trunk r1343.