Skip to main content

phoneME Advance and the Freescale MX.31 (ARM)

55 replies [Last post]
ken_gilmer
Offline
Joined: 2007-01-19

Hello! Thanks to the excellent docs provided for Sun on building the jvm and also info on this forum I've got a running linux-arm-mx31 make file that generates a cvm that passes the test suite on the mx31 development board. I would like to contribute this back to the source tree if there is interest. I looked through the 'how to contribute' page but am not clear on what I need to do from this point. Any suggestions?

Also, I have a question regarding the jvm. If I enable JIT in the make file, my JVM segfaults -

mx31# bin/cvm -cp testclasses.zip Test
Process #1836 received signal 4, suspending

I've read through other posts of issues for specific processors. In general, are there are restrictions on types of processors that can use JIT? Any tips on how to resolve this?

Thanks!
ken

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ken_gilmer
Offline
Joined: 2007-01-19

Hi Mark,

> You're already talking to CVM engineers (Chris and
> me).

Great! I really appriciate your help. Needless to say I'm in way over my head here :)

> NULL. On the surface, it looks like some bad code is
> being generated by the JIT.

Ok. Not sure if I made this clear before, but the tests pass about 60% of the time. We had initially thought everything was working. So, GC seemed to make sense to me as it looks to be timing issue.

> Run CVM with -Xjit:inline=none and make sure that
> you still see the same
> problem. I suspect you will.

Your suspicion is correct.

> Modify src/share/javavm/runtime/jit/jitdebug.c as

Ok, done.

> 5. Build CVM with your current options plus
> these:
> CVM_JIT_DEBUG=true CVM_TRACE_JIT=true

Done

> StringBuffer.append() method. Post that for us to
> take a look at.

On success the output looks like this:
mx31# phoneme_adv-revUNKNOWN/bin/cvm -Xjit:inline=none -cp home/kgilmer/julyeffort/ltib-imx31ads-20070128/rpm/BUILD/phoneme-advanced/cdc/build/linux-arm-mx31/testclasses.zip Test
....
Woke up! Cancelling latency request
..........WARNING: CVMJITdebugInitMethodList failed to lookup methodID for java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer
...
*CONGRATULATIONS: test Test completed with 411 tests passed and 0 failures

One failure:

Woke up! Cancelling latency request
..........WARNING: CVMJITdebugInitMethodList failed to lookup methodID for java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer
.Process #1900 received signal 4, suspending

The other failure:

Woke up! Cancelling latency request
..........WARNING: CVMJITdebugInitMethodList failed to lookup methodID for java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer
..
testManyFieldsAndMethods() failed:
java.lang.NullPointerException
at java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(Compiled Method)(StringBuffer.java:486)
at Test.testManyFieldsAndMethods()V(Test.java:720)
at Test.main([Ljava/lang/String;)V(Test.java:142)
at sun.misc.CVM.runMain()V(CVM.java:514)

*TOO BAD: test Test completed with 363 tests passed and 1 failures

Hope this helps. Thanks,
ken

mlam
Offline
Joined: 2006-10-13

Ken,

You made a mistake in your edits. In jitdebug.c, you typed in "java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer" instead of "java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;". The difference is the ';' at the end. Small but important difference. Please fix this and do another run to get the compilation trace. Thanks.

Another thing that seems troublesome to me is the "Process #1900 received signal 4, suspending". That says that you are executing an illegal instruction which could actually be caused by any number of things. Let's fix the above first and go from there.

BTW, do you have the hardware specs of the iMX 31 board that you're using? If so, do you know if it is using a 16 bit memory bus, or a 32 bit one? If it is using a 16bit bus, is there any literature that says that 32bit memory accesses are atomic or not? Let me know what you find out about these. Thanks.

Mark

ken_gilmer
Offline
Joined: 2007-01-19

Whoops. Copy-paste is not infallable :). Thanks for the correction. Yes, now I'm getting a lot more output.

Success ~

Woke up! Cancelling latency request

............JS: COMPILING java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;

#################################################

The maximum node counts per root node are 9

IR block list contains 3 blocks in method

#################################################

*************************************************

*

* (block ID:0 block PC:0 )

* IR root list contains 4 root nodes: in block

* flags: 0x41

* noMoreIncomingLocals: 0x1

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x1

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:478)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<0> (0x284c98): aload_1

<1> (0x284c99): ifnonnull <9>

<4> (0x284c9c): aload_1

<5> (0x284c9d): invokestatic_checkinit_quick #6366

<8> (0x284ca0): astore_1

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: -1 0

Original Incoming Locals(1):

local(1) ID(2)

Incoming Locals(1):

local(1) ID(2)

Assigned Locals(1):

ASSIGN(11): local(1) ID(10) rhsID(8)

Successor Blocks(1):

ID(1) LocalOrder(1) AssignOrder(0) RefsOK(1) Locals(1)

<(ID: 1) MAP_PC (NONE) 0>

<(ID: 4) BCOND (reference)

target: (BlockID: 1 BlockPC: 9)

condition: NE

flags: 0

<(ID: 2) IDENTITY (reference) (ref count: 2)

<(ID: 9) LOCAL (reference) 1>

<(ID: 3) CONST_STRING_OBJECT (reference) (stringObject 0x0)

<(ID: 8) IDENTITY (reference) (ref count: 2)

<(ID: 12) INVOKE (reference)

<(ID: 7) PARAMETER (reference)

<(ID: 2) IDENTITY (reference) (ref count: 2)

<(ID: 6) NULL_PARAMETER (NONE)

<(ID: 5) CONST_MB (address field) (java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;)

<(ID: 11) ASSIGN (reference) (assignIdx: 0)

<(ID: 10) LOCAL (reference) 1>

<(ID: 8) IDENTITY (reference) (ref count: 2)

*************************************************

*

* (block ID:1 block PC:9 )

* IR root list contains 9 root nodes: in block

* flags: 0x341

* noMoreIncomingLocals: 0x1

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x1

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:482)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<9> (0x284ca1): aload_1

<10> (0x284ca2): invokenonvirtual_quick #7441

<13> (0x284ca5): istore_2

<14> (0x284ca6): aload_0

<15> (0x284ca7): getfield_quick #3

<18> (0x284caa): iload_2

<19> (0x284cab): iadd

<20> (0x284cac): istore_3

<21> (0x284cad): iload_3

<22> (0x284cae): aload_0

<23> (0x284caf): agetfield_quick #2

<26> (0x284cb2): arraylength

<27> (0x284cb3): if_icmple <35>

<30> (0x284cb6): aload_0

<31> (0x284cb7): iload_3

<32> (0x284cb8): invokenonvirtual_quick #11037

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: 0 0

Original Incoming Locals(1):

local(1) ID(14)

Incoming Locals(1):

local(1) ID(14)

Assigned Locals(2):

ASSIGN(35): local(2) ID(34) rhsID(20)

ASSIGN(38): local(3) ID(37) rhsID(26)

Successor Blocks(1):

ID(2) LocalOrder(1) AssignOrder(2) RefsOK(0) Locals(1 2 0 3)

<(ID: 13) MAP_PC (NONE) 9>

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 36) INVOKE (int)

<(ID: 17) PARAMETER (reference)

<(ID: 14) IDENTITY (reference) (ref count: 2)

<(ID: 21) LOCAL (reference) 1>

<(ID: 16) NULL_PARAMETER (NONE)

<(ID: 19) SEQUENCE_R (address field)

<(ID: 18) NULL_CHECK (reference)

<(ID: 14) IDENTITY (reference) (ref count: 2)

<(ID: 15) CONST_MB (address field) (java.lang.String.length()I)

<(ID: 25) IDENTITY (32-bit field) (ref count: 2)

<(ID: 39) FETCH (32-bit field)

<(ID: 24) FIELD_REF (32-bit field)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 30) LOCAL (reference) 0>

<(ID: 23) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 29) IDENTITY (reference) (ref count: 2)

<(ID: 33) FETCH (reference)

<(ID: 28) FIELD_REF (reference)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 27) CONST_FIELD_OFFSET (NONE) (2)

<(ID: 31) IDENTITY (int) (ref count: 2)

<(ID: 41) ARRAY_LENGTH (int)

<(ID: 29) IDENTITY (reference) (ref count: 2)

<(ID: 35) ASSIGN (int) (assignIdx: 0)

<(ID: 34) LOCAL (int) 2>

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 38) ASSIGN (int) (assignIdx: 1)

<(ID: 37) LOCAL (int) 3>

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 40) ADD (int)

<(ID: 25) IDENTITY (32-bit field) (ref count: 2)

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 32) BCOND (int)

target: (BlockID: 2 BlockPC: 35)

condition: LE

flags: 0

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 31) IDENTITY (int) (ref count: 2)

<(ID: 46) INVOKE (v)

<(ID: 45) PARAMETER (reference)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 44) PARAMETER (int)

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 43) NULL_PARAMETER (NONE)

<(ID: 42) CONST_MB (address field) (java.lang.StringBuffer.expandCapacity(I)V)

*************************************************

*

* (block ID:2 block PC:35 )

* IR root list contains 6 root nodes: in block

* flags: 0x301

* noMoreIncomingLocals: 0x0

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x0

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:486)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<35> (0x284cbb): aload_1

<36> (0x284cbc): iconst_0

<37> (0x284cbd): iload_2

<38> (0x284cbe): aload_0

<39> (0x284cbf): agetfield_quick #2

<42> (0x284cc2): aload_0

<43> (0x284cc3): getfield_quick #3

<46> (0x284cc6): invokenonvirtual_quick #8053

<49> (0x284cc9): aload_0

<50> (0x284cca): iload_3

<51> (0x284ccb): putfield_quick #3

<54> (0x284cce): aload_0

<55> (0x284ccf): areturn

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: 0 0

Original Incoming Locals(4):

local(1) ID(48)

local(2) ID(50)

local(0) ID(51)

local(3) ID(72)

Incoming Locals(4):

local(1) ID(48)

local(2) ID(50)

local(0) ID(51)

local(3) ID(72)

<(ID: 47) MAP_PC (NONE) 35>

<(ID: 54) IDENTITY (reference) (ref count: 2)

<(ID: 69) FETCH (reference)

<(ID: 53) FIELD_REF (reference)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 58) LOCAL (reference) 0>

<(ID: 52) CONST_FIELD_OFFSET (NONE) (2)

<(ID: 57) IDENTITY (32-bit field) (ref count: 2)

<(ID: 70) FETCH (32-bit field)

<(ID: 56) FIELD_REF (32-bit field)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 55) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 68) INTRINSIC (v)

<(ID: 65) IARG (reference)

<(ID: 48) IDENTITY (reference) (ref count: 2)

<(ID: 71) LOCAL (reference) 1>

<(ID: 64) IARG (int)

<(ID: 49) CONST_JAVA_NUMERIC32 (int) (0)

<(ID: 63) IARG (int)

<(ID: 50) LOCAL (int) 2>

<(ID: 62) IARG (reference)

<(ID: 54) IDENTITY (reference) (ref count: 2)

<(ID: 61) IARG (int)

<(ID: 57) IDENTITY (32-bit field) (ref count: 2)

<(ID: 60) NULL_IARG (NONE)

<(ID: 67) SEQUENCE_R (address field)

<(ID: 66) NULL_CHECK (reference)

<(ID: 48) IDENTITY (reference) (ref count: 2)

<(ID: 59) CONST_MB (address field) (java.lang.String.getChars(II[CI)V)

<(ID: 75) ASSIGN (32-bit field)

<(ID: 74) FIELD_REF (32-bit field)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 73) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 72) LOCAL (int) 3>

<(ID: 76) RETURN_VALUE (reference)

<(ID: 51) IDENTITY (reference) (ref count: 4)

NUM BARRIER BYTES = 0

NUM VIRTUAL INLINE BYTES = 0

NUM LARGE OPCODE BYTES = 0

NUM MAIN LINE INSTRUCTION BYTES ESTIMATE = 344

ESTIMATED BUFFER SIZE = 452

CODE BUFFER ADDRESS = 0x407803c0

PC MAP TABLE ADDRESS = 0x407803c8

