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

[RISC-V] Improve code generating resolve stub assembly #102318

Merged
merged 2 commits into from
May 28, 2024

Conversation

yurai007
Copy link
Contributor

@yurai007 yurai007 commented May 16, 2024

This change replaces magic numbers with proper offsetofs and use compile time asserts instead runtime ones. That should make developers life easier in case of debugging or changing resolve stubs assembly.

Part of #84834, cc @dotnet/samsung

@yurai007 yurai007 changed the title [RISC-V] Improve dynamically generated resolve stub assembly [RISC-V] Improve code generating resolve stub assembly May 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 16, 2024
@clamp03 clamp03 added the arch-riscv Related to the RISC-V architecture label May 17, 2024
This change replaces magic numbers with proper offsetofs and use compile time asserts instead runtime ones.
That should make developers life easier in case of debugging or changing resolve stubs assembly.
@yurai007 yurai007 marked this pull request as ready for review May 17, 2024 07:58
Copy link
Contributor

@tomeksowi tomeksowi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks better. We probably need to change all the hardcoded instructions to *TypeInstr like in riscv64/stubs.cpp some day.

@risc-vv
Copy link

risc-vv commented May 22, 2024

Hi there! I'm risc-vv - your friendly neighborhood testing bot. I have some results for you:

Results for qemu-prio0-checked

Test report

=======================
      passed: 2718
      failed: 3
     skipped: 16
      killed: 1
------------------------
  TOTAL libs: 2738
 TOTAL tests: 2738
   REAL time: 36min 0s 793ms
=======================
failed tests
[45.000s] profiler.unittest.releaseondetach.releaseondetach.sh
    [exitcode-134]: SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped.
[29.740s] JIT.Directed.debugging.debuginfo.tester.tester.sh
    [exitcode-  -1]: unknown error
