• R/O
  • R/W (SSH)
  • R/W (HTTPS)

mysaifujvm: Commit Details


Commit MetaInfo

Revision347 (tree)
Time2011-02-28 01:54:30
Authorfreebeans

Log Message

2011/02/25 freebeans
*instruction.cpp:(invoke_method)

removed unused parameter ref.

Change Summary

Diff

--- jvm/trunk/jvm/common_funcs.cpp (revision 346)
+++ jvm/trunk/jvm/common_funcs.cpp (revision 347)
@@ -191,10 +191,12 @@
191191 {
192192 permanent_heap_block *block =
193193 (permanent_heap_block *) calloc (1, this->getBlockSize ());
194- block->next = NULL;
195- block->limit = ((char *) block) + getBlockSize () - 1;
196- block->current = (char *) (block + 1);
197-
194+ if (block)
195+ {
196+ block->next = NULL;
197+ block->limit = ((char *) block) + getBlockSize () - 1;
198+ block->current = (char *) (block + 1);
199+ }
198200 return block;
199201 }
200202
--- jvm/trunk/jvm/frame.cpp (revision 346)
+++ jvm/trunk/jvm/frame.cpp (revision 347)
@@ -267,7 +267,7 @@
267267 | Local variables area |
268268 | |
269269 +-----------------------+
270- | struct frame |
270+ | struct frame |
271271 +-----------------------+
272272 | Operand stack area |
273273 +-----------------------+
@@ -276,7 +276,7 @@
276276 +-----------------------+
277277 | New frame |
278278 +-----------------------+
279- | Operand stack area |
279+ | Operand stack area |
280280 +-----------------------+
281281   ↓呼び出し先
282282 */
@@ -298,7 +298,7 @@
298298 {
299299 // ネイティブメソッドの場合
300300 max_locals = parameter_count; // ローカル変数はパラメータ数分使用可能とする
301- max_stack = 2; // スタックは戻り値用に2つ使用可能とする
301+ max_stack = 2; // スタックは戻り値用に2つ使用可能とする
302302 }
303303 else
304304 {
--- jvm/trunk/jvm/java_thread.cpp (revision 346)
+++ jvm/trunk/jvm/java_thread.cpp (revision 347)
@@ -757,55 +757,55 @@
757757 */
758758 const _TCHAR* get_thread_state_from_jvmti_bits(int jvmti_thread_state_bits)
759759 {
760- const static _TCHAR new_str[] = _T("NEW");
761- const static _TCHAR runnable_str[] = _T("RUNNABLE");
762- const static _TCHAR terminated_str[] = _T("TERMINATED");
763- const static _TCHAR blocked_str[] = _T("BLOCKED");
764- const static _TCHAR waiting_str[] = _T("WAITING");
765- const static _TCHAR timed_waiting_str[] = _T("TIMED_WAITING");
760+ const static _TCHAR new_str[] = _T("NEW");
761+ const static _TCHAR runnable_str[] = _T("RUNNABLE");
762+ const static _TCHAR terminated_str[] = _T("TERMINATED");
763+ const static _TCHAR blocked_str[] = _T("BLOCKED");
764+ const static _TCHAR waiting_str[] = _T("WAITING");
765+ const static _TCHAR timed_waiting_str[] = _T("TIMED_WAITING");
766766
767767 jvmti_thread_state_bits &= JVMTI_JAVA_LANG_THREAD_STATE_MASK;
768768
769- const _TCHAR* stat = NULL;
770-
771- // Convert JVMTI_THREAD_STATE_XXX flags to Thread.State
772- if (JVMTI_JAVA_LANG_THREAD_STATE_NEW == jvmti_thread_state_bits)
773- {
774- stat = new_str;
775- }
776- else if (JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED == jvmti_thread_state_bits)
777- {
778- stat = terminated_str;
779- }
780- else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_ALIVE)
781- {
782- if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_RUNNABLE)
783- {
784- stat = runnable_str;
785- }
786- else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER)
787- {
788- stat = blocked_str;
789- }
790- else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_WAITING)
791- {
792- if (JVMTI_THREAD_STATE_WAITING_INDEFINITELY & jvmti_thread_state_bits)
793- {
794- stat = waiting_str;
795- }
796- else if (JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT & jvmti_thread_state_bits)
797- {
798- stat = timed_waiting_str;
799- }
800- else
801- {
802- assert(false);
803- }
804- }
805- }
806-
807- assert(stat);
808- return stat;
769+ const _TCHAR* stat = NULL;
770+
771+ // Convert JVMTI_THREAD_STATE_XXX flags to Thread.State
772+ if (JVMTI_JAVA_LANG_THREAD_STATE_NEW == jvmti_thread_state_bits)
773+ {
774+ stat = new_str;
775+ }
776+ else if (JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED == jvmti_thread_state_bits)
777+ {
778+ stat = terminated_str;
779+ }
780+ else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_ALIVE)
781+ {
782+ if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_RUNNABLE)
783+ {
784+ stat = runnable_str;
785+ }
786+ else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER)
787+ {
788+ stat = blocked_str;
789+ }
790+ else if (jvmti_thread_state_bits & JVMTI_THREAD_STATE_WAITING)
791+ {
792+ if (JVMTI_THREAD_STATE_WAITING_INDEFINITELY & jvmti_thread_state_bits)
793+ {
794+ stat = waiting_str;
795+ }
796+ else if (JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT & jvmti_thread_state_bits)
797+ {
798+ stat = timed_waiting_str;
799+ }
800+ else
801+ {
802+ assert(false);
803+ }
804+ }
805+ }
806+
807+ assert(stat);
808+ return stat;
809809 }
810810
811811 /**
--- jvm/trunk/jvm/jni_funcs.cpp (revision 346)
+++ jvm/trunk/jvm/jni_funcs.cpp (revision 347)
@@ -433,6 +433,9 @@
433433 {"java/lang/VMMainThread", "showConsole", "()V",
434434 Java_java_lang_VMMainThread_showConsole},
435435
436+ {"java/lang/VMMainThread", "showSplashScreen", "(Ljava/lang/String;)V",
437+ Java_java_lang_VMMainThread_showSplashScreen},
438+
436439 {"java/lang/VMObject", "getClass", "(Ljava/lang/Object;)Ljava/lang/Class;",
437440 Java_java_lang_VMObject_getClass},
438441 {"java/lang/VMObject", "clone", "(Ljava/lang/Cloneable;)Ljava/lang/Object;",
@@ -2214,61 +2217,61 @@
22142217 * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
22152218 */
22162219 JNIEXPORT jboolean JNICALL Java_java_security_AccessControlContext_allowedByUserNative
2217- (JNIEnv *env, jobject, jstring permissionString, jstring exceptionString)
2218-{
2219-#ifdef DEBUG
2220- jsize permStringLen = env->GetStringLength(permissionString);
2221- jsize expStringLen = env->GetStringLength(exceptionString);
2222- _TCHAR* permChars = (_TCHAR*) malloc(sizeof(_TCHAR) * (permStringLen + 1));
2223- _TCHAR* expChars = (_TCHAR*) malloc(sizeof(_TCHAR) * (expStringLen + 1));
2224-
2225- assert(permChars && expChars);
2226-
2227- const jchar* permTemp = env->GetStringChars(permissionString, NULL);
2228- const jchar* expTemp = env->GetStringChars(exceptionString, NULL);
2229-
2230- _tcsncpy(permChars, (const wchar_t*) permTemp, permStringLen);
2231- permChars[permStringLen] = _T('\0');
2232-
2233- _tcsncpy(expChars, (const wchar_t*) expTemp, expStringLen);
2234- expChars[expStringLen] = _T('\0');
2235-
2236- env->ReleaseStringChars(permissionString, permTemp);
2237- env->ReleaseStringChars(exceptionString, expTemp);
2238-
2239- OutputDebugString(permChars);
2240- OutputDebugString(expChars);
2241-
2242- if (ACCESS_CONTROL_LOG_FILE[0] == _T('\0'))
2243- {
2244- // ToDo: output to log file.
2245- }
2246- _TCHAR* param[2] = { permChars, expChars };
2247-
2248- int result =
2249- DialogBoxParam(GetModuleHandle(NULL),
2250- MAKEINTRESOURCE(IDD_ACCESSCONTROL),
2251- get_JVM_controller_window(),
2252- (DLGPROC) AccessControlDialogProc,
2253- (LPARAM) param);
2254- free(permChars);
2255- free(expChars);
2256-
2257- switch (result)
2258- {
2259- case IDYES:
2260- return true; // allow access
2261- case IDNO:
2262- return false; // disallow access
2263- default:
2264- return false;
2265- }
2266-#else
2267- return false; // throw exception.
2268-#endif
2269-}
2220+ (JNIEnv *env, jobject, jstring permissionString, jstring exceptionString)
2221+{
2222+#ifdef DEBUG
2223+ jsize permStringLen = env->GetStringLength(permissionString);
2224+ jsize expStringLen = env->GetStringLength(exceptionString);
2225+ _TCHAR* permChars = (_TCHAR*) malloc(sizeof(_TCHAR) * (permStringLen + 1));
2226+ _TCHAR* expChars = (_TCHAR*) malloc(sizeof(_TCHAR) * (expStringLen + 1));
2227+
2228+ assert(permChars && expChars);
2229+
2230+ const jchar* permTemp = env->GetStringChars(permissionString, NULL);
2231+ const jchar* expTemp = env->GetStringChars(exceptionString, NULL);
22702232
2233+ _tcsncpy(permChars, (const wchar_t*) permTemp, permStringLen);
2234+ permChars[permStringLen] = _T('\0');
22712235
2236+ _tcsncpy(expChars, (const wchar_t*) expTemp, expStringLen);
2237+ expChars[expStringLen] = _T('\0');
2238+
2239+ env->ReleaseStringChars(permissionString, permTemp);
2240+ env->ReleaseStringChars(exceptionString, expTemp);
2241+
2242+ OutputDebugString(permChars);
2243+ OutputDebugString(expChars);
2244+
2245+ if (ACCESS_CONTROL_LOG_FILE[0] == _T('\0'))
2246+ {
2247+ // ToDo: output to log file.
2248+ }
2249+ _TCHAR* param[2] = { permChars, expChars };
2250+
2251+ int result =
2252+ DialogBoxParam(GetModuleHandle(NULL),
2253+ MAKEINTRESOURCE(IDD_ACCESSCONTROL),
2254+ get_JVM_controller_window(),
2255+ (DLGPROC) AccessControlDialogProc,
2256+ (LPARAM) param);
2257+ free(permChars);
2258+ free(expChars);
2259+
2260+ switch (result)
2261+ {
2262+ case IDYES:
2263+ return true; // allow access
2264+ case IDNO:
2265+ return false; // disallow access
2266+ default:
2267+ return false;
2268+ }
2269+#else
2270+ return false; // throw exception.
2271+#endif
2272+}
2273+
2274+
22722275 /**
22732276 * get java stack data.
22742277 *
@@ -4299,6 +4302,36 @@
42994302 }
43004303
43014304 /*
4305+ * Class: java_lang_VMMainThread
4306+ * Method: showSplashScreen
4307+ * Signature: (Ljava/io/InputStream;)V
4308+ */
4309+JNIEXPORT void JNICALL Java_java_lang_VMMainThread_showSplashScreen
4310+ (JNIEnv *env, jclass, jobject ins)
4311+{
4312+ typedef void (*MYSAIFU_SHOWSPLASHSCREEN) (JNIEnv* env, jobject ins);
4313+ MYSAIFU_SHOWSPLASHSCREEN showSplash;
4314+
4315+ // Load "wcepeer" to show image file
4316+ HINSTANCE hDLL = ::LoadLibrary(_T("wcepeer"));
4317+ if (! hDLL)
4318+ {
4319+ // Cannot load.
4320+ return;
4321+ }
4322+
4323+ showSplash = (MYSAIFU_SHOWSPLASHSCREEN) ::GetProcAddress(hDLL, _T("Mysaifu_showSplashScreen"));
4324+ if (! showSplash)
4325+ {
4326+ // Not found.
4327+ return;
4328+ }
4329+
4330+ // Show splash screen
4331+ showSplash(env, ins);
4332+}
4333+
4334+/*
43024335 * Class: java_lang_VMObject
43034336 * Method: getClass
43044337 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
@@ -4632,31 +4665,31 @@
46324665 * Signature: ()Ljava/lang/String;
46334666 */
46344667 JNIEXPORT jstring JNICALL Java_java_lang_VMThread_getState
4635- (JNIEnv *env, jobject self)
4636-{
4637- jclass clazz = env->GetObjectClass(self);
4638- assert(clazz);
4639- jfieldID fid = env->GetFieldID(clazz, "nativePointer", "I");
4640- assert(fid);
4641- jint pointer = env->GetIntField(self, fid);
4642-
4643- const _TCHAR* stat;
4644- if (! pointer)
4645- {
4646- // Still in Thread.start()
4647- stat = _T("RUNNABLE");
4648- }
4649- else
4650- {
4651- frame_body* fb = (frame_body*) pointer;
4652- const int state_flags = get_thread_state_bits(fb);
4653-
4654- // Convert JVMTI_THREAD_STATE_XXX flags to Thread.State
4655- stat = get_thread_state_from_jvmti_bits(state_flags);
4656- }
4657- return env->NewString((const jchar*) stat, _tcslen(stat));
4658-}
4668+ (JNIEnv *env, jobject self)
4669+{
4670+ jclass clazz = env->GetObjectClass(self);
4671+ assert(clazz);
4672+ jfieldID fid = env->GetFieldID(clazz, "nativePointer", "I");
4673+ assert(fid);
4674+ jint pointer = env->GetIntField(self, fid);
4675+
4676+ const _TCHAR* stat;
4677+ if (! pointer)
4678+ {
4679+ // Still in Thread.start()
4680+ stat = _T("RUNNABLE");
4681+ }
4682+ else
4683+ {
4684+ frame_body* fb = (frame_body*) pointer;
4685+ const int state_flags = get_thread_state_bits(fb);
46594686
4687+ // Convert JVMTI_THREAD_STATE_XXX flags to Thread.State
4688+ stat = get_thread_state_from_jvmti_bits(state_flags);
4689+ }
4690+ return env->NewString((const jchar*) stat, _tcslen(stat));
4691+}
4692+
46604693 /*
46614694 * Class: java_lang_VMString
46624695 * Method: intern
--- jvm/trunk/jvm/instruction.cpp (revision 346)
+++ jvm/trunk/jvm/instruction.cpp (revision 347)
@@ -609,11 +609,14 @@
609609 }
610610
611611 // メソッド実行用マクロ
612+ // Javaメソッドの場合は、invoke_method()を経由せず、enter_method()のみを呼び出すことで
613+ // 高速化を図る
612614 #define INVOKE_METHOD(oref, target_class, target_method) \
613615 { \
614616 if (is_native(target_method->access_flags)) { \
615617 STORE_CONTEXT(); \
616- invoke_method(current_frame, oref, target_class, target_method); \
618+ /* invoke_method(current_frame, oref, target_class, target_method); */ \
619+ invoke_native_method(current_frame, target_class, target_method); \
617620 CHECK_EXCEPTION; \
618621 } else { \
619622 /* Javaメソッド */ \
@@ -852,15 +855,15 @@
852855 * 指定されたメソッドを実行する
853856 *
854857 * @param caller_frame 呼び出し側のフレーム。
855- * @param ref オブジェクトの参照。
856- * インスタンスメソッドの場合はインスタンスの参照を指定する。
857- * (スタティックメソッドの場合は無視される)
858- * @param declaring_class_file 該当メソッドを定義しているClassFile構造体
858+ * @param unused 未使用(かつてはオブジェクトの参照を渡していた)
859+ * インスタンスメソッドの場合はインスタンスの参照を指定する。
860+ * (スタティックメソッドの場合は無視される))
861+ * @param declaring_class_file 該当メソッドを定義しているClassFile構造体
859862 * @param minfo 呼び出し対象メソッド
860863 */
861864 void
862865 invoke_method (frame * caller_frame,
863- jobject ref, ClassFile * declaring_file, method_info * minfo)
866+ jobject unused, ClassFile * declaring_file, method_info * minfo)
864867 {
865868 assert (declaring_file == minfo->declaring_ClassFile);
866869
旧リポジトリブラウザで表示