java-interp.h (class _Jv_InterpMethod): Added JV_MARKOBJ_DECL.
authorTom Tromey <tromey@redhat.com>
Fri, 6 Dec 2002 23:41:38 +0000 (23:41 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 6 Dec 2002 23:41:38 +0000 (23:41 +0000)
* include/java-interp.h (class _Jv_InterpMethod): Added
JV_MARKOBJ_DECL.
* boehm.cc (_Jv_MarkObj): Consolidated interpreter code.  Also
mark `prepared' field of interpreted method.
* interpret.cc (compile): Use _Jv_AllocBytes.

From-SVN: r59900

libjava/ChangeLog
libjava/boehm.cc
libjava/include/java-interp.h
libjava/interpret.cc

index 34125a36ab852c77d26a29985b7afc53e8e3b62a..3e3ba7842d22cc5e0109cf753f11936b898748bc 100644 (file)
@@ -1,3 +1,11 @@
+2002-12-06  Tom Tromey  <tromey@redhat.com>
+
+       * include/java-interp.h (class _Jv_InterpMethod): Added
+       JV_MARKOBJ_DECL.
+       * boehm.cc (_Jv_MarkObj): Consolidated interpreter code.  Also
+       mark `prepared' field of interpreted method.
+       * interpret.cc (compile): Use _Jv_AllocBytes.
+
 2002-12-05  Andrew Haley  <aph@redhat.com>
 
        * gnu/gcj/runtime/natStackTrace.cc (fillInStackTrace): Throw
index 466c9223ac81f422bf7c2ad2b9c8bc966f963583..90796f2ddf0491d718825e9fd4e5344360157dde 100644 (file)
@@ -39,7 +39,6 @@ extern "C"
   ptr_t GC_debug_generic_malloc (size_t size, int k, GC_EXTRA_PARAMS);
 };
 
-// We must check for plausibility ourselves.
 #define MAYBE_MARK(Obj, Top, Limit, Source, Exit)  \
        Top=GC_MARK_AND_PUSH((GC_PTR)Obj, Top, Limit, (GC_PTR *)Source)
 
@@ -153,19 +152,6 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
              p = (ptr_t) c->methods[i].signature;
              MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
                             cm2label);
-
-             // FIXME: `ncode' entry?
-
-#ifdef INTERPRETER
-             // The interpreter installs a heap-allocated
-             // trampoline here, so we'll mark it. 
-             if (_Jv_IsInterpretedClass (c))
-                 {
-                     p = (ptr_t) c->methods[i].ncode;
-                     MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
-                                 cm3label);
-                 }
-#endif
            }
        }
 
@@ -221,7 +207,7 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
 #ifdef INTERPRETER
       if (_Jv_IsInterpretedClass (c))
        {
-         _Jv_InterpClass* ic = (_Jv_InterpClass*)c;
+         _Jv_InterpClass* ic = (_Jv_InterpClass*) c;
 
          p = (ptr_t) ic->interpreted_methods;
          MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, cElabel);
@@ -231,6 +217,26 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
              p = (ptr_t) ic->interpreted_methods[i];
              MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \
                          cFlabel);
+
+             // Mark the direct-threaded code.
+             if ((c->methods[i].accflags
+                  & java::lang::reflect::Modifier::NATIVE) == 0)
+               {
+                 _Jv_InterpMethod *im
+                   = (_Jv_InterpMethod *) ic->interpreted_methods[i];
+                 if (im)
+                   {
+                     p = (ptr_t) im->prepared;
+                     MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \
+                                 cFlabel);
+                   }
+               }
+
+             // The interpreter installs a heap-allocated trampoline
+             // here, so we'll mark it.
+             p = (ptr_t) c->methods[i].ncode;
+             MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
+                         cm3label);
            }
 
          p = (ptr_t) ic->field_initializers;
index ef2b5206cdbd7c34e11b69751f7a0eecb828beb0..a44db38ca85080ccf0443d2b5115367e45c836f8 100644 (file)
@@ -144,6 +144,10 @@ class _Jv_InterpMethod : public _Jv_MethodBase
   friend class gnu::gcj::runtime::StackTrace;
 
   friend void _Jv_PrepareClass(jclass);
+
+#ifdef JV_MARKOBJ_DECL
+  friend JV_MARKOBJ_DECL;
+#endif
 };
 
 class _Jv_InterpClass : public java::lang::Class
index bc324b13ba97990778352cdab7b072c3ee765564..9791b4a5cd801d607f7a7cfa1fd6424c2cef7e24 100644 (file)
@@ -312,7 +312,7 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
 
       if (! first_pass)
        {
-         insns = (insn_slot *) _Jv_Malloc (sizeof (insn_slot) * next);
+         insns = (insn_slot *) _Jv_AllocBytes (sizeof (insn_slot) * next);
          next = 0;
        }