Commit 0d14ad57 authored by Predrag Rudic's avatar Predrag Rudic Committed by Commit Bot

[builtins] Fix union initialization

Fix d4c157ee commit

On big endian platforms wrong byte is being read when accessing
"parameter_count" field of union, in function
failing on MIPS big endian platforms.

Builtins: :GetStackParameterCount. It is the reason of several tests
Bug: 
Change-Id: Ia21aba80a89215022ee218d27552b5b4ea18a0db
Reviewed-on: https://chromium-review.googlesource.com/603808
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@imgtec.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47330}
parent 83887f2d
......@@ -26,7 +26,11 @@ namespace {
struct BuiltinMetadata {
const char* name;
Builtins::Kind kind;
union {
union KindSpecificData {
KindSpecificData(Address cpp_entry) : cpp_entry(cpp_entry) {}
KindSpecificData(int8_t parameter_count)
: parameter_count(parameter_count) {}
KindSpecificData() = default;
Address cpp_entry; // For CPP and API builtins.
int8_t parameter_count; // For TFJ builtins.
} kind_specific_data;
......@@ -38,7 +42,7 @@ struct BuiltinMetadata {
#define DECL_API(Name, ...) { #Name, Builtins::API, \
{ FUNCTION_ADDR(Builtin_##Name) }},
#define DECL_TFJ(Name, Count, ...) { #Name, Builtins::TFJ, \
{ reinterpret_cast<Address>(Count) }},
{ static_cast<int8_t>(Count) }},
#define DECL_TFC(Name, ...) { #Name, Builtins::TFC, {} },
#define DECL_TFS(Name, ...) { #Name, Builtins::TFS, {} },
#define DECL_TFH(Name, ...) { #Name, Builtins::TFH, {} },
......
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