|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
A question about JNI functionsHi, everyone,
I have a question related to JNI function in Jikes. In JNI function in specification is use jobject to refer to an object, as: jobject GetObjectField(jobject obj, jfieldID fieldID) But in JNIFunctions.java, there corresponding function is: private static int GetObjectField(JNIEnvironment env, int objJREF, int fieldID) My question is where to do this transformation for "jobject" to "int"? in constructing JNI environment or somewhere else? Thanks. Du Li |
|
|
Re: [rvm-research] A question about JNI functionsHi,
jobject = int The 'jobject' type in JNI can be anything as long as 0=null. On the JNIFunctions side, we have a table that translates these ints to actual object pointers. Since we control the creation of new jobjects, this just works: when we need to return a jobject, we just assign a new int value to that object, put it in the table, and return the int. Does that make sense? -Filip On Oct 9, 2009, at 0:07 , Colin(Du Li) wrote: > > Hi, everyone, > > I have a question related to JNI function in Jikes. > In JNI function in specification is use jobject to refer to an > object, as: > jobject GetObjectField(jobject obj, jfieldID fieldID) > > But in JNIFunctions.java, there corresponding function is: > private static int GetObjectField(JNIEnvironment env, int objJREF, > int > fieldID) > > My question is where to do this transformation for "jobject" to > "int"? in > constructing JNI environment or somewhere else? > > Thanks. > > Du Li > > -- > View this message in context: http://www.nabble.com/A-question-about-JNI-functions-tp25815232p25815232.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 > Jikesrvm-researchers@... > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers ------------------------------------------------------------------------------ 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 Jikesrvm-researchers@... https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers |
|
|
Re: [rvm-research] A question about JNI functionsIt makes much sense.
Thanks a lot, Flip! One follow-up question. Then the native codes(outside VM) can use method "env.getJNIRef(objJREF)" to get raw address to Java object, right? If so, it seems that JNI codes can modify Java heap. Why does the Jikes Docs claims "A JNI call is a GC-safe point, since JNI code cannot freely modify the Java heap"(http://jikesrvm.org/JNI) ? Thanks again. Du Li
|
|
|
Re: [rvm-research] A question about JNI functionsNative code cannot use env.getJNIRef. That method is only visible to
RVM's internal code. -Filip On Oct 9, 2009, at 11:33 AM, Colin(Du Li) wrote: > > It makes much sense. > Thanks a lot, Flip! > > One follow-up question. > Then the native codes(outside VM) can use method > "env.getJNIRef(objJREF)" to > get raw address to Java object, right? > > If so, it seems that JNI codes can modify Java heap. Why does the > Jikes Docs > claims "A JNI call is a GC-safe point, since JNI code cannot freely > modify > the Java heap"(http://jikesrvm.org/JNI) ? > > Thanks again. > > Du Li > > > Filip Pizlo-2 wrote: >> >> Hi, >> >> jobject = int >> >> The 'jobject' type in JNI can be anything as long as 0=null. >> >> On the JNIFunctions side, we have a table that translates these ints >> to actual object pointers. Since we control the creation of new >> jobjects, this just works: when we need to return a jobject, we just >> assign a new int value to that object, put it in the table, and >> return >> the int. >> >> Does that make sense? >> >> -Filip >> >> >> >> >> On Oct 9, 2009, at 0:07 , Colin(Du Li) wrote: >> >>> >>> Hi, everyone, >>> >>> I have a question related to JNI function in Jikes. >>> In JNI function in specification is use jobject to refer to an >>> object, as: >>> jobject GetObjectField(jobject obj, jfieldID fieldID) >>> >>> But in JNIFunctions.java, there corresponding function is: >>> private static int GetObjectField(JNIEnvironment env, int objJREF, >>> int >>> fieldID) >>> >>> My question is where to do this transformation for "jobject" to >>> "int"? in >>> constructing JNI environment or somewhere else? >>> >>> Thanks. >>> >>> Du Li >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/A-question-about-JNI-functions-tp25815232p25815232.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 >>> Jikesrvm-researchers@... >>> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers >> >> >> ------------------------------------------------------------------------------ >> 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 >> Jikesrvm-researchers@... >> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers >> >> > > -- > View this message in context: http://www.nabble.com/A-question-about-JNI-functions-tp25815232p25823172.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 > Jikesrvm-researchers@... > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers ------------------------------------------------------------------------------ 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 Jikesrvm-researchers@... https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers |
| Free embeddable forum powered by Nabble | Forum Help |