Skip to content

Inline MStack operations and allow sizing stacks up front - #1739

Open
olabusayoT wants to merge 1 commit into
apache:mainfrom
olabusayoT:daf-3065-mstack
Open

olabusayoT wants to merge 1 commit into
apache:mainfrom
olabusayoT:daf-3065-mstack

Conversation

@olabusayoT

Copy link
Copy Markdown
Contributor

MStack's @specialized annotation has no effect under Scala 3, so push, pop, setTop and top on the Boolean, Int, Long and reference stacks boxed the element and went through ScalaRunTime's type-dispatching array_update and array_apply. Make push, pop, setTop, top and bottom inline, so each call site is expanded with the stack's concrete element type and compiles to direct array loads and stores.

Stacks take an initialSize, 32 by default, so a caller that knows its depth can avoid growing the array. A diagnostic, off unless MStack.trackMaxSizeReached is set, records the deepest a stack has grown, for choosing a size. TestMStack covers the operations, growth and copyFrom.

DAFFODIL-3065

MStack's @specialized annotation has no effect under Scala 3, so push, pop, setTop and top on the Boolean, Int, Long and reference stacks boxed the element and went through ScalaRunTime's type-dispatching array_update and array_apply. Make push, pop, setTop, top and bottom inline, so each call site is expanded with the stack's concrete element type and compiles to direct array loads and stores.

Stacks take an initialSize, 32 by default, so a caller that knows its depth can avoid growing the array. A diagnostic, off unless MStack.trackMaxSizeReached is set, records the deepest a stack has grown, for choosing a size. TestMStack covers the operations, growth and copyFrom.

DAFFODIL-3065
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant