From: Filip P. <pi...@pu...> - 2009-10-17 20:03:32
|
Well, you cannot just insert CALL operations anywhere ... you have to ensure that the stack at the time of the call is amenable to the execution of Java methods. So, we need more details to help you out. Where, exactly, in the compile() method, are you adding the call to emitCALL_Abs? And, FYI, you will notice that in the compile() method there is a lot of documentation on the state of the stack at each point. You should make sure that you understand what code generated by that method is doing to the stack, what a Java stack looks like, what a C stack looks like, and whether or not you are inserting the call to emitCALL at a point where the stack looks like a Java stack, a C stack, or something in between. -Filip On Oct 17, 2009, at 15:57 , Colin(Du Li) wrote: > > Sorry, I should have explained my question more clearly. > I added the profiling codes to "compile" method in JNICompiler.java as > follows: > > public static synchronized CompiledMethod compile(NativeMethod > method) { > JNICompiledMethod cm = > (JNICompiledMethod)CompiledMethods.createCompiledMethod(method, > CompiledMethod.JNI); > ArchitectureSpecific.Assembler asm = new > ArchitectureSpecific.Assembler(100 /*, true*/); // some size for the > instruction array > > //added by me > > asm > .emitCALL_Abs > (Magic.getTocPointer().plus(Entrypoints.testMethod.getOffset())); > > ....... > > The profiling method is very simple like: > @Entrypoint > public static final void test(){ > VM.sysWriteln("Tested !!!"); > } > > But RVM give me the following error message: > JikesRVM: TROUBLE. Got a signal (Segmentation fault; #11) from > outside the > VM's address space in thread 0xb7f066d0. > JikesRVM: UNRECOVERABLE trapped signal 11 (Segmentation fault) > handler stack 0x1 > si->si_addr 0x1 > cs 0x00000073 > ds 0x0000007b > es 0x0000007b > fs 0x00000000 > gs 0x00000033 > ss 0x0000007b > edi 0xa4c809f8 > esi -- PR/VP 0x62130dcc > ebp 0x621499e4 > esp -- SP 0x621499c8 > ebx 0x001146c8 > edx 0x62128d04 > ecx 0x00000003 > eax 0x00112c20 > eip 0x00000001 > trapno 0x0000000e > err 0x00000004 > eflags 0x00010202 > fpregs 0x9a49de0 > oldmask 0x00020000 > cr2 0x00000001 > fp0 0x00000000000000000000 > fp1 0x00000000000000000000 > fp2 0x00000000000000000000 > fp3 0x00000000000000000000 > fp4 0x00000000000000000000 > fp5 0x00000000000000000000 > fp6 0x00000000000000000000 > fp7 0x0000000000009efc4010 > JikesRVM: internal error > -- Stack -- > at [0x62149a6c, 0x652223f2] Lorg/jikesrvm/runtime/DynamicLibrary; > callOnLoad()V at line 145 > at [0x62149a6c, 0x652223f2] Lorg/jikesrvm/runtime/DynamicLibrary; > <init>(Ljava/lang/String;)V at line 96 > at [0x62149ab8, 0x648754c3] Lorg/jikesrvm/runtime/DynamicLibrary; > load(Ljava/lang/String;)I at line 223 > at [0x62149b10, 0x653008fd] Ljava/lang/VMRuntime; > nativeLoad(Ljava/lang/String;Ljava/lang/ClassLoader;)I at line 87 > at [0x62149b10, 0x653008fd] Ljava/lang/Runtime; > loadLib(Ljava/lang/String;Ljava/lang/ClassLoader;)I at line 698 > at [0x62149b10, 0x653008fd] Ljava/lang/Runtime; > loadLibrary(Ljava/lang/String;Ljava/lang/ClassLoader;)V at line 760 > at [0x62149b60, 0x65301171] Ljava/lang/System; > loadLibrary(Ljava/lang/String;)V at line 662 > at [0x62149b60, 0x65301171] Lorg/jikesrvm/VM; finishBooting()V at > line > 341 > at [0x62149b78, 0x0804f5f5] Lorg/jikesrvm/VM; boot()V at line 145 > > > I don't figure out what's wrong. > > Thanks. > > Du Li > > Eliot Moss wrote: >> >> Colin(Du Li) wrote: >>> When I try to call "VM.sysWriteln" to do some profiling in >>> entrypoint >>> method, >>> e.g. Entrypoints.aastoreMethod. RVM always give me >>> Jikes_RBoot_Exception, >>> or >>> even crash the GNU library. >>> Why does this happen? >>> And how shall I profile in a enterpoint method? >> >> Just a thought, but could the expressions you're using in the >> sysWriteln >> call possibly require allocation? You can't do allocation early in >> the >> boot sequence. Using the + operator on strings, etc., can do this. >> Someone else might be able to enumerate the restriction more >> precisely. >> I think it should work with simple constant strings, though ... >> >> Eliot Moss >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart >> your >> developing skills, take BlackBerry mobile applications to market >> and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Jikesrvm-researchers mailing list >> Jik...@li... >> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers >> >> > > -- > View this message in context: http://www.nabble.com/Why-cannot-I-call-method-%22VM.sysWriteln%22-in-entrypoint-method-tp25935200p25941327.html > Sent from the jikesrvm-researchers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Jikesrvm-researchers mailing list > Jik...@li... > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers |