* prims.cc (_Jv_Abort): Always print error message using fprintf,
don't try to allocate.
(_Jv_CreateJavaVM): Set gcj::runTimeInitialized.
* include/jvm.h (gcj::runTimeInitialized): New variable declaration.
* java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle
duplicate class registration with JvFail if the runtime hasn't been
initialized yet.
From-SVN: r46424
* prims.cc (_Jv_NewMultiArrayUnchecked): New method.
(_Jv_NewMultiArray): Use it. Check each array dimension.
(_Jv_NewMultiArray): Likewise.
* java/lang/reflect/natMethod.cc (can_widen): Nothing promotes to
`char'.
* java/lang/reflect/natArray.cc (newInstance): Throw
IllegalArgumentException if there are no dimensions.
From-SVN: r45951
* java/lang/ClassLoader.java (system): Remove static field.
(getSystemClassLoader): Get gnu.gcj.runtime.VMClassLoader.instance
directly instead of using it to set the system field.
(loadClass): Use VMClassLoader.instance instead of system field.
(findSystemClass): Similar.
* prims.cc (_Jv_RunMain): Clear VMClassLoader::instance rather
than ClassLoader::system which no longer exists.
* java/lang/natClassLoader.java (_Jv_FindClass): Simplify.
From-SVN: r45343
* Makefile.am: New friends for java/lang/Thread.h.
* prims.cc (runFirst): Removed.
(JvRunMain): Merged into _Jv_RunMain. Now just calls that.
(_Jv_RunMain): Now takes either a klass or class name parameter.
Create a gnu.gcj.runtime.FirstThread and attach the native thread
to that, then run it using _Jv_ThreadRun. Remove special handling of
jar files, instead pass is_jar parameter through to FirstThread.
* gcj/javaprims.h: Add prototypes for _Jv_ThreadRun and new variant
of _Jv_AttachCurrentThread.
* gnu/gcj/runtime/FirstThread.java (FirstThread): Now extends Thread.
(run): New method. Take care of looking up main class manifest
attribute and calling forName if neccessary. Then call call_main.
(call_main): New native method.
* gnu/gcj/runtime/natFirstThread.cc (call_main): New function, code
relocated from prims.cc. Look up and call main method.
* java/lang/Thread.java (run_): Removed.
* java/lang/natThread.cc (run_): Renamed to...
(_Jv_ThreadRun): this. JVMPI notification code moved to ...
(_Jv_NotifyThreadStart): here. New function.
(countStackFrames, destroy, resume, suspend, stop): Throw
UnsupportedOperationExceptions rather than JvFail'ing.
(_Jv_AttachCurrentThread): New variant takes a Thread argument.
Existing version wraps new variant.
From-SVN: r45182
* java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return
NULL if no library on the list has the symbol.
(init): Call add_library on the program itself.
* prims.cc (JvRunMain): Initialize Runtime before searching for
`main'.
(_Jv_RunMain): Likewise.
From-SVN: r43413
* prims.cc (_Jv_ThisExecutable): Use _Jv_Malloc.
* posix-threads.cc (_Jv_ThreadInitData): Use _Jv_Malloc.
(_Jv_ThreadDestroyData): Use _Jv_Free.
From-SVN: r41650
2000-03-23 Jeff Sturm <jsturm@one-point.com>
* prims.cc (_Jv_FindClassFromSignature): Check return of
recursive call. Do not abort on invalid signature; return NULL
instead.
From-SVN: r40787
2001-03-12 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/Runtime.java (_exit): Declare new package-private native.
* java/lang/natRuntime.cc (_exit): Implemented. Same as exit() but
without a security manager check.
(exit): Call _exit after security check.
* prims.cc (JvRunMain): Call Runtime._exit to shutdown the runtime
"naturally".
* java/lang/System.java (setSecurityManager): If a security manager
is already in place, call checkPermission.
* java/lang/ThreadGroup.java (uncaughtException): If printStackTrace()
throws an exception, try to deal with it gracefully.
* java/lang/ExceptionInInitializerError.java (printStackTrace):
Only try to print the subordinate stack trace if "exception" is set.
Print our class name first.
From-SVN: r40401
2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
All files with updated copyright.
* prims.cc (class _Jv_PrimClass): Removed.
(init_prim_class): New function.
(DECLARE_PRIM_TYPE): Rewritten. `java::lang::Class' replaces
`_Jv_PrimClass' in primitive type declarations. Assign to the
value returned by `init_prim_class.'
* gcj/array.h: `java::lang::Class' replaces `_Jv_PrimClass' in
primitive type declarations.
(JvPrimClass): Cast to `jclass' removed.
* java/lang/Class.h (Class): New constructor.
(Class): New copy constructor.
(initializePrim): New prototype.
(_Jv_PrimClass): Field removed.
* java/lang/Object.h (struct _JvObjectPrefix): New virtuals
nacd_1 and nacd_2 (for compatibility with the new C++ ABI.)
(class java::lang::Object): `finalize' moved up front.
* java/lang/natClass.cc
(isAssignableFrom): Turned outline.
(isInstance): Likewise.
(isInterface): Likewise, fixed indentation.
(initializePrim): New function.
(New C++ ABI compatibility patch:
http://sources.redhat.com/ml/java-patches/2001-q1/msg00065.html)
From-SVN: r39032
* class.c (make_class_data): Push initial value for "arrayclass".
* decl.c (init_decl_processing): Add new class field "arrayclass".
In libjava:
* java/lang/Class.h (_Jv_InitClass): Use __builtin_expect.
(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass.
(_Jv_GetArrayClass): New inline function.
(arrayclass): New field.
* prims.cc (_Jv_NewObjectArray): Use _Jv_GetArrayClass. Don't use
_Jv_GetArrayElementFromElementType.
(_Jv_NewPrimArray): Ditto.
(_Jv_PrimClass constructor): Initialize "depth", "ancestors", and
"idt" for completeness. Initialze "arrayclass" using _Jv_NewArrayClass.
Set Modifier::ABSTRACT.
* java/lang/natClassLoader.cc (_Jv_NewClass): Initialize "arrayclass".
(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass. Now void.
Now synchronized. Array classes are now referenced from
elementClass->arrayclass. Don't use _Jv_FindClassInCache.
Set array classes' accessibility flags correctly. Optimize so that
all array classes share the same IDT.
* java/lang/reflect/natArray.cc (newInstance): Use _Jv_GetArrayClass.
* java/lang/reflect/natMethod.cc (_Jv_GetTypesFromSignature): Ditto.
* java/lang/natClass.cc (_getFields): Increment offset. Prevent fields
in superclasses from overwriting classes own fields.
(_Jv_IsAssignableFrom): Check for NULL source idt instead of calling
Modifier::isAbstract().
(null_idt): New static field.
(_Jv_PrepareConstantTimeTables): Optimize case where class implements
no interfaces.
(_Jv_IndexOf): Made inline.
* boehm.cc (_Jv_MarkObj): Mark "arrayclass" field.
From-SVN: r38808
* java/lang/Throwable.java (trace_enabled): New static field.
* java/lang/natThrowable.cc (fillInStackTrace): Do nothing if
trace_enabled not set.
* prims.cc (main_init): Turn off trace_enabled while creating
default exception objects.
From-SVN: r38442
* prims.cc (_Jv_NewObjectArray): Use const_cast to initialize
length field of array.
(_Jv_NewPrimArray): Likewise.
* gcj/array.h (__JArray): `length' field now const. Added
constructor.
From-SVN: r37771
2000-11-25 Anthony Green <green@redhat.com>
* prims.cc (_Jv_NewObjectArray): Undo placement change.
(_Jv_NewPrimArray): Likewise.
* gcj/array.h (__JArray): Undo const change. Removed constructor.
(class JArray): Removed constructor.
* java/lang/Thread.java (context_class_loader): New private data.
(getContextClassLoader): New method.
(setContextClassLoader): New method.
(Thread): Initialize context_class_loader.
* java/net/URLClassLoader.java: Import java.util.Enumeration.
(getResource): Rename to findResource.
(findResource): New method. Used to be getResource.
(getResourceAsStream): Deleted.
(jarFileize): Extracted logic from URLClassLoader constructor into
this new private method.
(addURL): New protected method.
(URLClassLoader): Call jarFileize. Use addElement instead of
insertElementAt.
(findResources): New method.
* java/lang/ClassLoader.java: Import java.util.Enumeration.
(getResource): Implement correct logic.
(findResource): New method.
(getResources): New method.
(findClass): Create a ClassNotFoundException with the name of the
class rather than nothing at all.
(defineClass) Only throw ClassFormatError.
* java/lang/Class.java (forName): New method.
* java/lang/Class.h (forName): New method.
* java/lang/natClass.cc (forName): New method.
From-SVN: r37751
* prims.cc (_Jv_NewObjectArray): Use palcement new to create
array.
(_Jv_NewPrimArray): Likewise.
Include <new>.
* gcj/array.h (__JArray): `length' field now const. Added
constructor.
(class JArray): Added constructor.
From-SVN: r37718
2000-09-30 Hans Boehm <boehm@acm.org>
Bryce McKinlay <bryce@albatross.co.nz>
Implement bitmap descriptor based marking for Boehm GC.
* configure.in: Define JC1GCSPEC. Set it if boehm-gc is used.
* configure: Rebuilt.
* libgcj.spec.in: Pass JC1GCSPEC to jc1.
* include/jvm.h (struct _Jv_VTable): New field `gc_descr'. New inline
method get_finalizer().
(struct _Jv_ArrayVTable): Ditto. Declare method array with
NUM_OBJECT_METHODS elements instead of NUM_OBJECT_METHODS + 1.
(_Jv_AllocObj): Add new jclass parameter.
(_Jv_AllocArray): Ditto.
(_Jv_BuildGCDescr): New prototype.
* prims.cc (_Jv_AllocObject): Rename parameter `c' to `klass'. Pass
`klass' to _Jv_AllocObj. Don't set the new object's vtable. Use
get_finalizer() instead of direct finalizer vtable offset.
(_Jv_NewObjectArray): Rename parameter `clas' to `klass'. Pass
`klass' to _Jv_AllocArray. Don't set the new array's vtable.
(_Jv_NewPrimArray): Call _Jv_FindArrayClass before _Jv_AllocObj.
Pass `klass' to _Jv_AllocObj. Don't set the new array's vtable.
* resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): New #defines.
(_Jv_ResolvePoolEntry): Use METHOD_NOT_THERE and METHOD_INACCESSIBLE.
(_Jv_DetermineVTableIndex): Ditto.
(_Jv_PrepareClass): Ditto. Remove offset-by-one adjustments from vtable
calculations to account for new gc_descr field.
* boehm.cc: #include gc_gcj.h.
(obj_kind_x, obj_free_list): `#if 0'-ed away.
(_Jv_MarkObj): Check that vtable doesn't point to a cleared object.
New commentary from HB. Mark the classes vtable.
(_Jv_MarkArray): Check that vtable doesn't point to a cleared object.
(GC_DEFAULT_DESCR): New #define.
(_Jv_BuildGCDescr): New function. Use GC_DEFAULT_DESCR, for now.
(_Jv_AllocObj): New parameter `klass'. Use GC_GCJ_MALLOC ().
(_Jv_AllocArray): New parameter `klass'. Allocate with GC_MALLOC and
scan conservativly if size is less than min_heap_addr. Set vtable
pointer of new object before returning.
(_Jv_AllocBytes): Use GC_MALLOC_ATOMIC, not GC_GENERIC_MALLOC.
(_Jv_InitGC): Call GC_init_gcj_malloc(). Don't set up marking and
allocation for obj_kind_x.
* nogc.cc (_Jv_BuildGCDescr): New function. Return 0.
(_Jv_AllocObj): Set vtable on returned object.
(_Jv_AllocArray): Ditto.
* java/lang/Class.h (_Jv_NewObjectArray): No longer a friend.
(_Jv_NewPrimArray): Ditto.
(_Jv_AllocObj): Declare as a friend.
(_Jv_AllocArray): Ditto.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Copy gc_descr
from &ObjectClass into new array class. Remove offset-by-one
adjustments from `method' size calculations to account for gc_descr
field.
Co-Authored-By: Bryce McKinlay <bryce@albatross.co.nz>
From-SVN: r36679
2000-09-13 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/String.java (CASE_INSENSITIVE_ORDER): New static field.
Initialize with anonymous class.
(compareToIgnoreCase): New method.
* java/lang/ThreadGroup.java (had_uncaught_exception): New field.
(uncaughtException): Set had_uncaught_exception.
* prims.cc (JvRunMain): Check value of had_uncaught_exception and
exit with error status if set.
(_Jv_RunMain): Ditto.
From-SVN: r36385
2000-08-26 Anthony Green <green@redhat.com>
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/ClassLoader.h): Make _Jv_RunMain a
friend.
* prims.cc: Include ClassLoader.h.
(_Jv_RunMain): When executing jar files, classpath must be the jar
file only. Lose our reference to the system ClassLoader in order
to get a new one with the correct classpath.
* java/lang/natSystem.cc (init_properties): When executing a jar
file, only use the jar file for java.class.path.
* gnu/gcj/runtime/VMClassLoader.java: Use the canonical file name
for bytecode archives.
* gnu/gcj/runtime/FirstThread.java: Handle case where manifest
exists, but not Main-Class.
From-SVN: r35999
Fix for PR java.lang/258:
* prims.cc (_Jv_PrimClass): Set state of primitive class to
JV_STATE_DONE, to prevent accidental initialization.
* java/lang/natClass.cc (_Jv_IsAssignableFrom): Call
_Jv_InterfaceAssignableFrom if target is an interface and source is
an interface or an abstract class. Remove redundant initializeClass
calls. Remove duplicate if_idt test.
* java/lang/Class.h (_Jv_InterfaceAssignableFrom): New function.
From-SVN: r34562
* All files: Updated copyright information.
* COPYING: New file.
* COPYING.LIB: Removed.
* LIBGCJ_LICENSE: We now use GPL + special exception.
From-SVN: r32387
2000-03-07 Bryce McKinlay <bryce@albatross.co.nz>
* resolve.cc (_Jv_SearchMethodInClass): New function.
(_Jv_ResolvePoolEntry): Search superinterfaces for interface
methods.
* java/lang/Class.h (_Jv_SearchMethodInClass): New prototype.
2000-03-07 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/Class.h (union _Jv_IDispatchTable): New declaration.
(struct _Jv_ifaces): New declaration.
JV_CLASS: New macro definition.
(getComponentType): Relocate below isArray() for inlining.
(getModifiers): Declare `inline'.
(getSuperclass): Ditto.
(isArray): Ditto.
(isPrimitive): Ditto.
(_Jv_IsAssignableFrom): New prototype.
(_Jv_LookupInterfaceMethodIdx): New prototype. Predeclare with "C"
linkage.
(_Jv_InitClass): Move from natClass.cc. Declare `inline'.
Check for JV_STATE_DONE before invoking initializeClass().
(_Jv_PrepareConstantTimeTables): New prototype.
(_Jv_GetInterfaces): Ditto.
(_Jv_GenerateITable): Ditto.
(_Jv_GetMethodString): Ditto.
(_Jv_AppendPartialITable): Ditto.
(_Jv_FindIIndex): Ditto.
depth, ancestors, idt: New class fields.
* java/lang/natClass.cc (isAssignableFrom): Move functionality to
inline function `_Jv_IsAssignableFrom'. Use that function.
(isInstance): Declare `inline'.
(initializeClass): Get lock on class before checking `state'. Unlock
before calling resolveClass0. Call _Jv_PrepareConstantTimeTables
with the lock held.
(_Jv_LookupInterfaceMethod): Use _Jv_GetMessageString.
(_Jv_IsAssignableFrom): New inline function. Test assignability
using class->depth and ancestor table.
(_Jv_IsInstanceOf): Use _Jv_IsAssignableFrom.
(_Jv_CheckCast): Move from prims.cc. Use JV_CLASS and
_Jv_IsAssignableFrom.
(_Jv_CheckArrayStore): Ditto.
(_Jv_LookupInterfaceMethodIdx): New function.
INITIAL_IOFFSETS_LEN, INITIAL_IFACES_LEN: New #defines.
(_Jv_PrepareConstantTimeTables): New function.
(_Jv_IndexOf): Ditto.
(_Jv_GetInterfaces): Ditto.
(_Jv_GenerateITable): Ditto.
(_Jv_GetMethodString): Ditto.
(_Jv_AppendPartialITable): Ditto.
iindex_mutex, iindex_mutex_initialized: New static fields.
(_Jv_FindIIndex): New function.
* java/lang/natClassLoader.cc (_Jv_NewClass): Set new jclass fields.
* prims.cc (_Jv_CheckCast): Moved to natClass.cc.
(_Jv_CheckArrayStore): Ditto.
(JvNewCharArray, JvNewBooleanArray, JvNewByteArray, JvNewShortArray,
JvNewIntArray, JvNewLongArray, JvNewFloatArray, JvNewDoubleArray):
Moved to gcj/array.h.
(_Jv_Realloc): New function.
* gcj/cni.h: Move _Jv_PrimClass definitions to gcj/array.h.
* gcj/array.h: _Jv_PrimClass definitions moved from gcj/cni.h.
(JvNewCharArray, JvNewBooleanArray, JvNewByteArray,
JvNewShortArray, JvNewIntArray, JvNewLongArray, JvNewFloatArray,
JvNewDoubleArray): Implementations moved from prims.cc and
declared `inline'.
* gcj/javaprims.h (_Jv_Realloc): Prototype.
* include/jvm.h (_Jv_LookupInterfaceMethodIdx): Prototype.
From-SVN: r32382
* prims.cc (_Jv_MallocUnchecked): New function.
(main_init): Call _Jv_JNI_Init.
* include/jvm.h (_Jv_MallocUnchecked): Declare.
(_Jv_JNI_Init): Declare.
* jni.cc: Include Hashtable.h, OutOfMemoryError.h, Integer.h,
<string.h>.
(_Jv_JNI_NewGlobalRef): New function.
(_Jv_JNI_DeleteGlobalRef): New function.
(_Jv_JNI_DeleteLocalRef): New function.
(_Jv_JNI_conversion_call): Initialize and clear local reference
frame.
(_Jv_JNI_NewLocalRef): New function.
(struct _Jv_JNI_LocalFrame): New structure.
(_Jv_JNI_PushLocalFrame): New function.
(_Jv_JNI_EnsureLocalCapacity): New function.
(FRAME_SIZE): New define.
(_Jv_JNI_GetStringChars): Mark string, not characters.
(_Jv_JNI_ReleaseStringChars): Unmark string, not characters.
(_Jv_JNI_GetPrimitiveArrayElements): Mark array, not elements.
(_Jv_JNI_ReleasePrimitiveArrayElements): Unmark array, not
elements.
(_Jv_JNI_DefineClass): Make return value a local ref.
(_Jv_JNI_FindClass): Likewise.
(_Jv_JNI_GetSuperclass): Likewise.
(_Jv_JNI_ExceptionOccurred): Likewise.
(_Jv_JNI_AllocObject): Likewise.
(_Jv_JNI_GetObjectClass): Likewise.
(_Jv_JNI_CallAnyMethodV): Likewise.
(_Jv_JNI_NewString): Likewise.
(_Jv_JNI_NewStringUTF): Likewise.
(_Jv_JNI_NewObjectArray): Likewise.
(_Jv_JNI_GetObjectArrayElement): Likewise.
(_Jv_JNI_ToReflectedField): Likewise.
(_Jv_JNI_ToReflectedMethod): Likewise.
(_Jv_JNIFunctions): Updated table for new functions.
(_Jv_JNI_Init): New function.
(mark_for_gc): Wrote.
(unmark_for_gc): Wrote.
* include/jni.h (struct JNINativeInterface): Removed name from
PopLocalFrame parameter.
(class _Jv_JNIEnv): Added `locals' field.
From-SVN: r31730
2000-01-14 Andrew Haley <aph@cygnus.com>
* java/lang/natThrowable.cc: New file.
* java/lang/Throwable.java (fillInStackTrace): Make native.
(printStackTrace): Call native method to do this.
(Throwable): Call fillInStackTrace.
(stackTrace): New variable.
* include/jvm.h: Add _Jv_ThisExecutable functions.
* prims.cc: (_Jv_execName): New variable.
(catch_segv): Call fillInStackTrace.
(catch_fpe): Ditto.
(_Jv_ThisExecutable): New functions.
(JvRunMain): Set the name of this executable.
* Makefile.am: Add java/lang/natThrowable.cc.
Add name-finder.cc.
* Makefile.in: Rebuilt.
* acconfig.h: Add HAVE_PROC_SELF_EXE.
* configure.in: Force link with __frame_state_for in
FORCELIBGCCSPEC. Add new checks for backtrace.
* include/config.h.in: Rebuilt.
* name-finder.cc: New file.
* include/name-finder.h: New file.
From-SVN: r31460
2000-01-04 Tom Tromey <tromey@cygnus.com>
* java/lang/reflect/natConstructor.cc (newInstance): Pass
declaring class as return_type argument to
_Jv_CallNonvirtualMethodA.
* java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In
constructor case, create object and use it as `this' argument.
* java/lang/Class.h (_getConstructors): Declare.
(_getFields): Declare.
* java/lang/Class.java (getConstructors): Wrote.
(_getConstructors): New native method.
(getDeclaredConstructors): Wrote.
(_getFields): Declare new native method.
* java/lang/natClass.cc (_Jv_LookupInterfaceMethod): Removed
incorrect comment.
(getMethod): Work correctly when class is primitive.
(getDeclaredMethods): Likewise. Compute offset using `method',
not `mptr'.
(getDeclaredMethod): Likewise.
(getConstructor): Wrote.
(ConstructorClass): New define.
(getDeclaredConstructor): Wrote.
(_getConstructors): New method.
(_getFields): New method.
(getFields): Wrote.
* Makefile.in: Rebuilt.
* Makefile.am (AM_CXXFLAGS): Added -D_GNU_SOURCE.
* prims.cc: Remove `#pragma implementation'.
* gcj/array.h: Remove `#pragma interface'.
* prims.cc (_Jv_equaln): New function.
* java/lang/Class.java (getSignature): Declare.
* resolve.cc (_Jv_LookupDeclaredMethod): Moved to natClass.cc.
* java/lang/natClass.cc (_Jv_LookupDeclaredMethod): Moved from
resolve.cc.
(getSignature): New method.
(getDeclaredMethod): Wrote.
(getMethod): Wrote.
Include StringBuffer.h.
* java/lang/Class.h (Class): Added _Jv_FromReflectedConstructor
as a friend. Unconditionally declare _Jv_LookupDeclaredMethod as
a friend.
(getSignature): Declare.
* include/jvm.h (_Jv_GetTypesFromSignature): Declare.
(_Jv_equaln): Declare.
(_Jv_CallNonvirtualMethodA): Declare.
* Makefile.in: Rebuilt.
* Makefile.am (nat_source_files): Added natConstructor.cc.
(java/lang/reflect/Constructor.h): New target.
* java/lang/reflect/natConstructor.cc: New file.
* java/lang/reflect/Constructor.java (newInstance): Now native.
(declaringClass): Renamed from decl_class.
(offset): Renamed from index.
(getType): New native method.
(getModifiers): Now native.
(getParameterTypes): Call getType if required.
(hashCode): Include hash code from declaring class.
(modifiers): Removed.
(toString): Call getType if required.
* gcj/method.h (_Jv_FromReflectedConstructor): New function.
* java/lang/reflect/natMethod.cc (hack_call): New method.
Removed `#if 0' around FFI code.
Include <gnu/gcj/RawData.h>.
(invoke): Use _Jv_CallNonvirtualMethodA. Throw
IllegalArgumentException when argument object and class disagree.
(_Jv_GetTypesFromSignature): New function.
(getType): Use it.
(ObjectClass): New define.
(_Jv_CallNonvirtualMethodA): New function.
* java/lang/reflect/Method.java (hack_trampoline): New method.
(hack_call): New native method.
1999-12-21 Per Bothner <per@bothner.com>
* java/lang/natClass.cc (getDeclaredMethods): Correctly compute
offset in new Method.
From-SVN: r31199