[279.830s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
killed tests
[1810.194s] profiler.eventpipe.reverse_startup.reverse_startup.sh
skipped tests
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh

@risc-vv
Copy link

risc-vv commented May 22, 2024

RISC-V test results for qemu-prio0-checked: 2718 / 2738 (99.27%)

details

GIT: 84c1cb9


=======================
      passed: 2718
      failed: 3
     skipped: 16
      killed: 1
------------------------
  TOTAL libs: 2738
 TOTAL tests: 2738
   REAL time: 36min 38s 19ms
=======================
failed tests
[44.660s] profiler.unittest.releaseondetach.releaseondetach.sh
    [exitcode-134]: SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped.
[27.650s] JIT.Directed.debugging.debuginfo.tester.tester.sh
    [exitcode-  -1]: unknown error
[290.150s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
killed tests
[1810.365s] profiler.eventpipe.reverse_startup.reverse_startup.sh
skipped tests
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh

@risc-vv
Copy link

risc-vv commented May 22, 2024

RISC-V test results for starfive-prio0-checked: 2720 / 2738 (99.34%)

details

GIT: 84c1cb9


=======================
      passed: 2720
      failed: 2
     skipped: 16
      killed: 0
------------------------
  TOTAL libs: 2738
 TOTAL tests: 2738
   REAL time: 1h 3min 53s 603ms
=======================
failed tests
[424.620s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[721.060s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
skipped tests
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh

@risc-vv
Copy link

risc-vv commented May 22, 2024

RISC-V test results for qemu-prio1-checked: 9396 / 9443 (99.50%)

details

GIT: 84c1cb9


=======================
      passed: 9396
      failed: 4
     skipped: 42
      killed: 1
------------------------
  TOTAL libs: 9443
 TOTAL tests: 9443
   REAL time: 1h 18min 4s 460ms
=======================
failed tests
[50.190s] profiler.unittest.releaseondetach.releaseondetach.sh
    [exitcode-134]: SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped.
[40.420s] JIT.Directed.debugging.debuginfo.tester.tester.sh
    [exitcode-  -1]: unknown error
[415.710s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[737.330s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
[1800.068s] profiler.eventpipe.reverse_startup.reverse_startup.sh
skipped tests
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.Directed.rvastatics.RVAOrderingTest.RVAOrderingTest.sh
[0.000s] JIT.Directed.PREFIX.volatile.1.arglist_Target_64BIT_volatile.arglist_Target_64BIT_volatile.sh
[0.000s] JIT.Directed.PREFIX.unaligned.4.arglist_Target_64BIT_unaligned_4.arglist_Target_64BIT_unaligned_4.sh
[0.000s] JIT.Directed.PREFIX.unaligned.1.arglist_Target_64BIT_unaligned_1.arglist_Target_64BIT_unaligned_1.sh
[0.000s] JIT.Directed.PREFIX.unaligned.2.arglist_Target_64BIT_unaligned_2.arglist_Target_64BIT_unaligned_2.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.Methodical.refany.seq_d.seq_d.sh
[0.000s] JIT.Methodical.refany.seq_r.seq_r.sh
[0.000s] JIT.Methodical.Coverage.arglist_pos.arglist_pos.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b37646.b37646.b37646.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b41852.b41852.b41852.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b31746.b31746.b31746.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M11-Beta1.b41391.b41391.b41391.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M09.5-PDC.b16423.b16423.b16423.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Regression.CLR-x86-EJIT.V1-M12-Beta2.b26323.b26323.b26323.sh
[0.000s] JIT.jit64.mcc.interop.mcc_i00.mcc_i00.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] GC.LargeMemory.API.gc.reregisterforfinalize.reregisterforfinalize.sh
[0.000s] GC.LargeMemory.API.gc.getgeneration.getgeneration.sh
[0.000s] GC.LargeMemory.API.gc.collect.collect.sh
[0.000s] GC.LargeMemory.Allocation.finalizertest.finalizertest.sh
[0.000s] GC.Regressions.dev10bugs.536168.536168.536168.sh
[0.000s] GC.Regressions.Github.Runtime_76219.Runtime_76219.Runtime_76219.sh
[0.000s] GC.Features.BackgroundGC.foregroundgc.foregroundgc.sh
[0.000s] GC.Features.LOHFragmentation.lohfragmentation.lohfragmentation.sh
[0.000s] GC.Coverage.271010.271010.sh
[0.000s] baseservices.threading.regressions.2164.foreground-shutdown.foreground-shutdown.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.exceptions.StackTracePreserve.StackTracePreserveTests.StackTracePreserveTests.sh

@risc-vv
Copy link

risc-vv commented May 22, 2024

RISC-V test results for starfive-prio1-checked: 9399 / 9443 (99.53%)

details

GIT: 84c1cb9


=======================
      passed: 9399
      failed: 2
     skipped: 42
      killed: 0
------------------------
  TOTAL libs: 9443
 TOTAL tests: 9443
   REAL time: 2h 51min 40s 385ms
=======================
failed tests
[400.150s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[705.960s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
skipped tests
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] GC.Features.LOHFragmentation.lohfragmentation.lohfragmentation.sh
[0.000s] GC.Features.BackgroundGC.foregroundgc.foregroundgc.sh
[0.000s] GC.Coverage.271010.271010.sh
[0.000s] GC.LargeMemory.Allocation.finalizertest.finalizertest.sh
[0.000s] GC.LargeMemory.API.gc.collect.collect.sh
[0.000s] GC.LargeMemory.API.gc.reregisterforfinalize.reregisterforfinalize.sh
[0.000s] GC.LargeMemory.API.gc.getgeneration.getgeneration.sh
[0.000s] GC.Regressions.dev10bugs.536168.536168.536168.sh
[0.000s] GC.Regressions.Github.Runtime_76219.Runtime_76219.Runtime_76219.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M11-Beta1.b41391.b41391.b41391.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b37646.b37646.b37646.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b31746.b31746.b31746.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b41852.b41852.b41852.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M09.5-PDC.b16423.b16423.b16423.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Regression.CLR-x86-EJIT.V1-M12-Beta2.b26323.b26323.b26323.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.Directed.rvastatics.RVAOrderingTest.RVAOrderingTest.sh
[0.000s] JIT.Directed.PREFIX.volatile.1.arglist_Target_64BIT_volatile.arglist_Target_64BIT_volatile.sh
[0.000s] JIT.Directed.PREFIX.unaligned.4.arglist_Target_64BIT_unaligned_4.arglist_Target_64BIT_unaligned_4.sh
[0.000s] JIT.Directed.PREFIX.unaligned.2.arglist_Target_64BIT_unaligned_2.arglist_Target_64BIT_unaligned_2.sh
[0.000s] JIT.Directed.PREFIX.unaligned.1.arglist_Target_64BIT_unaligned_1.arglist_Target_64BIT_unaligned_1.sh
[0.000s] JIT.jit64.mcc.interop.mcc_i00.mcc_i00.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.Methodical.Coverage.arglist_pos.arglist_pos.sh
[0.000s] JIT.Methodical.refany.seq_d.seq_d.sh
[0.000s] JIT.Methodical.refany.seq_r.seq_r.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.threading.regressions.2164.foreground-shutdown.foreground-shutdown.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.exceptions.StackTracePreserve.StackTracePreserveTests.StackTracePreserveTests.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh

@clamp03
Copy link
Member

clamp03 commented May 28, 2024

@jkotas Could you take a look at this PR? Thank you.

@jkotas jkotas merged commit eb841ab into dotnet:main May 28, 2024
89 checks passed
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* [RISC-V] Improve code generating resolve stub assembly

This change replaces magic numbers with proper offsetofs and use compile time asserts instead runtime ones.
That should make developers life easier in case of debugging or changing resolve stubs assembly.

* Move annotation and don't check same thing many times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Related to the RISC-V architecture area-VM-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants