Num should be an unboxed double

Bug #1159318 reported by Matt Giuca
6
This bug affects 1 person
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).

Tags: llvm

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r1343.

Changed in mars:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.