Casts inserted and I don't know why
Simn opened this issue · 2 comments
I'm currently trying to make the haxe-formatter benchmarks work with --hxb and --hxb-lib, and the only target that's still failing is hxcpp. The -D dump
output between both compilations is equal, but the .cpp files have various places that look like this:
Another one is this:
Which fails with this:
./src/formatter/marker/wrapping/MarkWrapping.cpp(289): error C2039: 'StaticCast': is not a member of 'hx::ObjectPtr<tokentree::utils::BrOpenType_obj>'
include\tokentree/utils/BrOpenType.h(9): note: see declaration of 'hx::ObjectPtr<tokentree::utils::BrOpenType_obj>'
I don't know what state we're not tracking that would allow an equal -D dump
output to generate different things. I'm thinking it must be something related to physical equality, but I can't immediately find anything of the sort.
Advice appreciated!
Found it! The problem was that the hxb reader kept the cf_type
as TLazy
, and some part of gencpp doesn't follow
it before matching it seems. This didn't show up in the dump because the printer does follow lazies. The fix was then to update cf_type. Timers look great as well:
Before:
name | time(s) | % | p% | # | info
--------------------------------------------------------------------------------------------------------------------------
command | 1.719 | 51 | 51 | 1 |
haxelib/tokentree/1,0,23/src/ -I -IC:\\git\\haxe\\std/cpp/_std/ -IC:\\git\\haxe\\std/ | 1.719 | 51 | 100 | 1 | haxelib run hxcpp Build.xml haxe -Dformatter="1.9.1" -Dhaxe="5.0.0-alpha.1" -Dhaxe3="1" -Dhaxe4="1" -Dhaxe_ver="5.000" -Dhaxeparser="3.3.0" -Dhxargs="3.0.2" -Dhxcpp_api_level="430" -Dhxcpp_smart_strings="1" -Dhxjsonast="1.0.1" -Dhxparse="4.3.0" -Djson2object="3.11.0" -Dsource_header="Generated by Haxe 5.0.0-alpha.1+68a393839" -Dstatic="1" -Dtarget.atomics="1" -Dtarget.name="cpp" -Dtarget.static="1" -Dtarget.sys="1" -Dtarget.threaded="1" -Dtarget.unicode="1" -Dtarget.utf16="1" -Dtokentree="1.0.23" -Dutf16="1" -I./ -IC:/git/benchmark-runner/.haxelib/formatter/1,9,1/src/ -IC:/git/benchmark-runner/.haxelib/hxargs/git/ -IC:/git/benchmark-runner/.haxelib/hxjsonast/1,0,1/src/ -IC:/git/benchmark-runner/.haxelib/json2object/git/src/ -IC:/git/benchmark-runner/.haxelib/hxparse/git/src/ -IC:/git/benchmark-runner/.haxelib/haxeparser/git/src/ -IC:/git/benchmark-runner/
generate | 0.602 | 18 | 18 | 350 |
cpp | 0.350 | 10 | 58 | 2 |
hxb | 0.252 | 7 | 42 | 348 |
DataBuilder | 0.052 | 2 | 21 | 1 | json2object.reader
Printer | 0.014 | 0 | 6 | 2 | haxe.macro
macro | 0.308 | 9 | 9 | 741 |
jit | 0.021 | 1 | 7 | 493 |
typing | 0.302 | 9 | 9 | 205 |
parsing | 0.189 | 6 | 6 | 415 |
filters | 0.161 | 5 | 5 | 29925 |
analyzer | 0.099 | 3 | 3 | 85597 |
--------------------------------------------------------------------------------------------------------------------------
total | 3.384 | 100 | 100 | 117237 |
After:
name | time(s) | % | p% | # | info
--------------------------------------------------------------------------------------------
command | 1.659 | 76 | 76 | 1 |
/ -I -IC:\\git\\haxe\\std/cpp/_std/ -IC:\\git\\haxe\\std/ | 1.659 | 76 | 100 | 1 | haxelib run hxcpp Build.xml haxe -Dhaxe="5.0.0-alpha.1" -Dhaxe3="1" -Dhaxe4="1" -Dhaxe_ver="5.000" -Dhxcpp_api_level="430" -Dhxcpp_smart_strings="1" -Dsource_header="Generated by Haxe 5.0.0-alpha.1+68a393839" -Dstatic="1" -Dtarget.atomics="1" -Dtarget.name="cpp" -Dtarget.static="1" -Dtarget.sys="1" -Dtarget.threaded="1" -Dtarget.unicode="1" -Dtarget.utf16="1" -Dutf16="1" -I
generate | 0.368 | 17 | 17 | 2 |
cpp | 0.368 | 17 | 100 | 2 |
typing | 0.061 | 3 | 3 | 1 |
filters | 0.033 | 2 | 2 | 1191 |
hxb | 0.031 | 1 | 1 | 3976 |
read | 0.031 | 1 | 100 | 3976 |
MDF | 0.011 | 0 | 34 | 257 |
hxblib | 0.021 | 1 | 1 | 258 |
get bytes | 0.020 | 1 | 95 | 257 |
--------------------------------------------------------------------------------------------
total | 2.176 | 100 | 100 | 6056 |