Commit 3bd835f7 by Anthony Green Committed by Anthony Green

natObject.cc (_Jv_MonitorEnter): Only perform null check when we have to.

2000-04-08  Anthony Green  <green@redhat.com>

	* java/lang/natObject.cc (_Jv_MonitorEnter): Only perform null
	check when we have to.

	* gcj/array.h: Mark elements(JArray<T>& x) and elements(JArray<T>*
	x) as `inline'.

	* java/util/StringTokenizer.java: Minor optimization.  Eliminates
	one method call.

	* java/util/Vector.java (VectorEnumeration.nextElement): Manually
	inline hasMoreElements.

From-SVN: r33033
parent 6308dae9
2000-04-08 Anthony Green <green@cygnus.com>
* java/lang/natObject.cc (_Jv_MonitorEnter): Only perform null
check when we have to.
* gcj/array.h: Mark elements(JArray<T>& x) and elements(JArray<T>*
x) as `inline'.
* java/util/StringTokenizer.java: Minor optimization. Eliminates
one method call.
* java/util/Vector.java (VectorEnumeration.nextElement): Manually
inline hasMoreElements.
2000-04-05 Tom Tromey <tromey@cygnus.com> 2000-04-05 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt. * configure: Rebuilt.
......
...@@ -36,9 +36,9 @@ public: ...@@ -36,9 +36,9 @@ public:
}; };
template<class T> template<class T>
T* elements(JArray<T>& x) { return x.data; } inline T* elements(JArray<T>& x) { return x.data; }
template<class T> template<class T>
T* elements(JArray<T>* x) { return x->data; } inline T* elements(JArray<T>* x) { return x->data; }
}; // end extern "Java" }; // end extern "Java"
......
...@@ -18,6 +18,7 @@ details. */ ...@@ -18,6 +18,7 @@ details. */
#include <jvm.h> #include <jvm.h>
#include <java/lang/Object.h> #include <java/lang/Object.h>
#include <java-threads.h> #include <java-threads.h>
#include <java-signal.h>
#include <java/lang/CloneNotSupportedException.h> #include <java/lang/CloneNotSupportedException.h>
#include <java/lang/IllegalArgumentException.h> #include <java/lang/IllegalArgumentException.h>
#include <java/lang/IllegalMonitorStateException.h> #include <java/lang/IllegalMonitorStateException.h>
...@@ -224,8 +225,10 @@ _Jv_InitializeSyncMutex (void) ...@@ -224,8 +225,10 @@ _Jv_InitializeSyncMutex (void)
jint jint
_Jv_MonitorEnter (jobject obj) _Jv_MonitorEnter (jobject obj)
{ {
#ifndef HANDLE_SEGV
if (! obj) if (! obj)
JvThrow (new java::lang::NullPointerException); JvThrow (new java::lang::NullPointerException);
#endif
if (INIT_NEEDED (obj)) if (INIT_NEEDED (obj))
obj->sync_init (); obj->sync_init ();
_Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info; _Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info;
......
...@@ -180,6 +180,6 @@ public class StringTokenizer implements Enumeration ...@@ -180,6 +180,6 @@ public class StringTokenizer implements Enumeration
// more readable this way, so we'll take the hit on efficiency. // more readable this way, so we'll take the hit on efficiency.
private boolean isDelimiter(char ch) private boolean isDelimiter(char ch)
{ {
return delimiters.indexOf(ch) >= 0; return delimiters.indexOf(ch, 0) >= 0;
} }
} }
...@@ -38,7 +38,7 @@ class VectorEnumeration implements Enumeration ...@@ -38,7 +38,7 @@ class VectorEnumeration implements Enumeration
public Object nextElement() public Object nextElement()
{ {
if (!hasMoreElements()) if (! (enumIndex < enumVec.size()))
throw new NoSuchElementException(); throw new NoSuchElementException();
return enumVec.elementData[enumIndex++]; return enumVec.elementData[enumIndex++];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment