Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupt objects running test suite #679

Closed
c3d opened this issue Jan 6, 2024 · 7 comments
Closed

Corrupt objects running test suite #679

c3d opened this issue Jan 6, 2024 · 7 comments
Labels
bug Something isn't working done Issues that are done on dev (will be in next release) test Issues related to the test suite

Comments

@c3d
Copy link
Owner

c3d commented Jan 6, 2024

While running the test suite, the object::object_error function gets invoked.

@c3d c3d added the bug Something isn't working label Jan 6, 2024
@c3d c3d added this to the RPL implementation milestone Jan 6, 2024
@c3d c3d added the test Issues related to the test suite label Jan 6, 2024
@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

The stack trace in the debugger shows that this is in the runtime loop running the command (in my case, 12 typename):

    frame #0: 0x0000000100061b70 db48x`object::object_error(object::id, object const*) + 40 at db48x/src/object.cc:714
    frame #1: 0x000000010001b370 db48x`object::type() const + 144 at db48x/src/object.h:249
    frame #2: 0x000000010001b2c4 db48x`object::ops() const + 24 at db48x/src/object.h:261
    frame #3: 0x000000010001aaf8 db48x`object::size() const + 28 at db48x/src/object.h:270
    frame #4: 0x000000010005ec98 db48x`object::skip() const + 28 at db48x/src/object.h:279
  * frame #5: 0x000000010010d640 db48x`runtime::run_next(unsigned long) + 164 at db48x/src/runtime.h:537
    frame #6: 0x000000010010d38c db48x`program::run_loop(unsigned long) + 200 at db48x/src/program.cc:155
    frame #7: 0x000000010010d254 db48x`program::run(bool) const + 384 at db48x/src/program.cc:120
    frame #8: 0x0000000100033d34 db48x`user_interface::end_edit() + 1304 at db48x/src/user_interface.cc:332

The next and end fields are inconsistent (next is after end):

(lldb) p next
(object_p) 0x000000010e8313f4
(lldb) p end
(object_p) 0x000000010e83a2e5

The next field is at rt.Temporaries, which is not normal. This would indicate that the garbage collector did not correctly move it back while compacting, but the record of that happening has been lost. The last gc entries in the recorder are:

[16115398 33.032465] gc: Garbage collection, available 7, range 0x10e831356-0x10e83a39a
[16117658 33.032753] gc: Garbage collection done, purged 36494, available 36501
[16746510 42.259837] gc: Garbage collection, available 251, range 0x10e831356-0x10e83a2e5
[16753701 42.260827] gc: Garbage collection done, purged 36602, available 36853

The range is wrong.

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

The test next < end passes: next is 0x000000010e8313f4, end is 0x000000010e83a2e5. Since next corresponds to temporaries, this seems to indicate that end was not correctly moved.

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

Inside object::result program::run(bool synchronous) const, the first and end seem to confirm that theory:

(lldb) p first
p first
(object_p) 0x000000010e83a2e1
(lldb) p end
p end
(object_p) 0x000000010e83a2e5

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

It's a bit weird and peculiar that this corresponds to the end of the last GC run:

[16746510 42.259837] gc: Garbage collection, available 251, range 0x10e831356-0x10e83a2e5

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

The good news is that the bug appears to be deterministic. Another run hits the object::object_error exactly at the same spot.

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

The working theory is that end is pointing past the last object, therefore not moved correctly during garbage collection if it happens to be exactly equal to Temporaries.

@c3d
Copy link
Owner Author

c3d commented Jan 6, 2024

Adjusting the end pointer to be inside an object instead of just past it did not solve the problem as expected.

