Skip to content

Enums that don't carry anything in their arms shouldn't use shape glue #2916

Description

@bblum
enum fast { x, y, z, w } 
enum slow<T> { a(T), b(T), c(T), d(T) }

fn foo(yy: fast, xx: fast) -> bool {
    ret yy == xx; 
}
fn bar(yy: slow<bool>, xx: slow<bool>) -> bool {
    ret yy == xx; 
}

Both foo and bar generate calls to upcall_cmp_type. It'd be nice if, for performance, the compiler could recognise that fast can be represented by a primitive and skip the upcalls.

Related to #2132.

Activity

  1. eholk commented on Jul 14, 2012

    @eholk
    Contributor

    Oh sad, I was really hoping we handled at least this case.

  2. bblum commented on Jul 16, 2012

    @bblum
    ContributorAuthor

    I know, right?

    Found during ICFP (#2928).

  3. catamorphism commented on Dec 6, 2012

    @catamorphism
    Contributor

    Obsolete, shape glue is dead.

  4. added a commit that references this issue on Jun 29, 2023
  5. added a commit that references this issue on Jul 4, 2026
  6. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions