diff options
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 1595eb1..38dee04 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -1822,9 +1822,8 @@ class Type_conversion_expression : public Expression // True if a string([]byte) conversion can reuse the backing store // without copying. Only used in string([]byte) conversion. bool no_copy_; - // True if a conversion to interface does not escape, so it does - // not need a heap allocation. Only used in type-to-interface - // conversion. + // True if a conversion does not escape. Used in type-to-interface + // conversions and slice-to/from-string conversions. bool no_escape_; }; @@ -3561,13 +3560,19 @@ class Allocation_expression : public Expression public: Allocation_expression(Type* type, Location location) : Expression(EXPRESSION_ALLOCATION, location), - type_(type), allocate_on_stack_(false) + type_(type), allocate_on_stack_(false), + no_zero_(false) { } void set_allocate_on_stack() { this->allocate_on_stack_ = true; } + // Mark that the allocated memory doesn't need zeroing. + void + set_no_zero() + { this->no_zero_ = true; } + protected: int do_traverse(Traverse*); @@ -3596,6 +3601,8 @@ class Allocation_expression : public Expression Type* type_; // Whether or not this is a stack allocation. bool allocate_on_stack_; + // Whether we don't need to zero the allocated memory. + bool no_zero_; }; // A general composite literal. This is lowered to a type specific @@ -4541,4 +4548,8 @@ class Numeric_constant Type* type_; }; +// Temporary buffer size for string conversions. +// Also known to the runtime as tmpStringBufSize in runtime/string.go. +static const int tmp_string_buf_size = 32; + #endif // !defined(GO_EXPRESSIONS_H) |