@c3d c3d added the done Issues that are done on dev (will be in next release) label Jan 6, 2024
c3d added a commit that referenced this issue Jan 7, 2024
In the run loop, the end pointer was not inside an object, but just
one past the object (i.e. it was the result of a program's `skip()`)
As a result, if that `end` pointer was equal to `rt.Temporaries`,
i.e. the start of the free space, and a garbage collection occured,
the start of the program would move but the end would not (it was seen
as not requiring garbage collection).

Fixes: #679

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
c3d added a commit that referenced this issue Jan 14, 2024
The focus of this release was to complete the transition to the
variable-precision decimal code. The full regression test suite was
restored, with only two tests still failing (complex `asin` and
`asinh`). The two missing functions, `Gamma` and `LogGamma`, were
implemented. This also exposed many bugs that were fixed.

New features:

* `NumberedVariables` setting to allow `0 STO` to ease RPN transcoding (#690)
* `ClearStack` (CLEAR) command
* Variable-precision `gamma` and `lgamma` functions (#710)

Bug fixes:

* Do not leave bad expression on stack after error (#663)
* Reject unit conversion between undefined units (#664)
* Accept names of menus on the command line (#669)
* tests: CLEAR clears stack and errors (#672)
* The `:` characters now starts a tag on empty command line (#673)
* Do not evaluate tagged objects too early (#674)
* test: Entry and editing of equations (#677)
* test: `type` returns negative values in "detailed" mode (#678)
* Run loop end pointer not GC-adjusted for last allocated object (#679)
* Do not erase alpha indicator when clearing busy cursor (#680)
* Do not emit trailing space when rounding `1.999` to `2.` (#687)
* Allow expression rewrites to deal with `pow` (#694)
* Reject `«` character in symbols and commands (#695)
* Rendering of spacing for decimal numbers (#699)
* Improve precision of `atan` function
* Rendering of `+` and `-` operators in compatibility modes (#700)
* Rounding of decimal numbers no longer generates bad characters (#702)
* No longer error out rendering symbolic complex (#703)
* Parse complex numbers correctly inside equations (#704)
* Ensure `sqrt(-1)` has a zero real part (#705)
* Do not drop last digit of decimal subtraction (#706)
* Evaluate expressions during expression pattern matching (#708)
* `LastMenu` executes immediately while editing (#711)
* Add back missing angle glyphs in font (#712)
* Return correct angle quadrant for `atan2` (#715)
* `Get` no longer rejects arrays as index values (#718)
* `Get` returns correct error for bad argument types (#718)

Improvements:

* Update `.gitignore` entry
* Automated testing of setting flags (#657)
* Automated testing of non-flag settings (#670)
* Test fixed-base based numbers using HP-compatible lowercase notation (#675)
* Test fraction rendering using fancy digits (#676)
* Add test for "compatible" variant of `type` command (#678)
* test: Recover from error during data entry (#681)
* Increase default `MaxNumberBits` to 4096 (#686)
* tests: Add test for cube root of -8 (#685)
* tests: Data entry for `Σ`, `∏` and `∆` (#689)
* Restrict `STO` to names, natural numbers and specific IDs (#688)
* doc: Document flas file access for `STO` and `RCL` (#691)
* list: Optimize iterators to avoid copies (#692)
* tests: spacing-independent testing of structure rendering (#693)
* tests: adjust test suite for variable-precision decimals (#696)
* tests: Automatically exit if `-T` option is given (#697)
* tests: Check we don't accept `.` as meaning `0.` for RPL compatibility
* Add `modulus` alias back for `abs` (#707)
* Improve convergence speed and accuracy for logarithms
* Add `decimal::make` to minimize risk of sign errors
* Display stack level at top of stack level, not bottom (#709)
* Improve complex `sqrt` accuracy on real axis (#714)
* tests: Test decimal functions at full 34 digits precision (#716)
* Complex `sqrt` and `cbrt` with full precision (#717)
* tests: Take into account additional expression simplifications

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
c3d added a commit that referenced this issue Jan 16, 2024
The focus of this release was to complete the transition to the
variable-precision decimal code. The full regression test suite was
restored, with only two tests still failing (complex `asin` and
`asinh`). The two missing functions, `Gamma` and `LogGamma`, were
implemented. This also exposed many bugs that were fixed.

New features:

* `NumberedVariables` setting to allow `0 STO` to ease RPN transcoding (#690)
* `ClearStack` (CLEAR) command
* Variable-precision `gamma` and `lgamma` functions (#710)

Bug fixes:

* Do not leave bad expression on stack after error (#663)
* Reject unit conversion between undefined units (#664)
* Accept names of menus on the command line (#669)
* tests: CLEAR clears stack and errors (#672)
* The `:` characters now starts a tag on empty command line (#673)
* Do not evaluate tagged objects too early (#674)
* test: Entry and editing of equations (#677)
* test: `type` returns negative values in "detailed" mode (#678)
* Run loop end pointer not GC-adjusted for last allocated object (#679)
* Do not erase alpha indicator when clearing busy cursor (#680)
* Do not emit trailing space when rounding `1.999` to `2.` (#687)
* Allow expression rewrites to deal with `pow` (#694)
* Reject `«` character in symbols and commands (#695)
* Rendering of spacing for decimal numbers (#699)
* Improve precision of `atan` function
* Rendering of `+` and `-` operators in compatibility modes (#700)
* Rounding of decimal numbers no longer generates bad characters (#702)
* No longer error out rendering symbolic complex (#703)
* Parse complex numbers correctly inside equations (#704)
* Ensure `sqrt(-1)` has a zero real part (#705)
* Do not drop last digit of decimal subtraction (#706)
* Evaluate expressions during expression pattern matching (#708)
* `LastMenu` executes immediately while editing (#711)
* Add back missing angle glyphs in font (#712)
* Return correct angle quadrant for `atan2` (#715)
* `Get` no longer rejects arrays as index values (#718)
* `Get` returns correct error for bad argument types (#718)

Improvements:

* Update `.gitignore` entry
* Automated testing of setting flags (#657)
* Automated testing of non-flag settings (#670)
* Test fixed-base based numbers using HP-compatible lowercase notation (#675)
* Test fraction rendering using fancy digits (#676)
* Add test for "compatible" variant of `type` command (#678)
* test: Recover from error during data entry (#681)
* Increase default `MaxNumberBits` to 4096 (#686)
* tests: Add test for cube root of -8 (#685)
* tests: Data entry for `Σ`, `∏` and `∆` (#689)
* Restrict `STO` to names, natural numbers and specific IDs (#688)
* doc: Document flas file access for `STO` and `RCL` (#691)
* list: Optimize iterators to avoid copies (#692)
* tests: spacing-independent testing of structure rendering (#693)
* tests: adjust test suite for variable-precision decimals (#696)
* tests: Automatically exit if `-T` option is given (#697)
* tests: Check we don't accept `.` as meaning `0.` for RPL compatibility
* Add `modulus` alias back for `abs` (#707)
* Improve convergence speed and accuracy for logarithms
* Add `decimal::make` to minimize risk of sign errors
* Display stack level at top of stack level, not bottom (#709)
* Improve complex `sqrt` accuracy on real axis (#714)
* tests: Test decimal functions at full 34 digits precision (#716)
* Complex `sqrt` and `cbrt` with full precision (#717)
* tests: Take into account additional expression simplifications

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
@c3d c3d closed this as completed in d123c86 Jan 16, 2024
c3d added a commit that referenced this issue Jan 16, 2024
Release 0.6.2 "Kephas": Restoring the test suite

The focus of this release was to complete the transition to the
variable-precision decimal code. The full regression test suite was
restored, with only two tests still failing (complex `asin` and
`asinh`). The two missing functions, `Gamma` and `LogGamma`, were
implemented. This also exposed many bugs that were fixed.

New features:

* `NumberedVariables` setting to allow `0 STO` to ease RPN transcoding (#690)
* `ClearStack` (CLEAR) command
* Variable-precision `gamma` and `lgamma` functions (#710)

Bug fixes:

* Do not leave bad expression on stack after error (#663)
* Reject unit conversion between undefined units (#664)
* Accept names of menus on the command line (#669)
* tests: CLEAR clears stack and errors (#672)
* The `:` characters now starts a tag on empty command line (#673)
* Do not evaluate tagged objects too early (#674)
* test: Entry and editing of equations (#677)
* test: `type` returns negative values in "detailed" mode (#678)
* Run loop end pointer not GC-adjusted for last allocated object (#679)
* Do not erase alpha indicator when clearing busy cursor (#680)
* Do not emit trailing space when rounding `1.999` to `2.` (#687)
* Allow expression rewrites to deal with `pow` (#694)
* Reject `«` character in symbols and commands (#695)
* Rendering of spacing for decimal numbers (#699)
* Improve precision of `atan` function
* Rendering of `+` and `-` operators in compatibility modes (#700)
* Rounding of decimal numbers no longer generates bad characters (#702)
* No longer error out rendering symbolic complex (#703)
* Parse complex numbers correctly inside equations (#704)
* Ensure `sqrt(-1)` has a zero real part (#705)
* Do not drop last digit of decimal subtraction (#706)
* Evaluate expressions during expression pattern matching (#708)
* `LastMenu` executes immediately while editing (#711)
* Add back missing angle glyphs in font (#712)
* Return correct angle quadrant for `atan2` (#715)
* `Get` no longer rejects arrays as index values (#718)
* `Get` returns correct error for bad argument types (#718)

Improvements:

* Update `.gitignore` entry
* Automated testing of setting flags (#657)
* Automated testing of non-flag settings (#670)
* Test fixed-base based numbers using HP-compatible lowercase notation (#675)
* Test fraction rendering using fancy digits (#676)
* Add test for "compatible" variant of `type` command (#678)
* test: Recover from error during data entry (#681)
* Increase default `MaxNumberBits` to 4096 (#686)
* tests: Add test for cube root of -8 (#685)
* tests: Data entry for `Σ`, `∏` and `∆` (#689)
* Restrict `STO` to names, natural numbers and specific IDs (#688)
* doc: Document flas file access for `STO` and `RCL` (#691)
* list: Optimize iterators to avoid copies (#692)
* tests: spacing-independent testing of structure rendering (#693)
* tests: adjust test suite for variable-precision decimals (#696)
* tests: Automatically exit if `-T` option is given (#697)
* tests: Check we don't accept `.` as meaning `0.` for RPL compatibility
* Add `modulus` alias back for `abs` (#707)
* Improve convergence speed and accuracy for logarithms
* Add `decimal::make` to minimize risk of sign errors
* Display stack level at top of stack level, not bottom (#709)
* Improve complex `sqrt` accuracy on real axis (#714)
* tests: Test decimal functions at full 34 digits precision (#716)
* Complex `sqrt` and `cbrt` with full precision (#717)
* tests: Take into account additional expression simplifications

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done Issues that are done on dev (will be in next release) test Issues related to the test suite
Projects
None yet
Development

No branches or pull requests

1 participant