CODE ENTRY ADDRESS = 0x407803f0

@ Method prologue

@ Stack limit check

0x407803f0 0: ldr a4, [sp, #+4] @ ccee->stackChunkEnd

0x407803f4 4: add a2, rJSP, #60 @ Set R1 = JSP + (capacity - argsSize) * 4

0x407803f8 8: str lr, [rJFP, #+16] @ Store LR into frame

0x407803fc 12: cmp a4, a2 LSL #0

0x40780400 16: ldrls pc, [pc, #+0] @ letInterpreterDoInvoke

@ Set up frame for synchronized method

0x40780404 20: sub a2, rJSP, #8 @ ARG2 = JSP - argsSize * 4

0x40780408 24: add v4, rJSP, #8 @ NEW_JFP = JSP + (maxLocals - argsSize) * 4

0x4078040c 28: mov lr, pc @ lr = pc

0x40780410 32: ldr pc, [pc, #+0] @ call CVMCCMinvokeNonstaticSyncMethodHelper

@ Interpreted -> compiled entry point

0x40780414 36: add rJSP, rJFP, #24 @ spill adjust goes here

@ Initial Temp REF set is

L0: 40: @ entry point for first block

@ Preloading incoming local(1) reg(6)

0x40780418 40: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Doing node 1 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=0 compiledPc=44

@ Doing node 1 codegen rule [ 1] root: effect

@ Doing node 9 codegen rule [ 25] reg32: LOCAL32

@ Doing node 2 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 3 codegen rule [ 7] aluRhs: ICONST_32

@ Doing node 4 codegen rule [161] root: BCOND_INT reg32 aluRhs

0x4078041c 44: cmp v3, #0

@ Outgoing local(1) reg(6): in correct register

0x40780420 48: bne PC=(0) @ branch to block L1

@ Doing node 2 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 2 codegen rule [154] param32: reg32

0x40780424 52: str v3, [rJSP], #+4

@ Doing node 6 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 7 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 5 codegen rule [141] reg32: METHOD_BLOCK

0x40780428 56: ldr a1, [pc, #+0] @ mb java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;

@ Doing node 12 codegen rule [128] invoke32_result: IINVOKE parameters reg32

@ Invoke a method w/ a 32bit return type

0x4078042c 60: mov lr, pc LSL #0 @ setup return address

0x40780430 64: ldr pc, [a1, #+0] @ call method through mb

@ Captured a stackmap here.

@ Doing node 12 codegen rule [148] reg32: invoke32_result

0x40780434 68: ldr v3, [rJSP, #-4]!

@ Doing node 8 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 8 codegen rule [157] effect: reg32

@ Doing node 8 codegen rule [ 1] root: effect

@ Doing node 8 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 11 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780438 72: str v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(1) reg(6): in correct register

@ Initial Temp REF set is

L1: 76: @ entry point for branches

@ Binding Incoming Local(1) to reg(6)

:::::Fixed instruction at 48 to reference 76

@ Doing node 13 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=9 compiledPc=76

@ Doing node 13 codegen rule [ 1] root: effect

@ Doing node 21 codegen rule [ 25] reg32: LOCAL32

@ Doing node 14 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 14 codegen rule [154] param32: reg32

0x4078043c 76: str v3, [rJSP], #+4

@ Doing node 16 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 17 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 14 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 18 codegen rule [142] reg32: NULLCHECK reg32

0x40780440 80: ldr v8, [v3, #+0] @ NULL check

@ Doing node 18 codegen rule [157] effect: reg32

@ Doing node 15 codegen rule [141] reg32: METHOD_BLOCK

0x40780444 84: ldr a1, [pc, #+0] @ mb java.lang.String.length()I

@ Doing node 19 codegen rule [ 17] reg32: ISEQUENCE_R effect reg32

@ Doing node 36 codegen rule [128] invoke32_result: IINVOKE parameters reg32

@ Invoke a method w/ a 32bit return type

0x40780448 88: mov lr, pc LSL #0 @ setup return address

0x4078044c 92: ldr pc, [a1, #+0] @ call method through mb

@ Captured a stackmap here.

@ Doing node 36 codegen rule [148] reg32: invoke32_result

0x40780450 96: ldr v4, [rJSP, #-4]!

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [157] effect: reg32

@ Doing node 20 codegen rule [ 1] root: effect

@ Doing node 30 codegen rule [ 25] reg32: LOCAL32

0x40780454 100: ldr lr, [rJFP, #-16] @ Java local cell # 0

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 23 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 39 codegen rule [106] reg32: FETCH32 FIELDREF32 reg32 memSpec

@ Do getfield:

0x40780458 104: ldr v8, [lr, #+12] @ value{I|F} = getfield(obj, fieldIdx);

@ Doing node 25 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 25 codegen rule [157] effect: reg32

@ Doing node 25 codegen rule [ 1] root: effect

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 27 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 33 codegen rule [105] reg32: FETCH32 FIELDREFOBJ reg32 memSpec

@ Do getfield:

0x4078045c 108: ldr v7, [lr, #+8] @ valueObj = getfield(obj, fieldIdx);

@ Doing node 29 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 29 codegen rule [157] effect: reg32

@ Doing node 29 codegen rule [ 1] root: effect

@ Doing node 29 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 41 codegen rule [ 63] reg32: ALENGTH reg32

0x40780460 112: ldr v6, [v7, #+8] @ arraylength

@ Doing node 31 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [157] effect: reg32

@ Doing node 31 codegen rule [ 1] root: effect

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 35 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780464 116: str v4, [rJFP, #-8] @ Java local cell # 2

@ Doing node 25 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [ 14] aluRhs: reg32

@ Doing node 40 codegen rule [ 43] reg32: IADD32 reg32 aluRhs

0x40780468 120: str v6, [rJFP, #+24] @ spill Java temp cell # 0

0x4078046c 124: add v6, v8, v4 LSL #0

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 38 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780470 128: str v6, [rJFP, #-4] @ Java local cell # 3

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [ 14] aluRhs: reg32

@ Doing node 32 codegen rule [161] root: BCOND_INT reg32 aluRhs

0x40780474 132: ldr v8, [rJFP, #+24] @ Java temp cell # 0

0x40780478 136: cmp v6, v8 LSL #0

@ Outgoing local(1) reg(6): not in register

0x4078047c 140: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(2) reg(7): in correct register

@ Outgoing local(0) reg(8): in wrong register

0x40780480 144: mov v5, lr LSL #0

@ Outgoing local(3) reg(9): in correct register

0x40780484 148: ble PC=(0) @ branch to block L2

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 22 codegen rule [154] param32: reg32

0x40780488 152: str v5, [rJSP], #+4

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 26 codegen rule [154] param32: reg32

0x4078048c 156: str v6, [rJSP], #+4

@ Doing node 43 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 44 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 45 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 42 codegen rule [141] reg32: METHOD_BLOCK

0x40780490 160: ldr a1, [pc, #+0] @ mb java.lang.StringBuffer.expandCapacity(I)V

@ Doing node 46 codegen rule [127] root: VINVOKE parameters reg32

@ Invoke a method w/ a void return type

0x40780494 164: mov lr, pc @ lr = pc

0x40780498 168: ldr pc, [pc, #+0] @ call CVMCCMinvokeCNIMethod() for java.lang.StringBuffer.expandCapacity(I)V

@ Captured a stackmap here.

@ Outgoing local(1) reg(6): not in register

0x4078049c 172: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(2) reg(7): not in register

0x407804a0 176: ldr v4, [rJFP, #-8] @ Java local cell # 2

@ Outgoing local(0) reg(8): not in register

0x407804a4 180: ldr v5, [rJFP, #-16] @ Java local cell # 0

@ Outgoing local(3) reg(9): not in register

0x407804a8 184: ldr v6, [rJFP, #-4] @ Java local cell # 3

@ Initial Temp REF set is

L2: 188: @ entry point for branches

@ Binding Incoming Local(1) to reg(6)

@ Binding Incoming Local(2) to reg(7)

@ Binding Incoming Local(0) to reg(8)

@ Binding Incoming Local(3) to reg(9)

:::::Fixed instruction at 148 to reference 188

@ Doing node 47 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=35 compiledPc=188

@ Doing node 47 codegen rule [ 1] root: effect

@ Doing node 58 codegen rule [ 25] reg32: LOCAL32

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 52 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 69 codegen rule [105] reg32: FETCH32 FIELDREFOBJ reg32 memSpec

@ Do getfield:

0x407804ac 188: ldr v8, [v5, #+8] @ valueObj = getfield(obj, fieldIdx);

@ Doing node 54 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 54 codegen rule [157] effect: reg32

@ Doing node 54 codegen rule [ 1] root: effect

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 55 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 70 codegen rule [106] reg32: FETCH32 FIELDREF32 reg32 memSpec

@ Do getfield:

0x407804b0 192: ldr v7, [v5, #+12] @ value{I|F} = getfield(obj, fieldIdx);

@ Doing node 57 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 57 codegen rule [157] effect: reg32

@ Doing node 57 codegen rule [ 1] root: effect

@ Doing node 71 codegen rule [ 25] reg32: LOCAL32

@ Doing node 48 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 49 codegen rule [ 35] reg32: ICONST_32

@ Doing node 50 codegen rule [ 25] reg32: LOCAL32

@ Doing node 54 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 57 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 60 codegen rule [130] iargs: NULL_IARG

@ Doing node 61 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 62 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 63 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 64 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 65 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 48 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 66 codegen rule [142] reg32: NULLCHECK reg32

0x407804b4 196: ldr lr, [v3, #+0] @ NULL check

@ Doing node 66 codegen rule [157] effect: reg32

@ Doing node 59 codegen rule [141] reg32: METHOD_BLOCK

0x407804b8 200: ldr lr, [pc, #+0] @ mb java.lang.String.getChars(II[CI)V

@ Doing node 67 codegen rule [ 17] reg32: ISEQUENCE_R effect reg32

@ Doing node 67 codegen rule [134] intrinsicMB: reg32

@ Doing node 68 codegen rule [138] effect: VINTRINSIC iargs intrinsicMB

@ Invoke INTRINSIC java.lang.String.getChars(II[CI)V:

0x407804bc 204: ldr ip, [sp, #+0] @ eeReg = ccee->ee

0x407804c0 208: str rJFP, [ip, #+76] @ flush JFP to stack

0x407804c4 212: mov a1, sp LSL #0

0x407804c8 216: sub sp, sp, #8

0x407804cc 220: mov a2, v3 LSL #0

0x407804d0 224: mov a3, #0 @ const 0

0x407804d4 228: mov a4, v4 LSL #0

0x407804d8 232: str v8, [sp, #+0]

0x407804dc 236: str v7, [sp, #+4]

0x407804e0 240: str rJSP, [rJFP, #+8]

0x407804e4 244: add lr, pc, 4 @ lr = pc + offset

0x407804e8 248: str lr, [rJFP, #+16]

0x407804ec 252: ldr pc, [pc, #+0] @ java.lang.String.getChars(II[CI)V helper

@ Captured a stackmap here.

0x407804f0 256: add sp, sp, #8

@ Doing node 68 codegen rule [ 1] root: effect

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 73 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 72 codegen rule [ 25] reg32: LOCAL32

@ Doing node 75 codegen rule [110] root: ASSIGN FIELDREF32 reg32 memSpec reg32

@ Do putfield:

0x407804f4 260: ldr v8, [rJFP, #-16] @ Java local cell # 0

0x407804f8 264: str v6, [v8, #+12] @ putfield(obj, fieldOffset, value{I|F});

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 76 codegen rule [181] root: IRETURN reg32

0x407804fc 268: str v8, [rJFP, #-16] @ Java local cell # 0

0x40780500 272: sub JSP, JFP, #12

0x40780504 276: ldr v3, [rJFP, #+0] @ PREV(v3) = frame.prevX for return helper to use

0x40780508 280: mov lr, pc @ lr = pc

0x4078050c 284: ldr pc, [pc, #+0] @ goto CVMCCMreturnFromSyncMethod

0x40780510 288: .word 3779452 @ CVMCCMreturnFromSyncMethod

:::::Fixed instruction at 284 to reference 288

0x40780514 292: .word 487448

:::::Fixed instruction at 252 to reference 292

0x40780518 296: .word 3889924 @ mb java.lang.String.getChars(II[CI)V

:::::Fixed instruction at 200 to reference 296

0x4078051c 300: .word 3778976

:::::Fixed instruction at 168 to reference 300

0x40780520 304: .word 3932968 @ mb java.lang.StringBuffer.expandCapacity(I)V

:::::Fixed instruction at 160 to reference 304

0x40780524 308: .word 3889868 @ mb java.lang.String.length()I

:::::Fixed instruction at 84 to reference 308

0x40780528 312: .word 3890960 @ mb java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;

:::::Fixed instruction at 56 to reference 312

0x4078052c 316: .word 3778536 @ CVMCCMinvokeNonstaticSyncMethodHelper

:::::Fixed instruction at 32 to reference 316

0x40780530 320: .word 3779224

:::::Fixed instruction at 16 to reference 320

>>>>>>>>>Push Code Buffer to PC = 4 (0x407803f4) >>>>>>>>

@ Capacity is 18 word(s)

0x407803f4 4: add a2, rJSP, #64

<<<<<<<<

>>>>>>>>>Push Code Buffer to PC = 36 (0x40780414) >>>>>>>>

@ spillSize is 1 word(s), add to JFP+24

0x40780414 36: add rJSP, rJFP, #28

<<<<<<<<

JS: COMPILED: size=404 startPC=0x407803f0 java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;

.

*CONGRATULATIONS: test Test completed with 411 tests passed and 0 failures

Failure #1:

Woke up! Cancelling latency request
...........Process #1949 received signal 4, suspending

Failure #2:

Woke up! Cancelling latency request

............JS: COMPILING java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;

#################################################

The maximum node counts per root node are 9

IR block list contains 3 blocks in method

#################################################

*************************************************

*

* (block ID:0 block PC:0 )

* IR root list contains 4 root nodes: in block

* flags: 0x41

* noMoreIncomingLocals: 0x1

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x1

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:478)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<0> (0x284c98): aload_1

<1> (0x284c99): ifnonnull <9>

<4> (0x284c9c): aload_1

<5> (0x284c9d): invokestatic_checkinit_quick #6366

<8> (0x284ca0): astore_1

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: -1 0

Original Incoming Locals(1):

local(1) ID(2)

Incoming Locals(1):

local(1) ID(2)

Assigned Locals(1):

ASSIGN(11): local(1) ID(10) rhsID(8)

Successor Blocks(1):

ID(1) LocalOrder(1) AssignOrder(0) RefsOK(1) Locals(1)

<(ID: 1) MAP_PC (NONE) 0>

<(ID: 4) BCOND (reference)

target: (BlockID: 1 BlockPC: 9)

condition: NE

flags: 0

<(ID: 2) IDENTITY (reference) (ref count: 2)

<(ID: 9) LOCAL (reference) 1>

<(ID: 3) CONST_STRING_OBJECT (reference) (stringObject 0x0)

<(ID: 8) IDENTITY (reference) (ref count: 2)

<(ID: 12) INVOKE (reference)

<(ID: 7) PARAMETER (reference)

<(ID: 2) IDENTITY (reference) (ref count: 2)

<(ID: 6) NULL_PARAMETER (NONE)

<(ID: 5) CONST_MB (address field) (java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;)

<(ID: 11) ASSIGN (reference) (assignIdx: 0)

<(ID: 10) LOCAL (reference) 1>

<(ID: 8) IDENTITY (reference) (ref count: 2)

*************************************************

*

* (block ID:1 block PC:9 )

* IR root list contains 9 root nodes: in block

* flags: 0x341

* noMoreIncomingLocals: 0x1

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x1

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:482)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<9> (0x284ca1): aload_1

<10> (0x284ca2): invokenonvirtual_quick #7441

<13> (0x284ca5): istore_2

<14> (0x284ca6): aload_0

<15> (0x284ca7): getfield_quick #3

<18> (0x284caa): iload_2

<19> (0x284cab): iadd

<20> (0x284cac): istore_3

<21> (0x284cad): iload_3

<22> (0x284cae): aload_0

<23> (0x284caf): agetfield_quick #2

<26> (0x284cb2): arraylength

<27> (0x284cb3): if_icmple <35>

<30> (0x284cb6): aload_0

<31> (0x284cb7): iload_3

<32> (0x284cb8): invokenonvirtual_quick #11037

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: 0 0

Original Incoming Locals(1):

local(1) ID(14)

Incoming Locals(1):

local(1) ID(14)

Assigned Locals(2):

ASSIGN(35): local(2) ID(34) rhsID(20)

ASSIGN(38): local(3) ID(37) rhsID(26)

Successor Blocks(1):

ID(2) LocalOrder(1) AssignOrder(2) RefsOK(0) Locals(1 2 0 3)

<(ID: 13) MAP_PC (NONE) 9>

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 36) INVOKE (int)

<(ID: 17) PARAMETER (reference)

<(ID: 14) IDENTITY (reference) (ref count: 2)

<(ID: 21) LOCAL (reference) 1>

<(ID: 16) NULL_PARAMETER (NONE)

<(ID: 19) SEQUENCE_R (address field)

<(ID: 18) NULL_CHECK (reference)

<(ID: 14) IDENTITY (reference) (ref count: 2)

<(ID: 15) CONST_MB (address field) (java.lang.String.length()I)

<(ID: 25) IDENTITY (32-bit field) (ref count: 2)

<(ID: 39) FETCH (32-bit field)

<(ID: 24) FIELD_REF (32-bit field)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 30) LOCAL (reference) 0>

<(ID: 23) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 29) IDENTITY (reference) (ref count: 2)

<(ID: 33) FETCH (reference)

<(ID: 28) FIELD_REF (reference)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 27) CONST_FIELD_OFFSET (NONE) (2)

<(ID: 31) IDENTITY (int) (ref count: 2)

<(ID: 41) ARRAY_LENGTH (int)

<(ID: 29) IDENTITY (reference) (ref count: 2)

<(ID: 35) ASSIGN (int) (assignIdx: 0)

<(ID: 34) LOCAL (int) 2>

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 38) ASSIGN (int) (assignIdx: 1)

<(ID: 37) LOCAL (int) 3>

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 40) ADD (int)

<(ID: 25) IDENTITY (32-bit field) (ref count: 2)

<(ID: 20) IDENTITY (int) (ref count: 3)

<(ID: 32) BCOND (int)

target: (BlockID: 2 BlockPC: 35)

condition: LE

flags: 0

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 31) IDENTITY (int) (ref count: 2)

<(ID: 46) INVOKE (v)

<(ID: 45) PARAMETER (reference)

<(ID: 22) IDENTITY (reference) (ref count: 3)

<(ID: 44) PARAMETER (int)

<(ID: 26) IDENTITY (int) (ref count: 3)

<(ID: 43) NULL_PARAMETER (NONE)

<(ID: 42) CONST_MB (address field) (java.lang.StringBuffer.expandCapacity(I)V)

*************************************************

*

* (block ID:2 block PC:35 )

* IR root list contains 6 root nodes: in block

* flags: 0x301

* noMoreIncomingLocals: 0x0

* noMoreIncomingRefLocals: 0x1

* orderedIncomingLocals: 0x0

* Source: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:486)

* Compilation depth: 0 locals : 0 .. 3

* Byte-codes for block:

<35> (0x284cbb): aload_1

<36> (0x284cbc): iconst_0

<37> (0x284cbd): iload_2

<38> (0x284cbe): aload_0

<39> (0x284cbf): agetfield_quick #2

<42> (0x284cc2): aload_0

<43> (0x284cc3): getfield_quick #3

<46> (0x284cc6): invokenonvirtual_quick #8053

<49> (0x284cc9): aload_0

<50> (0x284cca): iload_3

<51> (0x284ccb): putfield_quick #3

<54> (0x284cce): aload_0

<55> (0x284ccf): areturn

LOCALS MERGE INFO AT HEAD OF BLOCK: 0 1

*************************************************

Number and size of USED nodes in phi array: 0 0

Original Incoming Locals(4):

local(1) ID(48)

local(2) ID(50)

local(0) ID(51)

local(3) ID(72)

Incoming Locals(4):

local(1) ID(48)

local(2) ID(50)

local(0) ID(51)

local(3) ID(72)

<(ID: 47) MAP_PC (NONE) 35>

<(ID: 54) IDENTITY (reference) (ref count: 2)

<(ID: 69) FETCH (reference)

<(ID: 53) FIELD_REF (reference)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 58) LOCAL (reference) 0>

<(ID: 52) CONST_FIELD_OFFSET (NONE) (2)

<(ID: 57) IDENTITY (32-bit field) (ref count: 2)

<(ID: 70) FETCH (32-bit field)

<(ID: 56) FIELD_REF (32-bit field)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 55) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 68) INTRINSIC (v)

<(ID: 65) IARG (reference)

<(ID: 48) IDENTITY (reference) (ref count: 2)

<(ID: 71) LOCAL (reference) 1>

<(ID: 64) IARG (int)

<(ID: 49) CONST_JAVA_NUMERIC32 (int) (0)

<(ID: 63) IARG (int)

<(ID: 50) LOCAL (int) 2>

<(ID: 62) IARG (reference)

<(ID: 54) IDENTITY (reference) (ref count: 2)

<(ID: 61) IARG (int)

<(ID: 57) IDENTITY (32-bit field) (ref count: 2)

<(ID: 60) NULL_IARG (NONE)

<(ID: 67) SEQUENCE_R (address field)

<(ID: 66) NULL_CHECK (reference)

<(ID: 48) IDENTITY (reference) (ref count: 2)

<(ID: 59) CONST_MB (address field) (java.lang.String.getChars(II[CI)V)

<(ID: 75) ASSIGN (32-bit field)

<(ID: 74) FIELD_REF (32-bit field)

<(ID: 51) IDENTITY (reference) (ref count: 4)

<(ID: 73) CONST_FIELD_OFFSET (NONE) (3)

<(ID: 72) LOCAL (int) 3>

<(ID: 76) RETURN_VALUE (reference)

<(ID: 51) IDENTITY (reference) (ref count: 4)

NUM BARRIER BYTES = 0

NUM VIRTUAL INLINE BYTES = 0

NUM LARGE OPCODE BYTES = 0

NUM MAIN LINE INSTRUCTION BYTES ESTIMATE = 344

ESTIMATED BUFFER SIZE = 452

CODE BUFFER ADDRESS = 0x407803c0

PC MAP TABLE ADDRESS = 0x407803c8

CODE ENTRY ADDRESS = 0x407803f0

@ Method prologue

@ Stack limit check

0x407803f0 0: ldr a4, [sp, #+4] @ ccee->stackChunkEnd

0x407803f4 4: add a2, rJSP, #60 @ Set R1 = JSP + (capacity - argsSize) * 4

0x407803f8 8: str lr, [rJFP, #+16] @ Store LR into frame

0x407803fc 12: cmp a4, a2 LSL #0

0x40780400 16: ldrls pc, [pc, #+0] @ letInterpreterDoInvoke

@ Set up frame for synchronized method

0x40780404 20: sub a2, rJSP, #8 @ ARG2 = JSP - argsSize * 4

0x40780408 24: add v4, rJSP, #8 @ NEW_JFP = JSP + (maxLocals - argsSize) * 4

0x4078040c 28: mov lr, pc @ lr = pc

0x40780410 32: ldr pc, [pc, #+0] @ call CVMCCMinvokeNonstaticSyncMethodHelper

@ Interpreted -> compiled entry point

0x40780414 36: add rJSP, rJFP, #24 @ spill adjust goes here

@ Initial Temp REF set is

L0: 40: @ entry point for first block

@ Preloading incoming local(1) reg(6)

0x40780418 40: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Doing node 1 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=0 compiledPc=44

@ Doing node 1 codegen rule [ 1] root: effect

@ Doing node 9 codegen rule [ 25] reg32: LOCAL32

@ Doing node 2 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 3 codegen rule [ 7] aluRhs: ICONST_32

@ Doing node 4 codegen rule [161] root: BCOND_INT reg32 aluRhs

0x4078041c 44: cmp v3, #0

@ Outgoing local(1) reg(6): in correct register

0x40780420 48: bne PC=(0) @ branch to block L1

@ Doing node 2 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 2 codegen rule [154] param32: reg32

0x40780424 52: str v3, [rJSP], #+4

@ Doing node 6 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 7 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 5 codegen rule [141] reg32: METHOD_BLOCK

0x40780428 56: ldr a1, [pc, #+0] @ mb java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;

@ Doing node 12 codegen rule [128] invoke32_result: IINVOKE parameters reg32

@ Invoke a method w/ a 32bit return type

0x4078042c 60: mov lr, pc LSL #0 @ setup return address

0x40780430 64: ldr pc, [a1, #+0] @ call method through mb

@ Captured a stackmap here.

@ Doing node 12 codegen rule [148] reg32: invoke32_result

0x40780434 68: ldr v3, [rJSP, #-4]!

@ Doing node 8 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 8 codegen rule [157] effect: reg32

@ Doing node 8 codegen rule [ 1] root: effect

@ Doing node 8 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 11 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780438 72: str v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(1) reg(6): in correct register

@ Initial Temp REF set is

L1: 76: @ entry point for branches

@ Binding Incoming Local(1) to reg(6)

:::::Fixed instruction at 48 to reference 76

@ Doing node 13 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=9 compiledPc=76

@ Doing node 13 codegen rule [ 1] root: effect

@ Doing node 21 codegen rule [ 25] reg32: LOCAL32

@ Doing node 14 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 14 codegen rule [154] param32: reg32

0x4078043c 76: str v3, [rJSP], #+4

@ Doing node 16 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 17 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 14 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 18 codegen rule [142] reg32: NULLCHECK reg32

0x40780440 80: ldr v8, [v3, #+0] @ NULL check

@ Doing node 18 codegen rule [157] effect: reg32

@ Doing node 15 codegen rule [141] reg32: METHOD_BLOCK

0x40780444 84: ldr a1, [pc, #+0] @ mb java.lang.String.length()I

@ Doing node 19 codegen rule [ 17] reg32: ISEQUENCE_R effect reg32

@ Doing node 36 codegen rule [128] invoke32_result: IINVOKE parameters reg32

@ Invoke a method w/ a 32bit return type

0x40780448 88: mov lr, pc LSL #0 @ setup return address

0x4078044c 92: ldr pc, [a1, #+0] @ call method through mb

@ Captured a stackmap here.

@ Doing node 36 codegen rule [148] reg32: invoke32_result

0x40780450 96: ldr v4, [rJSP, #-4]!

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [157] effect: reg32

@ Doing node 20 codegen rule [ 1] root: effect

@ Doing node 30 codegen rule [ 25] reg32: LOCAL32

0x40780454 100: ldr lr, [rJFP, #-16] @ Java local cell # 0

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 23 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 39 codegen rule [106] reg32: FETCH32 FIELDREF32 reg32 memSpec

@ Do getfield:

0x40780458 104: ldr v8, [lr, #+12] @ value{I|F} = getfield(obj, fieldIdx);

@ Doing node 25 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 25 codegen rule [157] effect: reg32

@ Doing node 25 codegen rule [ 1] root: effect

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 27 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 33 codegen rule [105] reg32: FETCH32 FIELDREFOBJ reg32 memSpec

@ Do getfield:

0x4078045c 108: ldr v7, [lr, #+8] @ valueObj = getfield(obj, fieldIdx);

@ Doing node 29 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 29 codegen rule [157] effect: reg32

@ Doing node 29 codegen rule [ 1] root: effect

@ Doing node 29 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 41 codegen rule [ 63] reg32: ALENGTH reg32

0x40780460 112: ldr v6, [v7, #+8] @ arraylength

@ Doing node 31 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [157] effect: reg32

@ Doing node 31 codegen rule [ 1] root: effect

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 35 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780464 116: str v4, [rJFP, #-8] @ Java local cell # 2

@ Doing node 25 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 20 codegen rule [ 14] aluRhs: reg32

@ Doing node 40 codegen rule [ 43] reg32: IADD32 reg32 aluRhs

0x40780468 120: str v6, [rJFP, #+24] @ spill Java temp cell # 0

0x4078046c 124: add v6, v8, v4 LSL #0

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 38 codegen rule [ 2] root: ASSIGN LOCAL32 reg32

0x40780470 128: str v6, [rJFP, #-4] @ Java local cell # 3

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 31 codegen rule [ 14] aluRhs: reg32

@ Doing node 32 codegen rule [161] root: BCOND_INT reg32 aluRhs

0x40780474 132: ldr v8, [rJFP, #+24] @ Java temp cell # 0

0x40780478 136: cmp v6, v8 LSL #0

@ Outgoing local(1) reg(6): not in register

0x4078047c 140: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(2) reg(7): in correct register

@ Outgoing local(0) reg(8): in wrong register

0x40780480 144: mov v5, lr LSL #0

@ Outgoing local(3) reg(9): in correct register

0x40780484 148: ble PC=(0) @ branch to block L2

@ Doing node 22 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 22 codegen rule [154] param32: reg32

0x40780488 152: str v5, [rJSP], #+4

@ Doing node 26 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 26 codegen rule [154] param32: reg32

0x4078048c 156: str v6, [rJSP], #+4

@ Doing node 43 codegen rule [150] parameters: NULL_PARAMETER

@ Doing node 44 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 45 codegen rule [151] parameters: IPARAMETER param32 parameters

@ Doing node 42 codegen rule [141] reg32: METHOD_BLOCK

0x40780490 160: ldr a1, [pc, #+0] @ mb java.lang.StringBuffer.expandCapacity(I)V

@ Doing node 46 codegen rule [127] root: VINVOKE parameters reg32

@ Invoke a method w/ a void return type

0x40780494 164: mov lr, pc @ lr = pc

0x40780498 168: ldr pc, [pc, #+0] @ call CVMCCMinvokeCNIMethod() for java.lang.StringBuffer.expandCapacity(I)V

@ Captured a stackmap here.

@ Outgoing local(1) reg(6): not in register

0x4078049c 172: ldr v3, [rJFP, #-12] @ Java local cell # 1

@ Outgoing local(2) reg(7): not in register

0x407804a0 176: ldr v4, [rJFP, #-8] @ Java local cell # 2

@ Outgoing local(0) reg(8): not in register

0x407804a4 180: ldr v5, [rJFP, #-16] @ Java local cell # 0

@ Outgoing local(3) reg(9): not in register

0x407804a8 184: ldr v6, [rJFP, #-4] @ Java local cell # 3

@ Initial Temp REF set is

L2: 188: @ entry point for branches

@ Binding Incoming Local(1) to reg(6)

@ Binding Incoming Local(2) to reg(7)

@ Binding Incoming Local(0) to reg(8)

@ Binding Incoming Local(3) to reg(9)

:::::Fixed instruction at 148 to reference 188

@ Doing node 47 codegen rule [192] effect: MAP_PC

@ MAP_PC idepth=0 javaPc=35 compiledPc=188

@ Doing node 47 codegen rule [ 1] root: effect

@ Doing node 58 codegen rule [ 25] reg32: LOCAL32

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 52 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 69 codegen rule [105] reg32: FETCH32 FIELDREFOBJ reg32 memSpec

@ Do getfield:

0x407804ac 188: ldr v8, [v5, #+8] @ valueObj = getfield(obj, fieldIdx);

@ Doing node 54 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 54 codegen rule [157] effect: reg32

@ Doing node 54 codegen rule [ 1] root: effect

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 55 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 70 codegen rule [106] reg32: FETCH32 FIELDREF32 reg32 memSpec

@ Do getfield:

0x407804b0 192: ldr v7, [v5, #+12] @ value{I|F} = getfield(obj, fieldIdx);

@ Doing node 57 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 57 codegen rule [157] effect: reg32

@ Doing node 57 codegen rule [ 1] root: effect

@ Doing node 71 codegen rule [ 25] reg32: LOCAL32

@ Doing node 48 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 49 codegen rule [ 35] reg32: ICONST_32

@ Doing node 50 codegen rule [ 25] reg32: LOCAL32

@ Doing node 54 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 57 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 60 codegen rule [130] iargs: NULL_IARG

@ Doing node 61 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 62 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 63 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 64 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 65 codegen rule [131] iargs: IARG reg32 iargs

@ Doing node 48 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 66 codegen rule [142] reg32: NULLCHECK reg32

0x407804b4 196: ldr lr, [v3, #+0] @ NULL check

@ Doing node 66 codegen rule [157] effect: reg32

@ Doing node 59 codegen rule [141] reg32: METHOD_BLOCK

0x407804b8 200: ldr lr, [pc, #+0] @ mb java.lang.String.getChars(II[CI)V

@ Doing node 67 codegen rule [ 17] reg32: ISEQUENCE_R effect reg32

@ Doing node 67 codegen rule [134] intrinsicMB: reg32

@ Doing node 68 codegen rule [138] effect: VINTRINSIC iargs intrinsicMB

@ Invoke INTRINSIC java.lang.String.getChars(II[CI)V:

0x407804bc 204: ldr ip, [sp, #+0] @ eeReg = ccee->ee

0x407804c0 208: str rJFP, [ip, #+76] @ flush JFP to stack

0x407804c4 212: mov a1, sp LSL #0

0x407804c8 216: sub sp, sp, #8

0x407804cc 220: mov a2, v3 LSL #0

0x407804d0 224: mov a3, #0 @ const 0

0x407804d4 228: mov a4, v4 LSL #0

0x407804d8 232: str v8, [sp, #+0]

0x407804dc 236: str v7, [sp, #+4]

0x407804e0 240: str rJSP, [rJFP, #+8]

0x407804e4 244: add lr, pc, 4 @ lr = pc + offset

0x407804e8 248: str lr, [rJFP, #+16]

0x407804ec 252: ldr pc, [pc, #+0] @ java.lang.String.getChars(II[CI)V helper

@ Captured a stackmap here.

0x407804f0 256: add sp, sp, #8

@ Doing node 68 codegen rule [ 1] root: effect

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 73 codegen rule [ 15] memSpec: ICONST_32

@ Doing node 72 codegen rule [ 25] reg32: LOCAL32

@ Doing node 75 codegen rule [110] root: ASSIGN FIELDREF32 reg32 memSpec reg32

@ Do putfield:

0x407804f4 260: ldr v8, [rJFP, #-16] @ Java local cell # 0

0x407804f8 264: str v6, [v8, #+12] @ putfield(obj, fieldOffset, value{I|F});

@ Doing node 51 codegen rule [ 38] reg32: IDENT32 reg32

@ Doing node 76 codegen rule [181] root: IRETURN reg32

0x407804fc 268: str v8, [rJFP, #-16] @ Java local cell # 0

0x40780500 272: sub JSP, JFP, #12

0x40780504 276: ldr v3, [rJFP, #+0] @ PREV(v3) = frame.prevX for return helper to use

0x40780508 280: mov lr, pc @ lr = pc

0x4078050c 284: ldr pc, [pc, #+0] @ goto CVMCCMreturnFromSyncMethod

0x40780510 288: .word 3779452 @ CVMCCMreturnFromSyncMethod

:::::Fixed instruction at 284 to reference 288

0x40780514 292: .word 487448

:::::Fixed instruction at 252 to reference 292

0x40780518 296: .word 3889924 @ mb java.lang.String.getChars(II[CI)V

:::::Fixed instruction at 200 to reference 296

0x4078051c 300: .word 3778976

:::::Fixed instruction at 168 to reference 300

0x40780520 304: .word 3932968 @ mb java.lang.StringBuffer.expandCapacity(I)V

:::::Fixed instruction at 160 to reference 304

0x40780524 308: .word 3889868 @ mb java.lang.String.length()I

:::::Fixed instruction at 84 to reference 308

0x40780528 312: .word 3890960 @ mb java.lang.String.valueOf(Ljava/lang/Object;)Ljava/lang/String;

:::::Fixed instruction at 56 to reference 312

0x4078052c 316: .word 3778536 @ CVMCCMinvokeNonstaticSyncMethodHelper

:::::Fixed instruction at 32 to reference 316

0x40780530 320: .word 3779224

:::::Fixed instruction at 16 to reference 320

>>>>>>>>>Push Code Buffer to PC = 4 (0x407803f4) >>>>>>>>

@ Capacity is 18 word(s)

0x407803f4 4: add a2, rJSP, #64

<<<<<<<<

>>>>>>>>>Push Code Buffer to PC = 36 (0x40780414) >>>>>>>>

@ spillSize is 1 word(s), add to JFP+24

0x40780414 36: add rJSP, rJFP, #28

<<<<<<<<

JS: COMPILED: size=404 startPC=0x407803f0 java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;

Process #2008 received signal 11

Process #2008 being suspended

So, as luck would have it I cannot get the unit test to fail as it did before I updated the source for the JIT tracing. The test either passes or I get the signal 11. I ran the tests ~40 times.

IRT the iMX31, the SDRAM bus is 32-bits. I'd be happy to provide the reference manual and datasheet if that would help.

thanks
ken

mlam
Offline
Joined: 2006-10-13

Ken,
I made a mistake. The exception happened inside String.length() instead of StringBuffer.append(). I'll need you to change (in jitdebug.c) the StringBuffer method string to "java.lang.String.length()I". And please repeat the experiment after that.

However, I suspect that it won't help much though. The code for StringBuffer.append() looks correct, and I suspect the code for String.length() will too. From the intermittent failures you've been having, I think that the problem is a cache flushing problem which Chris told you about right from the beginning. I think I can come up with a way to test that definitely. I will post the technique in my java.net blog later once I've worked out all the details.

To help me with this, please run the above exercise on String.length() just so I can be sure that things haven't gone wrong. Also, please look at the iMX 31 docs and find out for me the size of its data (D) and instruction (I) caches. I will update this forum thread with a url to the blog entry once it's ready.

Thanks.

Mark

mlam
Offline
Joined: 2006-10-13

Ken,

After thinking some more about the cache flushing problem, in the end, I don't have a definite solution to test this out with. I was thinking of writing a brute force assembly routine that walks 16K of code and load 16K of data. The intent is to walk all over the 16K of i-cache and 16K of d-cache, thereby flushing it. But after further thought about it, I don't think that that is adequate to guarantee that the cache will be flushed.

The ARM core that the iMX31 uses has a 32set/32way associative cache. That means even if I walk the 16K worth of code, I cannot guarantee that all the cache lines will be flushed because I don't really know how the cache lines are associated with memory addresses. The ARM instruction set does come with cache flushing instructions, but those can only be executed in non-user mode i.e. by the OS. This means that I cannot write this function for you either.

In addition, there are issues about whether the cache is configured as write-through or write-back, and then there's the write-back buffer that needs to be flushed as well. These will complicate things even more. Hence, a simple memory walking routine won't be enough (in more than one way).

Hence, you're back to making sure that the OS actually implement the cache flushing mechanism correctly, and that the CVMJITflushCacheDoit() function needs to this mechanism and flush the cache corresponding to the proper region of memory. I'm sure the others have suggested this before. Sorry, I can't help much with that.

I'm not all caught up on this entire forum thread yet. I apologize if you've already posted this info, but have you already consulted your linux provider regarding what the proper way to flush the cache is in their implementation? Is it described in the documentation for linux that you have for your Freescale board?

Mark

ken_gilmer
Offline
Joined: 2007-01-19

Mark,

Thanks so much for your detailed analysis. I'm gettting and engineer from our board manufacturer involved, and he's asking as a test if it's possible to disable the cache and have the JIT run without it to validate that the culprit is CVMJITflushCacheDoit(). Is this possible, and if so what source files do I need to be concerned with?

Thanks
Ken

mlam
Offline
Joined: 2006-10-13

Ken,

I don't personally know how to disable the cache on the iMX31 processor. Usually, this is done in privileged non-user code, and is something that the OS or bootloader does. If your board's OS does offer such an option, it is worth a test. Please consult the board manufacturer / OS doumentation for details on how to do that. You won't need any software changes on the VM side to work with a disabled cache.

Assuming that you are able to disable the cache, then yes, that would be a good test of whether cache flushing is the culprit. However, be forewarned that performance will degrade when the cache is disabled.

Mark

ken_gilmer
Offline
Joined: 2007-01-19

Mark, as it turns out there is specific kernel config flags to do this in our kernel. I'll update you when I have something meaningful.

Thanks
ken

ken_gilmer
Offline
Joined: 2007-01-19

Mark,

Ok, so I've been working with an engineer at Freescale. He had me build a kernel without cache support:

make cachepolicy=uncached L2cache=off ...

I am seeing the same behavior (intermittent seg faults) as before with the cache turned on. Does this mean that the issue could be elsewhere or is this the wrong test?

Thanks!
Ken

mlam
Offline
Joined: 2006-10-13

Ken,
Assuming that:
1. the kernel he built you really does turn off the cache, and
2. that there were no mistakes in your installing it, and
3. the iMX31 hardware is not faulty

then yes, the segfaults would imply that the problem lies elsewhere. Hmmm, this is strange. The JIT code obviously works on other ARM devices. So, what's different in the iMX31 that could cause this?

OK, let's take the approach of assuming that there is a JIT bug, and do a JIT debugging exercise to see if we can uncover more data. Do this exercise on your cache disabled system for now just to be sure that we don't complicate the issue further.

1. In src/linux-arm/javavm/include/jit/jit_arch.h, search for #define CVMJIT_TRAP_BASED_NULL_CHECKS. Change the #define to #undef. This will disable using segfaults as the detection mechanism for NullPointerExceptions. Rebuild CVM. Make sure to include the CVM_DEBUG=true option.

2. Run CVM to make sure that you're still seeing the segfaults as expected.

3. Open up src/linux-arm/javavm/runtime/segvhandler_arch.c and look for the function handleSegv(). Look for the line that says "CVMUint32 *pc = (CVMUint32 *)ucp->..."

4. Run CVM in GDB, and set a breakpoint at the above line.

5. When the breakpoint is reached:
- do a "n" and step over the statement once.
- do a "p /x $pc" and write down the pc value that is computed there.
- do a "x /20i $pc-40" to dump the instructions in the vicinity of the instruction that segfaulted. Capture this dump for later reference.
- keep stepping and see if you get into the if block that starts with "if (CVMJITcodeCacheInCompiledMethod(...". If so, this means that the segfault came from within the compiled code.
- if it didn't step into that block, next see if it steps into the block that starts with "} else if (CVMJITcodeCacheInCCM(...". If so, this means that the segfault came from the JIT glue code.
- if it didn't step into that block, then the segfault is not due to other code.
- If you found that the segfault was caused by one of the 2 cases of JIT related code, then in gdb, type the following: "call CVMJITcodeCacheFindCompileMethod($pc, 1)". It should print the name of the compiled method or piece of glue code from where the segfault originated. Write that down.

6. Repeat steps 4 and 5 several times to see if the segfault always comes from the same location or from different locations.

7. Summarize what you found in the above exercise and post it here for us to take a look at. The next steps will depend on what you find.

Mark

ken_gilmer
Offline
Joined: 2007-01-19

Mark,

Sorry for the delay on this. I've been running around with other projects and haven't had the time to devote to this until now.

> 1. In src/linux-arm/javavm/include/jit/jit_arch.h,
> search for #define CVMJIT_TRAP_BASED_NULL_CHECKS.
> Change the #define to #undef. This will disable
> using segfaults as the detection mechanism for
> NullPointerExceptions. Rebuild CVM. Make sure to
> include the CVM_DEBUG=true option.

Done

> 2. Run CVM to make sure that you're still seeing the
> segfaults as expected.

Done, same behavior as before.

> 3. Open up
> src/linux-arm/javavm/runtime/segvhandler_arch.c and
> look for the function handleSegv(). Look for the
> line that says "CVMUint32 *pc = (CVMUint32
> *)ucp->..."

Yep, got it.

> 4. Run CVM in GDB, and set a breakpoint at the above
> line.

I was able to build GDB for the target platform, so I don't have to deal with remote debugging. When I run the cvm in GDB I get the following output (regardless of setting the breakpoint):

mx31# gdb
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "arm-none-linux-gnueabi".
(gdb) file phoneme_adv-revUNKNOWN/bin/cvm
Reading symbols from /tmp/ft1/phoneme_adv-revUNKNOWN/bin/cvm...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /tmp/ft1/phoneme_adv-revUNKNOWN/bin/cvm phoneme_adv-revUNKNOWN/bin/cvm
[Thread debugging using libthread_db enabled]
Error while reading shared library symbols:
Cannot find new threads: capability not available

I've done some basic googling on "cannot find new threads" and am not coming up with any easy fixes. Is there some other debug flag I need to enable when building phoneME perhaps?

Thanks
Ken

ken_gilmer
Offline
Joined: 2007-01-19

FYI I got some help from a generous soul on the LTIB mailing list regarding this. I'll be trying his suggestion and responding accordingly.

Thanks
ken

ken_gilmer
Offline
Joined: 2007-01-19

Hello ~

Wow this is a big thread and goes back a ways. I'm happy to say that JIT runs on the iMX31 with kernel version 2.6.21. Freescale recently came out with an update for their BSP, and we were able to successfully build phoneME Advanced with JIT enabled with that release. Thanks again for everyone's help and please let me know if anyone would like further details on the resolution of this issue.

Regards,

Ken Gilmer

Bug Labs, Inc.

mlam
Offline
Joined: 2006-10-13

Ken,
Congratulations on your progress. I have a few comments below.

> We've made some good progress on this issue. Added
> these settings to the GNUmakefile for our
> architecture (i.MX31) produces a debug CVM that
> passes all tests with JIT enabled:
>
> ASM_ARCH_FLAGS += -mfpu=vfp
> CC_ARCH_FLAGS += -mfloat-abi=softfp -mfpu=vfp
> CVM_JIT_COPY_CCMCODE_TO_CODECACHE ?= false
> CVM_FORCE_HARD_FLOAT ?= true
> CVM_JIT_USE_FP_HARDWARE ?= true

It seems suspicious to me that you are using "-mfloat-abi=softfp" together with "CVM_FORCE_HARD_FLOAT ?= true" and "CVM_JIT_USE_FP_HARDWARE ?= true". The former says that you want float arguments passed to software routines, and the latter says that you want float arguments passed in hardware registers (or pseudo-hardware registers if you don't have a real FPU). So, something is not right here.

> The issue now is that when I disable debug in the
> build, the test classes get to a certain point and
> then hang:

> Woke up! Cancelling latency request
>
> ...........
> [terminal hangs here]

Try running CVM inside of gdb (if you can run gdb on your target). When it hangs, type Ctrl-C there to break in gdb. Then, get a stack dump of your current thread as well as other threads to see where it is you are hung.

An alternative you can also try in addition is to get a Java stack dump with this hack that I wrote about here:
http://weblogs.java.net/blog/mlam/archive/2007/06/async_thread_du.html

See what info these get you.

Regards,
Mark

ken_gilmer
Offline
Joined: 2007-01-19

Hinkmond and Mark,

Thanks for helping me with this. In an effort to isolate the issue, I've backed out all the build flags to this:

CC_ARCH_FLAGS += -msoft-float
CVM_JIT_COPY_CCMCODE_TO_CODECACHE ?= false
USE_AAPCS ?= true
CVM_JIT ?= true

When I run the tests here is the result:

Woke up! Cancelling latency request
...........
testManyFieldsAndMethods() failed:
java.lang.NullPointerException
at java.lang.String.length()I(Compiled Method)(String.java:463)
at java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:482)
at Test.testManyFieldsAndMethods()V(Test.java:718)
at Test.main([Ljava/lang/String;)V(Test.java:142)
at sun.misc.CVM.runMain()V(CVM.java:514)

*TOO BAD: test Test completed with 351 tests passed and 1 failures

If I disable JIT, all the tasks pass succesfully. Any ideas as to why this test is failing?

Thanks
Ken

Hinkmond Wong

Hi Ken,

You will probably need a CVM engineer to help you with this. Here is
the line where it is failing:

cdc/src/share/javavm/test/Test.java:718
-----
...
java.lang.reflect.Method m = c.getMethod("method" + i, null);
^^^^^^^^^^^^
...

The constant Java string "method" tries to append the value of the int
variable "i" and gets a null pointer exception on the constant string
"method", trying to get its length.

Looks like it got garbage collected when it shouldn't have down in the
VM, or there is some type of memory corruption problem happening.

Are you sure you applied this patch already that Chris pointed out to you?

src/linux-arm/javavm/runtime/jit/flushcache_arch.S
---

http://wiki.java.net/bin/view/Mobileandembedded/PhoneMEAdvancedCriticalB...

Hinkmond

phonemeadvanced@mobileandembedded.org wrote:
> Hinkmond and Mark,
>
> Thanks for helping me with this. In an effort to isolate the issue, I've backed out all the build flags to this:
>
> CC_ARCH_FLAGS += -msoft-float
> CVM_JIT_COPY_CCMCODE_TO_CODECACHE ?= false
> USE_AAPCS ?= true
> CVM_JIT ?= true
>
> When I run the tests here is the result:
>
> Woke up! Cancelling latency request
> ...........
> testManyFieldsAndMethods() failed:
> java.lang.NullPointerException
> at java.lang.String.length()I(Compiled Method)(String.java:463)
> at java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;(StringBuffer.java:482)
> at Test.testManyFieldsAndMethods()V(Test.java:718)
> at Test.main([Ljava/lang/String;)V(Test.java:142)
> at sun.misc.CVM.runMain()V(CVM.java:514)
>
> *TOO BAD: test Test completed with 351 tests passed and 1 failures
>
> If I disable JIT, all the tasks pass succesfully. Any ideas as to why this test is failing?
>
> Thanks
> Ken
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

ken_gilmer
Offline
Joined: 2007-01-19

Hi Hinkmond,

I'm using a recent MR2 snapshot and confirmed the source I have already has the source that the patch you mentioned contains. IRT hardware failure, we have two development boards from Freescale, and they both exhibit the problem. Other than JIT, everything works consistently. What needs to happen for me to talk with a CVM engineer? In general, is JIT a difficult feature to get working in various embedded systems?

Thanks!
ken

mlam
Offline
Joined: 2006-10-13

Ken,

You're already talking to CVM engineers (Chris and me). Regarding the difficulty of porting the CVM JIT, that depends on your perspective. The CVM JIT is actually very easy to port compared to other VM JIT implementations. It is even more easy if you are using a CPU that we already have an implementation for. In your case, we do i.e.the linux ARM JIT. So now, let's get into the details of your problem:

According to your exception stack trace, you're seeing a NULL pointer exception thrown from StringBuffer.append(). From the source for StringBuffer.append() in src/share/javavm/classes/java/lang/StringBuffer.java, I see that the string ref is guaranteed to not be NULL. On the surface, it looks like some bad code is being generated by the JIT. So, let's check this:

Run CVM with -Xjit:inline=none and make sure that you still see the same
problem. I suspect you will.

Modify src/share/javavm/runtime/jit/jitdebug.c as follows:
1. Search for #undef USE_TRACING_LIST_FILTER.
2. Change the #undef to #define.
3. Search for methodsToTraceCompilation
4. Change "java.lang.String.(Ljava/lang/StringBuffer;)V" to
"java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;"
5. Build CVM with your current options plus these:
CVM_JIT_DEBUG=true CVM_TRACE_JIT=true

Run Test and capture the output (out and err) to a file. If the problem
reproduces with -Xjit:inline=none, then add that option to your command line.

You should see the JIT tracing output for the compilation of the
StringBuffer.append() method. Post that for us to take a look at.
I want to take a look at the code generated for StringBuffer.append() to see
what could have trashed the string ref that should not be null.

Regards,
Mark

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Ken,
>
> You're already talking to CVM engineers (Chris and me). Regarding the difficulty of porting the CVM JIT, that depends on your perspective. The CVM JIT is actually very easy to port compared to other VM JIT implementations. It is even more easy if you are using a CPU that we already have an implementation for. In your case, we do i.e.the linux ARM JIT. So now, let's get into the details of your problem:
>

Thanks, Mark!

Hinkmond

> According to your exception stack trace, you're seeing a NULL pointer exception thrown from StringBuffer.append(). From the source for StringBuffer.append() in src/share/javavm/classes/java/lang/StringBuffer.java, I see that the string ref is guaranteed to not be NULL. On the surface, it looks like some bad code is being generated by the JIT. So, let's check this:
>
> Run CVM with -Xjit:inline=none and make sure that you still see the same
> problem. I suspect you will.
> ....
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

ken_gilmer
Offline
Joined: 2007-01-19

Chris and Dean,

This thread is pretty old, but I've dusted off my toolchain and am having another go at getting JIT working on the i.MX31. I have someone helping me now that is much more knowledgable about embedded development and he wrote the test program that you suggested. Here it is:

#include "javavm/include/flushcache_cpu.h"

#include

int main (void)

{

long tData[100];

printf ("Flush Cache Test.\n");

printf ("...calling CVMflushCache().\n");

CVMflushCache (&tData, &tData[99]);

printf ("...exiting.\n");

return 0;

}

Putting this on my target and running produces:

mx31# ./fc

Flush Cache Test.

...calling CVMflushCache().

...exiting.

So, from my understanding this should have failed with a signal 4 if it was a problem with our kernel. Is this correct? If so where should we begin looking next? I've tried both enabling and disabling AACPS with the same result. I'm using the latest phoneme svn snapshot as of July 18th, and I'm running against version 2.6.19.2 of the kernel. Suggestions on the next place to look are greatly appriciated!

thanks,
ken

cjplummer
Offline
Joined: 2006-10-16

Try the CVMflushCache on a large malloc block (like 512k). Also try it on a small chunk of memory (maybe 100 bytes) from within the malloc.

Chris

ken_gilmer
Offline
Joined: 2007-01-19

Chris, thanks for your suggestion. We tried the following program and did not have any errors or segfaults when running it:

int main (void)
{
long tData[100];
void *tPtr;
printf ("Flush Cache Test.\n");
tPtr = malloc (0x80000);
printf ("...calling CVMflushCache() #1\n");
CVMflushCache (&tData, &tData[99]);
printf ("...calling CVMflushCache() #2\n");
CVMflushCache (tPtr, tPtr+0x7FFFF);
printf ("...calling CVMflushCache() #3\n");
CVMflushCache (tPtr+100, tPtr+200);
printf ("...exiting.\n");

return 0;
}

Program output:

mx31# ./fc512k
Flush Cache Test.
...calling CVMflushCache() #1
...calling CVMflushCache() #2
...calling CVMflushCache() #3
...exiting.

So it seems like when we test this function call it works, but when building phoneME it does not..? Any idea what could cause this, or perhaps the problem lies somewhere else?

Thanks
Ken

cjplummer
Offline
Joined: 2006-10-16

Looking back at your original gdb session, I see the following:

> (gdb) target remote 192.168.4.2:8090
> Remote debugging using 192.168.4.2:8090
> 0x400007e0 in ?? ()
> (gdb) continue
> Continuing.

Why did you continue from this point rather than debug.

> Program received signal SIGILL, Illegal instruction.
> 0x00170bc0 in ?? ()
> (gdb) bt
> #0 0x00170bc0 in ?? ()
> (gdb) x /4i $pc-8
> Cannot access memory at address 0x0
> 0x170bb8: mov r2, #0 ; 0x0
> 0x170bbc: svc 0x009f0002
> 0x170bc0: mov pc, lr
> 0x170bc4: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
> (gdb)

As mentioned before, this looks like the linux-arm CVMflushCache function. However, gdb isn't showing you any symbols. If you haven't already, build using CVM_DEBUG=true so you get symbols plus other debugging code. Once you do this, if the above still doesn't show symbols, try "x /20i CVMflushCache" and see if it shows code in the same area as above?

You might also want to verify the arguments passed to CVMflushCache to make sure we aren't passing garbage to the kernel.

Chris

ken_gilmer
Offline
Joined: 2007-01-19

Hey ~

We've made some good progress on this issue. Added these settings to the GNUmakefile for our architecture (i.MX31) produces a debug CVM that passes all tests with JIT enabled:

ASM_ARCH_FLAGS += -mfpu=vfp
CC_ARCH_FLAGS += -mfloat-abi=softfp -mfpu=vfp
CVM_JIT_COPY_CCMCODE_TO_CODECACHE ?= false
CVM_FORCE_HARD_FLOAT ?= true
CVM_JIT_USE_FP_HARDWARE ?= true

The issue now is that when I disable debug in the build, the test classes get to a certain point and then hang:

Requesting GC with a latency request of 2 seconds

(Turning GC tracing on)

Sleeping 5 seconds, and waiting for GC's

Woke up! Cancelling latency request

...........
[terminal hangs here]

Pressing Ctrl-c will give me back the shell but the tests never complete. What in the debug version is causing this to work that's failing in the non-debug build?

Thanks!
ken

Hinkmond Wong

Chris is on vacation, but I'll take a stab and trying to help you with
your question (maybe one of the other CVM engineers can jump in):

phonemeadvanced@mobileandembedded.org wrote:
> (Turning GC tracing on)
>
> Sleeping 5 seconds, and waiting for GC's
>
> Woke up! Cancelling latency request
>
> ...........
> [terminal hangs here

You show 11 periods ("."), not the normal 13 periods. If that is a
verbatim copy & paste (with exactly 11 periods), then you must be
hanging (since it needs to complete with 13 periods) in the
testManyFieldsAndMethods() method in:

cdc/src/share/javavm/test/Test.java
---
static void testManyFieldsAndMethods() {
ManyFieldsAndMethods many = new ManyFieldsAndMethods();
Class c = many.getClass();
int i;
try {
for (i = 0; i < 4*256; i++) {
if (i % 25 == 0) {
System.out.print(".");
}
if (i == 100) i+= 100;
if (i == 300) i+= 200;
if (i == 600) i+= 400;
java.lang.reflect.Method m = c.getMethod("method" + i,
null);
Integer result = (Integer)m.invoke(many, null);
if ( !assert0( result.intValue() == i,
"testManyFieldsAndMethods: method"+i ) ){
return;
}
}
} catch (Throwable e) {
System.out.println("\ntestManyFieldsAndMethods() failed: ");
e.printStackTrace();
nFailure += 1;
}
many.field678 = -1;
assert0( many.method499() + many.method678() == 498,
"testManyFieldsAndMethods: many.method499() +
many.method678() == 498");
}
}
----

That's a strange place to be hanging. Do you think you could have a
memory corruption problem (too many free() calls to a pointer or pointer
to garbage)?

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

ken_gilmer
Offline
Joined: 2007-01-19

The kernel I'm using is 2.16.16 with some mx31 specific patches. Chris, Dean, and Tom I really appriciate your suggestions and attention. Let me do some work on this w/ my Kernel. I'll post back when I have more details.

regards
ken

cjplummer
Offline
Joined: 2006-10-16

> > This is a SIGILL (signal 4) not the SIGSEGV that
> you
> > were seeing before. I suspect GDB is the problem
> > here. Since the PC is past the svc instructon and
> on
> > the return instruction (mov pc,lr), I suggest
> typing
> > "continue" again and see what happens. If you keep
> > hitting this SIGILL, try the following:
> >
> > handle SIGILL nostop noprint pass
> >
> > Chris
>
> Actually Chris, it was SIGILL:
>
> mx31# bin/cvm -cp testclasses.zip Test
> Process #1836 received signal 4, suspending
>
> and it happened without gdb, so I'm thinking
> that the platform does not support the normal linux
> ARM cache flush system call.
>
> Dean

Sorry, it was another recent thread that mentioned signal 10 and signal 11.

I agree that it is probably lack of kernel support. That's rather surprising given we've been doing Linux/ARM ports for 5 years and never ran into a customer that had this problem.

The CDC porting guide won't provide any help for this one, so this probably means doing some kernel debugging. It might be best to start looking at the kernel sources first and see how they do cache flushing.

BTW, what version of the kernel is being used?

Chris

Tom May

phonemeadvanced@mobileandembedded.org wrote:
>>> This is a SIGILL (signal 4) not the SIGSEGV that
>> you
>>> were seeing before. I suspect GDB is the problem
>>> here. Since the PC is past the svc instructon and
>> on
>>> the return instruction (mov pc,lr), I suggest
>> typing
>>> "continue" again and see what happens. If you keep
>>> hitting this SIGILL, try the following:
>>>
>>> handle SIGILL nostop noprint pass
>>>
>>> Chris
>> Actually Chris, it was SIGILL:
>>
>> mx31# bin/cvm -cp testclasses.zip Test
>> Process #1836 received signal 4, suspending
>>
>> and it happened without gdb, so I'm thinking
>> that the platform does not support the normal linux
>> ARM cache flush system call.
>>
>> Dean
>
> Sorry, it was another recent thread that mentioned signal 10 and signal 11.
>
> I agree that it is probably lack of kernel support. That's rather surprising given we've been doing Linux/ARM ports for 5 years and never ran into a customer that had this problem.
>
> The CDC porting guide won't provide any help for this one, so this probably means doing some kernel debugging. It might be best to start looking at the kernel sources first and see how they do cache flushing.
>
> BTW, what version of the kernel is being used?

The kernel code that should be handling the "swi 0x009f0002" is in
arch/arm/kernel/traps.c, at least it is in the 2.6.something code I'm
looking at:

case NR(cacheflush):
do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2);
return 0;

Tom.

>
> Chris
> [Message sent by forum member 'cjplummer' (cjplummer)]
>
> http://forums.java.net/jive/thread.jspa?messageID=200040
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
> For additional commands, e-mail: advanced-help@phoneme.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

xyzzy
Offline
Joined: 2006-08-30

Does the gdb you are running on the host support ARM as a target?

Dean

> Chris,
>
> I've tried your suggestion with gdb, although I
> I think there is something I'm doing wrong. Forgive
> my ignorance, as this my first experience with it. I
> have to run gdb remotely as it's not available in my
> target environment. Here is what I get:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> CVM output with debug compiled in:
>
> CVM Configuration:
> Java stack chunk size (stackChunkSize): 2048
> Java stack minimum size (stackMinSize): 3072
> Java stack maximum size (stackMaxSize):
> axSize): 131072
> GC[SS]: Initialized semi-space gen for generational
> GC
> Size of *each* semispace in bytes=1048576
> Limits of generation =
> ration = [0x4016e000,0x4036e000)
> First semispace =
> e = [0x4016e000,0x4026e000)
> Second semispace =
> ce = [0x4026e000,0x4036e000)
> GC[MC]: Initialized mark-compact gen for generational
> GC
> Size of the space in bytes=1048576
> Limits of generation =
> ration = [0x4036e000,0x4046e000)
> GC[generational]: Sizes
> youngGen = min 1048576 start 1048576 max
> 8576 max 1048576
> oldGen = min 1048576 start 1048576 max
> 8576 max 4194304
> overall = min 2097152 start 2097152 max
> 7152 max 5242880
> GC[generational]: Auxiliary data structures
> heapBaseMemoryArea=[0x4016e000,0x4076e200)
> cardTable=[0x4076e000,0x40771000)
> objectHeaderTable=[0x40771000,0x40774000)
> summaryTable=[0x40774000,0x40780000)
> Process #1851 received signal 4, suspending
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Running gdbserver on the target:
>
> mx31# gdbserver host:8090 cvm
> Process cvm created; pid = 1866
> Listening on port 8090
> Remote debugging from host 192.168.4.1
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Getting a backtrace from my host:
>
> (gdb) target remote 192.168.4.2:8090
> Remote debugging using 192.168.4.2:8090
> 0x00000000 in ?? ()
> warning: Unable to find dynamic linker breakpoint
> function.
> GDB will be unable to debug shared library
> initializers
> and track explicitly loaded dynamic code.
> (gdb) bt
> #0 0x00000000 in ?? ()
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Running "x /4i $pc-8":
> (gdb) x /4i $pc-8
> 0xfffffff8: Cannot access memory at address
> 0xfffffff8
>
> Also, if I type "run" at (gdb) I get this:
>
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
>
> Starting program:
> /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/ph
> oneme_advanced-mr2/install/phoneME_Advanced-phoneme_ad
> vanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/c
> vm
> /bin/bash:
> /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/ph
> oneme_advanced-mr2/install/phoneME_Advanced-phoneme_ad
> vanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/c
> vm: cannot execute binary file
> /bin/bash:
> /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/ph
> oneme_advanced-mr2/install/phoneME_Advanced-phoneme_ad
> vanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/c
> vm: Success
>
> Program exited with code 01.
>
>
> I suspect this is not what you need. It looks as if
> gdb on my host is trying to execute the ARM binary.
> Looking around the net for the happy path lead to no
> o alternatives. Please let me know if you have any
> suggestions.
>
> Thanks,
> ken

ken_gilmer
Offline
Joined: 2007-01-19

Hi Dean,

AFAIK, the gdb on my host is standard for fedora f5:

# gdb --version
GNU gdb Red Hat Linux (6.3.0.0-1.122rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".

Does the latest output look off to you?

Thanks!
Ken

xyzzy
Offline
Joined: 2006-08-30

> Hi Dean,
>
> AFAIK, the gdb on my host is standard for fedora
> ra f5:
>
> # gdb --version
> GNU gdb Red Hat Linux (6.3.0.0-1.122rh)
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General
> Public License, and you are
> welcome to change it and/or distribute copies of it
> under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show
> warranty" for details.
> This GDB was configured as "i386-redhat-linux-gnu".
>
> Does the latest output look off to you?
>
> Thanks!
> Ken

It sounds like that gdb will only support x86. You may be able to build your own "cross" gdb by configuring it with something like --target=linux-arm-mx31.

Dean

ken_gilmer
Offline
Joined: 2007-01-19
ken_gilmer
Offline
Joined: 2007-01-19

>Without sending me the whole file, can you give me an idea of the types of things you added or changed in the GNUmakefile?

Very little. I took the arm-linux-generic and changed these lines:
CVM_DEFINES += -DAAPCS
CC_ARCH_FLAGS = -msoft-float
CVM_JIT ?= false

I created a defs.mk for my specific toolchain. Really, all the pain I had was in the toolchain provided by my dev board to propery build phoneme. The toolchain is called LTIB, and it has a package manager. I may be submitting a package to them for phoneme. That package would probably be the most useful for anyone looking to build phoneme for the freescale MX31.

cjplummer
Offline
Joined: 2006-10-16

> >Without sending me the whole file, can you give me
> an idea of the types of things you added or changed
> in the GNUmakefile?
>
> Very little. I took the arm-linux-generic and
> changed these lines:
> CVM_DEFINES += -DAAPCS
> CC_ARCH_FLAGS = -msoft-float
> CVM_JIT ?= false
>
> I created a defs.mk for my specific toolchain.
> Really, all the pain I had was in the toolchain
> n provided by my dev board to propery build phoneme.
> The toolchain is called LTIB, and it has a package
> e manager. I may be submitting a package to them for
> phoneme. That package would probably be the most
> useful for anyone looking to build phoneme for the
> freescale MX31.

It sounds like this is best handled with a twiki page, both because the GNUmakefile work is minimal, and also because there is a lot of work in setting up the toolchain. Let me know if you'd like me to setup a twiki page you can edit.

Chris Plummer

ken_gilmer
Offline
Joined: 2007-01-19

After reading through some of the contributor docs and reviewing the /build directory, I'm not sure that my makefile is relevent for contribution. From my understanding the ontology is [operating system]-[cpu family]-[distribution?/os version/processor implementation]. It would seem that my processor-specific makefile is too specific for contribution. Please LMK if this is not the case.

cjplummer
Offline
Joined: 2006-10-16

> After reading through some of the contributor docs
> and reviewing the /build directory, I'm not sure that
> my makefile is relevent for contribution. From my
> understanding the ontology is [operating system]-[cpu
> family]-[distribution?/os version/processor
> implementation]. It would seem that my
> processor-specific makefile is too specific for
> contribution. Please LMK if this is not the case.

Actually specific is what we are looking for. However, we also don't want to clutter the build/ directory. So criteria for a new device build directory usually has to do with how useful it will be. If the mx31 is reasonably popular and requires some non-obvious flags in the GNUmakefile, then it would be a good candidate.

Without sending me the whole file, can you give me an idea of the types of things you added or changed in the GNUmakefile?

The other option is to just document the changes needed. We are adding twiki pages for this purpose. Here's one example for the Nokia 770:

http://wiki.java.net/bin/view/Mobileandembedded/PhoneMEAdvancedPlatforms...

Although the work needed for the 770 is somewhat complex, the GNUmakefile changes are trivial, so probably we won't add a new build directory for it, and just rely on the twiki to document what is needed. Something like this can also be done for the MX31.

Chris

kwwong
Offline
Joined: 2006-09-19

Hi Ken,

You can do a sigignore(SIGFPE) to ignore the signal 8. We do this in our VFP code.

Also in my Makefiles I do the following. It may be different for your case depending on your gcc. If your gcc uses VFP instructions by default you don't need to change the makefile. If not, these are the settings from my Makefile to tell gcc to use VFP instructions.

CVM_DEFINES += -DAAPCS
ASM_ARCH_FLAGS += -mfpu=vfp
CC_ARCH_FLAGS += -mfloat-abi=softfp -mfpu=vfp

Kinsley

ken_gilmer
Offline
Joined: 2007-01-19

Kinsley,

Thanks for your advice. I'm not quite sure what you mean by 'do a sigignore'. If that's a command it isn't available to be in my target environment. I tried your Makefile suggestions but they still result in the dreaded signal 8. Thanks again for your suggestion!

Ken

kwwong
Offline
Joined: 2006-09-19

Hi Ken,

sigignore() is a system call. As a temporary fix you can add the following to

src/linux/javavm/runtime/globals_md.c

CVMBool CVMinitStaticState()
{
...
...
linuxNetInit();
sigignore(SIGPIPE);

sigignore(SIGFPE); // Ignore the Signal 8
...
...
}

Kinsley

jamjung
Offline
Joined: 2003-08-28

Hi Ken,

I am trying to find a JVM that runs on the MX31/Linux platform. According to you message, you seemed to build JVM on your own. Can you guide me how to start and where I should get relevant information?
I've been asking similar questions to many venders but I couldn't get any simple and clean answer. So I would deeply appreciate if you could help me.

Thanks,

James//

ken_gilmer
Offline
Joined: 2007-01-19

Hi James,

I've build both jamvm/gnu classpath and phoneME for the MX31. In order to build phoneme for the mx31, you need to start with getting the toolchain working. If you are using LTIB, I'd start with the helloworld package, getting that to run properly on your mx31. From there, in the doc/LtibFaq document, there is a section that describes how to add a package to the system. I followed that to get phoneme to build. My spec file, while incomplete, builds correctly and looks like this:

Summary : PhoneME Java Virtual Machine
Name : phoneme_advanced
Version : mr2
Release : 1
License : GPL
Vendor : Sun Microsystems, Inc.
Packager : Bug Labs, Inc.
Group : Development/Languages
Source : %{name}-%{version}.tar.gz
BuildRoot : %{_tmppath}/%{name}
Prefix : %{pfx}

%Description
%{summary}

%Prep
%setup

%Build
cd build/linux-arm-bug
J2ME_CLASSLIB=foundation make bin

%Install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}

%Clean
cd build/linux-arm-bug
make clean

%Files
%defattr(-,root,root)
%{pfx}/*

Hope this helps. If you are not using LTIB, I can't help you much. I'd suggest reading the Sun phoneme docs for building, and then hooking in whatever toolchain you are using into that.

Best of luck,
Ken

jamjung
Offline
Joined: 2003-08-28

Hi Ken, Million thanks to you for quick and kind reply. I'll try what you suggested using LTIB.

cjplummer
Offline
Joined: 2006-10-16

> Hello! Thanks to the excellent docs provided for Sun
> on building the jvm and also info on this forum I've
> got a running linux-arm-mx31 make file that generates
> a cvm that passes the test suite on the mx31
> development board. I would like to contribute this
> back to the source tree if there is interest. I
> looked through the 'how to contribute' page but am
> not clear on what I need to do from this point. Any
> suggestions?
>
You have to sign a Contributors Agreement, and then find someone with commit privledges to review and commit your changes. If you don't know who to ask, I suggest you start a thread documenting the changes you want to make and ask for help getting them committed.

> Also, I have a question regarding the jvm. If I
> enable JIT in the make file, my JVM segfaults -
>
> mx31# bin/cvm -cp testclasses.zip Test
> Process #1836 received signal 4, suspending
>
If you are using MR1, you need to apply this patch:

http://wiki.java.net/bin/view/Mobileandembedded/PhoneMEAdvancedCriticalB...

> I've read through other posts of issues for specific
> processors. In general, are there are restrictions
> on types of processors that can use JIT? Any tips on
> how to resolve this?
>
ARMv4 or later is the major requirement, which means anything less than about 8 years old:)

Dual cores are currently not supported. There are also calling convention issues that must be dealt with in the GNUmakefile (search for AAPCS). I recently added a new GNUmakefile to MR2 that can be used for MR1 also. The comments in it do a good job of documenting how to setup the GNUmakefile for your port.

https://phoneme.dev.java.net/svn/phoneme/components/cdc/trunk/build/linu...

regards,

Chris Plummer

> Thanks!
> ken

ken_gilmer
Offline
Joined: 2007-01-19

Chris, I will get to the committers agreement and create a thread suggesting my addition, which is just a /build/linux-arm-mx31/GNUMakefile.

Regarding JIT, I'm using MR2, the latest from svn as of yesterday. The svn revision is 1427 and the name of the artifict that gets created upon 'make bin' is phoneME_Advanced-phoneme_advanced_mr2_bXX-linux_arm_mx31-bin-rev1427-rev1427.

The MX31 is a single core ARM1136JF-S (ARM v6) processor with hardware VFP. Here are the relevant lines in my makefile:

CVM_DEFINES += -DAAPCS
CC_ARCH_FLAGS = -msoft-float
CVM_JIT ?= false

Turning on JIT causes the signal 4. Switching to CC_ARCH_FLAGS = -fpu=vfp results in a signal 8 during test execution during the fp operations.

Any other tips or suggestions?

Thanks
Ken

Message was edited by: ken_gilmer

cjplummer
Offline
Joined: 2006-10-16

> Chris, I will get to the committers agreement and
> create a thread suggesting my addition, which is just
> a /build/linux-arm-mx31/GNUMakefile.
>
> Regarding JIT, I'm using MR2, the latest from svn as
> of yesterday. The svn revision is 1427 and the name
> of the artifict that gets created upon 'make bin' is
> phoneME_Advanced-phoneme_advanced_mr2_bXX-linux_arm_mx
> 31-bin-rev1427-rev1427.
>
Sorry about the funny bundle name. It's due to a recent change I made. I'll get it fixed soon.

> The MX31 is a single core ARM1136JF-S (ARM v6)
> processor with hardware VFP. Here are the relevant
> lines in my makefile:
>
> CVM_DEFINES += -DAAPCS
> CC_ARCH_FLAGS = -msoft-float
> CVM_JIT ?= false
>
> Turning on JIT causes the signal 4.

This is SIGILL, an illegal instruction. Possibly an unsupported FP
instruction is being executed, but I can't see why, since currently
the JIT does not generate any FP instructions on ARM. It uses a
combination of its own soft float assembler code, plus calling out to
C for stuff we didn't optimize. Last time we saw this was becuase
CLZ was being used on an ARMv4 board, but it should work fine
on ARMv6.

I would suggest building with CVM_DEBUG=true, run from withinn GDB,
and send me backtrace and "x /4i $pc-8" output.

> Switching to
> CC_ARCH_FLAGS = -fpu=vfp results in a signal 8 during
> test execution during the fp operations.
>
This is SIGFPE, a floating point exception. I'm guessing you get this
even without the JIT. I don't know enough about VFP to really guide
you here. But I might suggest you also try -mfloat-abi=softfp. I know
for our in house VFP board, we use the following and it works:

ASM_ARCH_FLAGS += -mfpu=vfp
CC_ARCH_FLAGS += -mfloat-abi=softfp -mfpu=vfp

> Any other tips or suggestions?
>
That's it for now. I'll make sure our VFP expert is watching this
thread and see if he has further comments.

Chris

ken_gilmer
Offline
Joined: 2007-01-19

Chris,

I've tried your suggestion with gdb, although I think there is something I'm doing wrong. Forgive my ignorance, as this my first experience with it. I have to run gdb remotely as it's not available in my target environment. Here is what I get:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CVM output with debug compiled in:

CVM Configuration:
Java stack chunk size (stackChunkSize): 2048
Java stack minimum size (stackMinSize): 3072
Java stack maximum size (stackMaxSize): 131072
GC[SS]: Initialized semi-space gen for generational GC
Size of *each* semispace in bytes=1048576
Limits of generation = [0x4016e000,0x4036e000)
First semispace = [0x4016e000,0x4026e000)
Second semispace = [0x4026e000,0x4036e000)
GC[MC]: Initialized mark-compact gen for generational GC
Size of the space in bytes=1048576
Limits of generation = [0x4036e000,0x4046e000)
GC[generational]: Sizes
youngGen = min 1048576 start 1048576 max 1048576
oldGen = min 1048576 start 1048576 max 4194304
overall = min 2097152 start 2097152 max 5242880
GC[generational]: Auxiliary data structures
heapBaseMemoryArea=[0x4016e000,0x4076e200)
cardTable=[0x4076e000,0x40771000)
objectHeaderTable=[0x40771000,0x40774000)
summaryTable=[0x40774000,0x40780000)
Process #1851 received signal 4, suspending

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running gdbserver on the target:

mx31# gdbserver host:8090 cvm
Process cvm created; pid = 1866
Listening on port 8090
Remote debugging from host 192.168.4.1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Getting a backtrace from my host:

(gdb) target remote 192.168.4.2:8090
Remote debugging using 192.168.4.2:8090
0x00000000 in ?? ()
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(gdb) bt
#0 0x00000000 in ?? ()

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running "x /4i $pc-8":
(gdb) x /4i $pc-8
0xfffffff8: Cannot access memory at address 0xfffffff8

Also, if I type "run" at (gdb) I get this:

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/phoneme_advanced-mr2/install/phoneME_Advanced-phoneme_advanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/cvm
/bin/bash: /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/phoneme_advanced-mr2/install/phoneME_Advanced-phoneme_advanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/cvm: cannot execute binary file
/bin/bash: /home/kgilmer/ltib/ltib-imx31ads-20060709/rpm/BUILD/phoneme_advanced-mr2/install/phoneME_Advanced-phoneme_advanced_mr2_bXX-linux_arm_bug-bin-rev1427-rev1427/bin/cvm: Success

Program exited with code 01.

I suspect this is not what you need. It looks as if gdb on my host is trying to execute the ARM binary. Looking around the net for the happy path lead to no alternatives. Please let me know if you have any suggestions.

Thanks,
ken

cjplummer
Offline
Joined: 2006-10-16

Hi Ken,

I've never done remote debugging with GDB, so I'm not sure how to properly start a program remotely from the gdb master. I think you are right that the "run" command is running the ARM binary on the host. Maybe someone else can explain how to do this properly. However, I'm pretty sure you need to use --attach
when launching gdbserver to attach to the crashed process.

Also, I think after connecting to the crashed process, if you type "continue" before "bt", then the backtrace should work. The reason is because once the sig 4 happens, CDC catches the signal and suspends the process. If you then resume execution in this thread, it will return to the instruction that caused the sig 4, and this time gdb will handle the crash, allowing you to debug at the point of the crash.

Chris

ken_gilmer
Offline
Joined: 2007-01-19

Chris,

I was unable to get gdbserver to attach to an already crashed process, but I was able to get it to execute a new instance of cvm, like this:

~~~~~~~~ Target ~~~~~~~~~~~~

mx31# gdbserver host:8092 /tmp/broken_cvm/bin/cvm
Process /tmp/broken_cvm/bin/cvm created; pid = 1947
Listening on port 8092

~~~~~~~~~ Host ~~~~~~~~~

(gdb) target remote 192.168.4.2:8092
Remote debugging using 192.168.4.2:8092
0x00000000 in ?? ()

~~~~~~~~~ Target ~~~~~~~~~~~

Remote debugging from host 192.168.4.1

~~~~~~~~~~ Host ~~~~~~~~~~~

(gdb) continue
Continuing.

Program received signal SIGILL, Illegal instruction.
0x00393158 in ?? ()
(gdb) bt
#0 0x00393158 in ?? ()
Cannot access memory at address 0x2740
(gdb) x /4i $pc-8
0x393150: add %al,(%eax)
0x393152: add %al,(%eax)
0x393154: add %al,(%eax)
0x393156: add %al,(%eax)

~~~~~~~~~~ Target ~~~~~~~~~~~

CVM Configuration:
Java stack chunk size (stackChunkSize): 2048
Java stack minimum size (stackMinSize): 3072
Java stack maximum size (stackMaxSize): 131072
GC[SS]: Initialized semi-space gen for generational GC
Size of *each* semispace in bytes=1048576
Limits of generation = [0x4016e000,0x4036e000)
First semispace = [0x4016e000,0x4026e000)
Second semispace = [0x4026e000,0x4036e000)
GC[MC]: Initialized mark-compact gen for generational GC
Size of the space in bytes=1048576
Limits of generation = [0x4036e000,0x4046e000)
GC[generational]: Sizes
youngGen = min 1048576 start 1048576 max 1048576
oldGen = min 1048576 start 1048576 max 4194304
overall = min 2097152 start 2097152 max 5242880
GC[generational]: Auxiliary data structures
heapBaseMemoryArea=[0x4016e000,0x4076e200)
cardTable=[0x4076e000,0x40771000)
objectHeaderTable=[0x40771000,0x40774000)
summaryTable=[0x40774000,0x40780000)

It would seem to me that gdb is working now, thanks to your suggestions. Does this information shed any light on the problem?

Thanks again!
Ken

cjplummer
Offline
Joined: 2006-10-16

Hi Ken,

The "x /4i $pc-8" is showing x86 instruction, not ARM. I'm not sure how to fix this. As I said before, I haven't used gdbserver debugging before, so I'm not certain of how to get this to work. Dean mentioned that the gdb on the host needs to be built with ARM support. Perhaps it has not been. That means you either need to get a full gdb installed on the target, or find a host gdb that supports ARM instructions.

regards,

Chris

ken_gilmer
Offline
Joined: 2007-01-19

Chris and Dean, thanks for your continued help. Per Dean's suggestion, I've built my own gdb on the host with "--host=i686-pc-linux-gnu --target=arm-pc-linux-gnu" passed into the configure script. Now when I run gdb (I think) I'm getting the output you are looking for:

$ ./gdb
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-pc-linux-gnu".
Setting up the environment for debugging gdb.
No symbol table is loaded. Use the "file" command.
No symbol table is loaded. Use the "file" command.
/tmp/gdb/gdb-6.6/gdb/.gdbinit:8: Error in sourced command file:
No breakpoint number 0.
(gdb) target remote 192.168.4.2:8090
Remote debugging using 192.168.4.2:8090
0x400007e0 in ?? ()
(gdb) continue
Continuing.

Program received signal SIGILL, Illegal instruction.
0x00170bc0 in ?? ()
(gdb) bt
#0 0x00170bc0 in ?? ()
(gdb) x /4i $pc-8
Cannot access memory at address 0x0
0x170bb8: mov r2, #0 ; 0x0
0x170bbc: svc 0x009f0002
0x170bc0: mov pc, lr
0x170bc4: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
(gdb)

Is this correct? Sorry, I have no idea what the correct output should look like, so I have to assume this may be it.

Thanks again,
Ken