JiBX
  1. JiBX
  2. JIBX-213

Incorrect binding code generated for long data type (Won't DUP type on stack top 'long' because it must occupy exactly one slot, not '2'.)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JiBX 1.1.5
    • Fix Version/s: JiBX 1.1.6
    • Component/s: core
    • Labels:
      None
    • Environment:
      Windows XP Pro SP2, CPU x86 Family 15 Model 4 Stepping 1 GenuineIntel ~3200 Mhz, RAM 2GB
      Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      For simple input-only binding incorrect code is generated when "long" data type is present. Identical code with "int" instead of "long" is processed correctly.

      Attached is an archive containing two test cases:
      testcases
      bad-with-long
      bind
      good-with-int
      bind

      "bind" is a top-level java package. InTest2 is a main class, InTest2.xml is input file.

      ---------------------------------------------------------------------------------------------------------------------
      An attempt to run "bad-with-long" variant resulted in:

      Exception in thread "main" java.lang.VerifyError: (class: bind/JiBX_MungeAdapter, method: JiBX_test_binding_in2_unmarshal_1_4 signature: (Lbind/MyData;Lorg/jibx/runtime/impl/UnmarshallingContext;)Lbind/MyData Attempt to split long or double on the stack
      at bind.JiBX_test_binding_in2MyData_access1.unmarshal()
      at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2537)
      at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2680)
      at bind.InTest2.main(InTest2.java:19)

      Output from "org.jibx.binding.Compile -b -l bind\test-binding-in2.xml" contains (among other diagnostics):

      Verification failure on method JiBX_test_binding_in2_unmarshal_1_2 of class bind.JiBX_MungeAdapter:
      VERIFIED_REJECTED
      Instruction invokeinterface[185](5) 84 constraint violated: Referenced method 'setStatus' with expected signature not found in c
      lass 'bind.MyData'. The native verfier does allow the method to be declared in some superinterface, which the Java Virtual Machi
      ne Specification, Second Edition does not.

      Verification failure on method JiBX_test_binding_in2_unmarshal_1_0 of class bind.JiBX_MungeAdapter:
      VERIFIED_REJECTED
      Constraint violated in method 'public static bind.SomeData JiBX_test_binding_in2_unmarshal_1_0(bind.SomeData arg1, org.jibx.runt
      ime.impl.UnmarshallingContext arg2)
      throws org.jibx.runtime.JiBXException':
      Instruction DUP constraint violated: Won't DUP type on stack top 'long' because it must occupy exactly one slot, not '2'.
      InstructionHandle: 43: dup[89](1)

      Execution Frame:
      Local Variables:
      0: bind.SomeData
      1: org.jibx.runtime.impl.UnmarshallingContext
      2: boolean[]
      3: <unknown object>
      4: <unknown object>
      OperandStack:
      Slots used: 4 MaxStack: 5.
      long (Size: 2)
      bind.SomeData (Size: 1)
      bind.SomeData (Size: 1)
      Execution flow:
      0: aload_0 [InstructionContext]
      1: iconst_1 [InstructionContext]
      2: newarray boolean [InstructionContext]
      4: astore_2 [InstructionContext]
      5: nop [InstructionContext]
      6: aload_1 [InstructionContext]
      7: aconst_null [InstructionContext]
      8: ldc 33 [InstructionContext]
      10: invokevirtual 37 [InstructionContext]
      13: ifeq -> 53 [InstructionContext]
      16: aload_2 [InstructionContext]
      17: iconst_0 [InstructionContext]
      18: baload [InstructionContext]
      19: ifeq -> 31 [InstructionContext]
      31: aload_2 [InstructionContext]
      32: iconst_0 [InstructionContext]
      33: iconst_1 [InstructionContext]
      34: bastore [InstructionContext]
      35: aload_0 [InstructionContext]
      36: aload_1 [InstructionContext]
      37: aconst_null [InstructionContext]
      38: ldc 33 [InstructionContext]
      40: invokevirtual 47 [InstructionContext]
      43: dup [InstructionContext]

      Attached is an archive containing two test cases:
      testcases
      bad-with-long
      bind
      good-with-int
      bind

      "bind" is top-level java package.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        Fixed a couple of places where this type of error could occur when using longs or doubles.

        Show
        Dennis Sosnoski added a comment - Fixed a couple of places where this type of error could occur when using longs or doubles.
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Fix Version/s JiBX 1.1.6 [ 14068 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Assignee Dennis Sosnoski [ dsosnoski ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Dennis Sosnoski made changes -
        Component/s Generator Tools [ 11490 ]
        Component/s core [ 10676 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Serguei Ouklonski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: