Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

objectutil.c File Reference


Detailed Description

Utility and glue functions for class.c and java.lang.Object.

Various functions in this file tend to get moved around between threadutil.c and classutil.c.

For internal use only.

Due to the fact that the implementation of the Java object and the supporting robject structure is deeply embedded in the core of the development of this software, this file has contents that come and go during development. Some functions get staged here before deciding where they really go; some are interim functions for debugging, some were glue that eventually went away. Be careful to remove prototypes to such functions from the appropriate header file.

Control

$URL: https://svn.apache.org/path/name/objectutil.c $ $Id: objectutil.c 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file objectutil.c.

#include "arch.h"
#include "jvmcfg.h"
#include "classfile.h"
#include "jvm.h"
#include "jvmclass.h"
#include "linkage.h"

Go to the source code of this file.

Functions

static void objectutil_c_dummy (void)
rboolean objectutil_release (jvm_object_hash objhashthis, jvm_thread_index thridx)
 Attempt to wait() on an object's monitor lock by releasing it and requesting RELEASE state.
rboolean objectutil_synchronize (jvm_object_hash objhashthis, jvm_thread_index thridx)
 Attempt to synchronize() on an object's monitor lock by contending for it.
rvoid objectutil_unsynchronize (jvm_object_hash objhashthis, jvm_thread_index thridx)
 Release synchronize from an object monitor lock.

Variables

static char * objectutil_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/objectutil.c $ $Id: objectutil.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable."


Function Documentation

static void objectutil_c_dummy void   )  [static]
 

Definition at line 56 of file objectutil.c.

rboolean objectutil_synchronize jvm_object_hash  objhashthis,
jvm_thread_index  thridx
 

Attempt to synchronize() on an object's monitor lock by contending for it.

If acquired, stay in the RUNNING state. If not, go to the SYNCHRONIZED state and arbitrate for it in the LOCK state.

Parameters:
objhashthis Object table hash of this object.
thridx Thread table index of a thread requesting ownership of this object's monitor lock.
Returns:
rtrue if this thread now owns this object's monitor lock, otherwise rfalse.
Todo:
Make sure IllegalMonitorStateException logic covers all possibilities or needs to be removed.
Todo:
Make sure thread interruption logic below here is working.
Exceptions:
JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION if the object hash is the null object, typically due to bad input parameter.
JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION if current thread cannot possibly own the object's monitor lock, typically due to bad input parameter.
< This slot contains an object

< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< Object monitor locked by mlock_thridx

< Object monitor locked by mlock_thridx

< Access structures of the thread now running in the JVM.

< Object monitor locked by mlock_thridx

< Access structures of the thread now running in the JVM.

< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 102 of file objectutil.c.

References CURRENT_THREAD, jvm_object_hash_null, JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION, JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION, OBJECT, OBJECT_STATUS_INUSE, OBJECT_STATUS_MLOCK, OBJECT_STATUS_NULL, rfalse, rtrue, THREAD, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), and threadstate_request_synchronized().

Referenced by opcode_run().

rvoid objectutil_unsynchronize jvm_object_hash  objhashthis,
jvm_thread_index  thridx
 

Release synchronize from an object monitor lock.

Parameters:
objhashthis Object table hash of this object.
thridx Thread table index of a thread requesting to remove this object's monitor lock.
Attention:
Notice that the locktarget is NOT cleared here! This is so that the value may be retained until the thread successfully arbitrates for ownership again in threadstate_process_lock(). Once the MLOCK is reacquired there, the locktarget will have been cleared by objectutil_synchronize(). The purpose of objectutil_release() is to provide an avenue in the RUNNING state to release an MLOCK and set up locktarget for the WAIT, NOTIFY, LOCK, ACQUIRE process.
Returns:
rvoid
Todo:
Make sure thread interruption logic below here is working.
Exceptions:
JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION if current thread does not own the object's monitor lock.
< This slot contains an object

< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

Todo:
Should the not INUSE condition cause INTERNALERROR?
< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

< Object monitor locked by mlock_thridx

< Object monitor locked by mlock_thridx

< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 240 of file objectutil.c.

Referenced by opcode_run().

rboolean objectutil_release jvm_object_hash  objhashthis,
jvm_thread_index  thridx
 

Attempt to wait() on an object's monitor lock by releasing it and requesting RELEASE state.

Save the MLOCK to be released for subsequent processing by threadstate_request_release().

Parameters:
objhashthis Object table hash of this object.
thridx Thread table index of a thread requesting to release this object's monitor lock.
Returns:
the result of threadstate_request_release()

Definition at line 326 of file objectutil.c.

Referenced by jlObject_wait4ever().


Variable Documentation

char* objectutil_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/objectutil.c $ $Id: objectutil.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." [static]
 

Definition at line 56 of file objectutil.c.


Generated on Fri Sep 30 18:50:14 2005 by  doxygen 1.4.4