2025-05-09 17:09 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000314mercuryBugpublic2014-04-22 16:56
Reporterzs 
Assigned Tozs 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000314: macros creating temporary frames for det & nondet stack ignore the need for new stack segments
DescriptionThe code inside #ifdef MR_STACK_SEGMENTS in runtime/mercury_stacks.h only considers the main stack frames on the det and nondet stacks, the ones we allocate at procedure entry. The temporary frames we allocate later in procedure bodies use macros that check for overflow, but do NOT allocate new segments if the allocation does not in fact fit in the current stack segment.

A minor problem is that the implications of stack segments for the handling of failures is not documented in compiler/notes/failure.html.
Steps To ReproduceFor me, the attached program, when compiled in grade asm_fast.gc.debug.stseg, will work when invoked as "bug302 1012" but not "bug302 1013". The numbers may be different in other machines, but should exist on all.
TagsNo tags attached.
Attached Files
  • ? file icon bug302.m (1,402 bytes) 2014-01-30 18:25

-Relationships
+Relationships

-Notes

~0000634

pbone (administrator)

Is it valid to create a new segment for a temporary frame? If i understand temporary frames correctly they belong to real frames. Can the temporary frame belong on a different segment from it's real frame?

Thanks.

~0000635

zs (developer)

Temp frames do have a redofr slot to go with the redoip slot; curfr is set from the redofr slot when backtracking to the redoip address. This SHOULD make it possible to have a temp frame on a different segment than the main frame of the relevant procedure, but the details are NOT obvious.

Also, any fix should also work for det temp frames. We will need a new test case for that, and since det temp frames are rare, creating that test case won't be easy either.

~0000661

zs (developer)

Fix committed april 18.
+Notes

-Issue History
Date Modified Username Field Change
2014-01-30 18:25 zs New Issue
2014-01-30 18:25 zs File Added: bug302.m
2014-01-31 10:16 pbone Note Added: 0000634
2014-01-31 14:18 zs Note Added: 0000635
2014-02-17 13:25 zs Assigned To => zs
2014-02-17 13:25 zs Status new => assigned
2014-04-22 16:56 zs Note Added: 0000661
2014-04-22 16:56 zs Status assigned => closed
2014-04-22 16:56 zs Resolution open => fixed
+Issue History