jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.74k stars 1.12k forks source link

VerifyError while creating an AXIS_SWEEP_3 space #2282

Closed stephengold closed 2 weeks ago

stephengold commented 2 weeks ago

In the current "master" branch, creating a PhysicsSpace with the AXIS_SWEEP_3 broadphase option throws a VerifyError. There is no stack trace. Here is typical output:

Jun 12, 2024 11:36:51 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.8.0-SNAPSHOT
 * Branch: master
 * Git Hash: b7787a7
 * Build Date: 2024-06-12
Jun 12, 2024 11:36:52 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Jun 12, 2024 11:36:52 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 2070/PCIe/SSE2
 * OpenGL Version: 4.6.0 NVIDIA 535.171.04
 * GLSL Version: 4.60 NVIDIA
 * Profile: Compatibility
Jun 12, 2024 11:36:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.15.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
 * AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Jun 12, 2024 11:36:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Jun 12, 2024 11:36:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jun 12, 2024 11:36:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Jun 12, 2024 11:36:52 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.VerifyError: Stack map does not match the one at exception handler 432
Exception Details:
  Location:
    com/bulletphysics/collision/broadphase/AxisSweep3Internal.<init>(Ljavax/vecmath/Vector3f;Ljavax/vecmath/Vector3f;IIILcom/bulletphysics/collision/broadphase/OverlappingPairCache;)V @432: aload
  Reason:
    Current frame's flags are not assignable to stack map frame's.
  Current Frame:
    bci: @5
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'javax/vecmath/Vector3f', 'javax/vecmath/Vector3f', integer, integer, integer, 'com/bulletphysics/collision/broadphase/OverlappingPairCache', top, top, top, top, 'com/bulletphysics/$Stack' }
    stack: { 'java/lang/Throwable' }
  Stackmap Frame:
    bci: @432
    flags: { }
    locals: { top, 'javax/vecmath/Vector3f', 'javax/vecmath/Vector3f', integer, integer, integer, 'com/bulletphysics/collision/broadphase/OverlappingPairCache', top, top, top, top, 'com/bulletphysics/$Stack' }
    stack: { 'java/lang/Throwable' }
  Bytecode:
    0000000: b800 2a3a 0b19 0bb6 002e 2ab7 0030 2abb
    0000010: 0032 59b7 0033 b500 352a bb00 3259 b700
    0000020: 33b5 0037 2abb 0032 59b7 0033 b500 392a
    0000030: 06bd 000a b500 3b2a 01b5 003d 2a03 b500
    0000040: 3f2a 03b5 0041 2a1d b500 432a 1504 b500
    0000050: 452a 1906 b500 4715 0504 6036 072a b400
    0000060: 47c7 0013 2abb 0049 59b7 004a b500 472a
    0000070: 04b5 003f 2ab4 0035 2bb6 004e 2ab4 0037
    0000080: 2cb6 004e 190b b600 523a 0819 082a b400
    0000090: 372a b400 35b6 0056 2ab4 0045 3609 2ab4
    00000a0: 0039 1509 8619 08b4 005a 6e15 0986 1908
    00000b0: b400 5d6e 1509 8619 08b4 0060 6eb6 0063
    00000c0: 2a15 07bd 0007 b500 6503 360a 150a 1507
    00000d0: a200 142a b400 6515 0a2a b600 6953 840a
    00000e0: 01a7 ffeb 2a15 07b5 006b 2a03 b500 6d2a
    00000f0: 04b5 006f 2ab4 006f 360a 150a 1507 a200
    0000100: 172a b400 6515 0a32 150a 0460 b600 7384
    0000110: 0a01 a7ff e82a b400 6515 0704 6432 03b6
    0000120: 0073 0336 0a15 0a06 a200 182a b400 3b15
    0000130: 0a2a 1507 0568 b600 7753 840a 01a7 ffe8
    0000140: 2ab4 0065 0332 01b5 007b 0336 0a15 0a06
    0000150: a200 522a b400 6503 3215 0a03 b600 7f2a
    0000160: b400 6503 3215 0a04 b600 822a b400 3b15
    0000170: 0a32 0303 b600 852a b400 3b15 0a32 0303
    0000180: b600 882a b400 3b15 0a32 0415 04b6 0085
    0000190: 2ab4 003b 150a 3204 03b6 0088 840a 01a7
    00001a0: ffae 2a2a b600 8cb5 008e 190b b600 91b1
    00001b0: 190b b600 91bf                         
  Exception Handler Table:
    bci [5, 432] => handler: 432
  Stackmap Table:
    full_frame(@116,{Object[#2],Object[#50],Object[#50],Integer,Integer,Integer,Object[#155],Integer,Top,Top,Top,Object[#38]},{})
    full_frame(@204,{Object[#2],Object[#50],Object[#50],Integer,Integer,Integer,Object[#155],Integer,Object[#50],Integer,Integer,Object[#38]},{})
    same_frame(@228)
    same_frame(@250)
    same_frame(@277)
    same_frame(@293)
    same_frame(@320)
    same_frame(@333)
    same_frame_extended(@418)
    full_frame(@432,{Top,Object[#50],Object[#50],Integer,Integer,Integer,Object[#155],Top,Top,Top,Top,Object[#38]},{Object[#157]})

    at com.jme3.bullet.PhysicsSpace.create(PhysicsSpace.java:234)
    at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:218)
    at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:207)
    at jme3test.bullet.TestIssue.simpleInitApp(TestIssue.java:51)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:142)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:224)
    at java.base/java.lang.Thread.run(Thread.java:840)

Here is the test code:

import com.jme3.app.SimpleApplication;
import com.jme3.bullet.PhysicsSpace;

/**
 *
 * @author Stephen Gold sgold@sonic.net
 */
public class TestIssue extends SimpleApplication {

    public static void main(String[] args) {
        TestIssue test = new TestIssue();
        test.start();
    }

    @Override
    public void simpleInitApp() {
        new PhysicsSpace(PhysicsSpace.BroadphaseType.AXIS_SWEEP_3);
    }
}
stephengold commented 2 weeks ago

This issue is a regression, though not a recent one. The test code works fine with JME v3.5.0-alpha1 but not with v3.5.0-beta4 .

That observation led me to suspect the bug was caused by c4b34c8f . Reverting that commit in "master" solves this issue.

I'll investigate what changed between jbullet v1.0.1 and v1.0.2 to cause this issue.