Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Issue 10968059: Support for unboxed 64-bit integer bitwise operations and equality on ia32. (Closed)

Created:
8 years, 3 months ago by Florian Schneider
Modified:
8 years, 2 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Support for unboxed 64-bit integer bitwise operations and equality on ia32. This CL adds AND, OR, XOR and == operations on unboxed 64-bit integers (aka. mints). Unboxed mints are stored in xmm registers. Each xmm register location has an additional bit to keep track of its value representation. Unboxed mints are materialized on the heap on deoptmization in the same way as unboxed doubles. The SSE instructions used are available on all CPUs that support SSE 4.1. Committed: https://code.google.com/p/dart/source/detail?r=13112

Patch Set 1 #

Total comments: 16

Patch Set 2 : #

Patch Set 3 : fixed boxing of smis and added one more test #

Total comments: 6

Patch Set 4 : addressed comments, added tests and flags #

Total comments: 28

Patch Set 5 : addressed comments #

Patch Set 6 : rebased #

Patch Set 7 : fixed one more ResultCid previously forgotten #

Patch Set 8 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1081 lines, -57 lines) Patch
M runtime/vm/assembler_ia32.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/vm/assembler_ia32.cc View 1 2 3 4 5 2 chunks +53 lines, -0 lines 0 comments Download
M runtime/vm/assembler_ia32_test.cc View 1 2 3 4 5 1 chunk +117 lines, -0 lines 0 comments Download
M runtime/vm/code_generator.cc View 1 2 3 4 5 1 chunk +21 lines, -2 lines 0 comments Download
M runtime/vm/deopt_instructions.h View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
M runtime/vm/deopt_instructions.cc View 1 2 3 4 5 5 chunks +93 lines, -2 lines 0 comments Download
M runtime/vm/disassembler_ia32.cc View 1 2 3 4 5 4 chunks +55 lines, -10 lines 0 comments Download
M runtime/vm/flow_graph_allocator.h View 1 2 3 4 5 6 chunks +15 lines, -3 lines 0 comments Download
M runtime/vm/flow_graph_allocator.cc View 1 2 3 4 5 12 chunks +43 lines, -10 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 1 2 3 4 5 2 chunks +12 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 2 3 4 5 2 chunks +8 lines, -0 lines 0 comments Download
runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 5 7 chunks +41 lines, -9 lines 0 comments Download
M runtime/vm/il_printer.cc View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 5 8 chunks +136 lines, -2 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 2 chunks +30 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 2 3 4 5 5 chunks +219 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 2 3 4 5 1 chunk +33 lines, -0 lines 0 comments Download
M runtime/vm/isolate.h View 1 2 3 4 5 4 chunks +32 lines, -2 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/locations.h View 1 2 3 4 5 8 chunks +69 lines, -16 lines 0 comments Download
A tests/language/mint_arithmetic.dart View 1 2 3 4 1 chunk +76 lines, -0 lines 0 comments Download
M tests/standalone/medium_integer_test.dart View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Florian Schneider
Please have a look. This is working and ready except it is still missing a ...
8 years, 3 months ago (2012-09-24 13:42:08 UTC) #1
Florian Schneider
https://codereview.chromium.org/10968059/diff/1/runtime/vm/intermediate_language.h File runtime/vm/intermediate_language.h (right): https://codereview.chromium.org/10968059/diff/1/runtime/vm/intermediate_language.h#newcode3555 runtime/vm/intermediate_language.h:3555: class BinarySmiOpInstr : public TemplateDefinition<2> { This diff looks ...
8 years, 3 months ago (2012-09-24 13:43:38 UTC) #2
Vyacheslav Egorov (Google)
comments https://codereview.chromium.org/10968059/diff/1/runtime/vm/assembler_ia32_test.cc File runtime/vm/assembler_ia32_test.cc (right): https://codereview.chromium.org/10968059/diff/1/runtime/vm/assembler_ia32_test.cc#newcode1673 runtime/vm/assembler_ia32_test.cc:1673: double res = reinterpret_cast<OrpdCode>(entry)(12.56e3); Maybe or two different ...
8 years, 3 months ago (2012-09-24 14:53:42 UTC) #3
srdjan
Good stuff! What Slava said and following DBC. - Regarding SSE instructions, the VM should ...
8 years, 3 months ago (2012-09-24 17:29:24 UTC) #4
Florian Schneider
https://codereview.chromium.org/10968059/diff/1/runtime/vm/assembler_ia32_test.cc File runtime/vm/assembler_ia32_test.cc (right): https://codereview.chromium.org/10968059/diff/1/runtime/vm/assembler_ia32_test.cc#newcode1673 runtime/vm/assembler_ia32_test.cc:1673: double res = reinterpret_cast<OrpdCode>(entry)(12.56e3); On 2012/09/24 14:53:42, Vyacheslav Egorov ...
8 years, 2 months ago (2012-09-26 11:51:32 UTC) #5
Florian Schneider
Addressed feedback. @srdjan, could you have another look? Once this is landed, I'll add more ...
8 years, 2 months ago (2012-09-27 09:39:52 UTC) #6
srdjan
LGTM with comments http://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32.cc File runtime/vm/assembler_ia32.cc (right): http://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32.cc#newcode704 runtime/vm/assembler_ia32.cc:704: void Assembler::orpd(XmmRegister dst, XmmRegister src) { ...
8 years, 2 months ago (2012-09-28 16:50:26 UTC) #7
Florian Schneider
8 years, 2 months ago (2012-10-02 11:10:31 UTC) #8
https://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32.cc
File runtime/vm/assembler_ia32.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32...
runtime/vm/assembler_ia32.cc:704: void Assembler::orpd(XmmRegister dst,
XmmRegister src) {
On 2012/09/28 16:50:26, srdjan wrote:
> Please add asserts at SSE4_1 only instructions.

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32...
File runtime/vm/assembler_ia32_test.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/assembler_ia32...
runtime/vm/assembler_ia32_test.cc:1658: ASSEMBLER_TEST_GENERATE(Orpd, assembler)
{
On 2012/09/28 16:50:26, srdjan wrote:
> Disable appropriate tests if SSE4_1 not supported

I added tests for the 4.1 specific instructions. Those were not tested yet.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/deopt_instruct...
File runtime/vm/deopt_instructions.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/deopt_instruct...
runtime/vm/deopt_instructions.cc:125: class DeoptMintStackSlotInstr : public
DeoptInstr {
On 2012/09/28 16:50:26, srdjan wrote:
> Should this be Deopt64bitStackSlotInstr instead since it does not hold a Mint?

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/deopt_instruct...
File runtime/vm/deopt_instructions.h (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/deopt_instruct...
runtime/vm/deopt_instructions.h:59: }
On 2012/09/28 16:50:26, srdjan wrote:
> Sorry, actually this should be "XmmRegisterValueAsInt64" since you are not
> returning a Mint.

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/disassembler_i...
File runtime/vm/disassembler_ia32.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/disassembler_i...
runtime/vm/disassembler_ia32.cc:1013: UNIMPLEMENTED();
On 2012/09/28 16:50:26, srdjan wrote:
> UNREACHABLE() ?

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_all...
File runtime/vm/flow_graph_allocator.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_all...
runtime/vm/flow_graph_allocator.cc:590: instr->representation() ==
kUnboxedInteger) {
On 2012/09/28 16:50:26, srdjan wrote:
> Add parenthesis

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_all...
File runtime/vm/flow_graph_allocator.h (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_all...
runtime/vm/flow_graph_allocator.h:205: // by SSA temp index.
On 2012/09/28 16:50:26, srdjan wrote:
> The comment should say: unboxed Mint representation since it does not maintain
> unboxed Smi-s

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_com...
File runtime/vm/flow_graph_compiler_ia32.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_com...
runtime/vm/flow_graph_compiler_ia32.cc:27: DEFINE_FLAG(bool, unbox_integers,
true, "Optimize 64-bit integer arithmetic.");
On 2012/09/28 16:50:26, srdjan wrote:
> Should this be 'unbox_mints' since it does not do anything for unboxed  Smi-s?

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_com...
File runtime/vm/flow_graph_compiler_x64.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/flow_graph_com...
runtime/vm/flow_graph_compiler_x64.cc:28: DEFINE_FLAG(bool, unbox_integers,
false, "Optimize 64-bit integer arithmetic.");
On 2012/09/28 16:50:26, srdjan wrote:
> Do you need this flag? It will not work on X64 if we enable it, will it? Do
you
> plan to implement it at all? Maybe just return false in SupportsUnboxedMints.
> Maybe we could later have a flag unbox_integers which would unbox mints and
> Smi-s.

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
File runtime/vm/intermediate_language.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language.cc:1254: return kIntegerCid;
On 2012/09/28 16:50:26, srdjan wrote:
> This type is not very helpful. It would be good if we could be more precise,
> saying either kSmiCid or kMintCid. If you can't, then use kDynamicCid.

Done. If we don't know anything about the range of the value, it can be either
smi or mint.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language.cc:1264: return kIntegerCid;
On 2012/09/28 16:50:26, srdjan wrote:
> ditto. We should use only non-abstract class class-ids here. 

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
File runtime/vm/intermediate_language_ia32.cc (right):

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_ia32.cc:637: UNREACHABLE();
On 2012/09/28 16:50:26, srdjan wrote:
> UNIMPLEMENTED? since you may implement other comparisons in the future? Or
> inline that code in EmitUnboxed... 

Done.

https://codereview.chromium.org/10968059/diff/15001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_ia32.cc:2386: // Check if result fits into a
smi.
On 2012/09/28 16:50:26, srdjan wrote:
> It is a given in the VM that a Mint object can/should never fit into Smi.
Please
> add a comment why is this check still necessary (e.g., result of a Mint
> operation is not checked to fix into Smi?)

Done.

https://codereview.chromium.org/10968059/diff/15001/tests/language/mint_arith...
File tests/language/mint_arithmetic.dart (right):

https://codereview.chromium.org/10968059/diff/15001/tests/language/mint_arith...
tests/language/mint_arithmetic.dart:73: test_or_1();
On 2012/09/28 16:50:26, srdjan wrote:
> You need add a loop around to trigger optimization. Please run with
> --trace-deopt and --trace-compiler to verify the optimized compilation and
> deoptimization occurs

Done. There are already loops inside each test function. I'm adding one here
too.

Powered by Google App Engine
This is Rietveld 408576698