OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [io/] [natVMObjectInputStream.cc] - Blame information for rev 758

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 758 jeremybenn
// natVMObjectInputStream.cc - Native part of VMObjectInputStream class.
2
 
3
/* Copyright (C) 1998, 1999, 2000, 2001, 2005, 2006, 2007
4
   Free Software Foundation
5
 
6
   This file is part of libgcj.
7
 
8
This software is copyrighted work licensed under the terms of the
9
Libgcj License.  Please consult the ObjectInputStream "LIBGCJ_LICENSE" for
10
details.  */
11
 
12
#include <config.h>
13
 
14
#include <gcj/cni.h>
15
#include <jvm.h>
16
#include <gcj/method.h>
17
 
18
#include <java/io/VMObjectInputStream.h>
19
#include <java/io/IOException.h>
20
#include <java/lang/Class.h>
21
#include <java/lang/reflect/Modifier.h>
22
#include <java/lang/reflect/Method.h>
23
#include <java/lang/ArrayIndexOutOfBoundsException.h>
24
#include <java/lang/SecurityManager.h>
25
#include <java/lang/reflect/Constructor.h>
26
#include <java/lang/reflect/Method.h>
27
#include <java-stack.h>
28
 
29
#ifdef __GCJ_DEBUG
30
#include <java/lang/System.h>
31
#include <java/io/PrintStream.h>
32
#endif
33
 
34
jobject
35
java::io::VMObjectInputStream::allocateObject (jclass klass, jclass,
36
  ::java::lang::reflect::Constructor *ctr)
37
{
38
  jobject obj = NULL;
39
  using namespace java::lang::reflect;
40
 
41
  try
42
    {
43
      JvAssert (klass && ! klass->isArray ());
44
      if (klass->isInterface() || Modifier::isAbstract(klass->getModifiers()))
45
        obj = NULL;
46
      else
47
        {
48
          obj = _Jv_AllocObject (klass);
49
        }
50
    }
51
  catch (jthrowable t)
52
    {
53
      return NULL;
54
    }
55
 
56
  jmethodID meth = _Jv_FromReflectedConstructor (ctr);
57
 
58
  // This is a bit inefficient, and a bit of a hack, since we don't
59
  // actually use the Method and since what is returned isn't
60
  // technically a Method.  We can't use Method.invoke as it looks up
61
  // the declared method.
62
  JArray<jclass> *arg_types
63
    = (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$,
64
                                           NULL);
65
 
66
  // We lie about this being a constructor.  If we put `true' here
67
  // then _Jv_CallAnyMethodA would try to allocate the object for us.
68
  _Jv_CallAnyMethodA (obj, JvPrimClass (void), meth, false, arg_types, NULL);
69
 
70
  return obj;
71
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.