| 1 | // java-interp.h - Header file for the bytecode interpreter. -*- c++ -*-
|
|---|
| 2 |
|
|---|
| 3 | /* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
|
|---|
| 4 |
|
|---|
| 5 | This file is part of libgcj.
|
|---|
| 6 |
|
|---|
| 7 | This software is copyrighted work licensed under the terms of the
|
|---|
| 8 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|---|
| 9 | details. */
|
|---|
| 10 |
|
|---|
| 11 | #ifndef __JAVA_INTERP_H__
|
|---|
| 12 | #define __JAVA_INTERP_H__
|
|---|
| 13 |
|
|---|
| 14 | #include <jvm.h>
|
|---|
| 15 | #include <java-cpool.h>
|
|---|
| 16 | #include <gnu/gcj/runtime/NameFinder.h>
|
|---|
| 17 |
|
|---|
| 18 | #ifdef INTERPRETER
|
|---|
| 19 |
|
|---|
| 20 | #pragma interface
|
|---|
| 21 |
|
|---|
| 22 | #include <java/lang/Class.h>
|
|---|
| 23 | #include <java/lang/ClassLoader.h>
|
|---|
| 24 | #include <java/lang/reflect/Modifier.h>
|
|---|
| 25 | #include <gnu/gcj/runtime/StackTrace.h>
|
|---|
| 26 |
|
|---|
| 27 | extern "C" {
|
|---|
| 28 | #include <ffi.h>
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | extern inline jboolean
|
|---|
| 32 | _Jv_IsInterpretedClass (jclass c)
|
|---|
| 33 | {
|
|---|
| 34 | return (c->accflags & java::lang::reflect::Modifier::INTERPRETED) != 0;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | struct _Jv_ResolvedMethod;
|
|---|
| 38 |
|
|---|
| 39 | void _Jv_DefineClass (jclass, jbyteArray, jint, jint);
|
|---|
| 40 |
|
|---|
| 41 | void _Jv_InitField (jobject, jclass, int);
|
|---|
| 42 | void * _Jv_AllocMethodInvocation (jsize size);
|
|---|
| 43 | int _Jv_count_arguments (_Jv_Utf8Const *signature,
|
|---|
| 44 | jboolean staticp = true);
|
|---|
| 45 | void _Jv_VerifyMethod (_Jv_InterpMethod *method);
|
|---|
| 46 |
|
|---|
| 47 | /* FIXME: this should really be defined in some more generic place */
|
|---|
| 48 | #define ROUND(V, A) (((((unsigned) (V))-1) | ((A)-1))+1)
|
|---|
| 49 |
|
|---|
| 50 | /* the interpreter is written in C++, primarily because it makes it easy for
|
|---|
| 51 | * the entire thing to be "friend" with class Class. */
|
|---|
| 52 |
|
|---|
| 53 | class _Jv_InterpClass;
|
|---|
| 54 | class _Jv_InterpMethod;
|
|---|
| 55 |
|
|---|
| 56 | // Before a method is "compiled" we store values as the bytecode PC,
|
|---|
| 57 | // an int. Afterwards we store them as pointers into the prepared
|
|---|
| 58 | // code itself.
|
|---|
| 59 | union _Jv_InterpPC
|
|---|
| 60 | {
|
|---|
| 61 | int i;
|
|---|
| 62 | void *p;
|
|---|
| 63 | };
|
|---|
| 64 |
|
|---|
| 65 | class _Jv_InterpException
|
|---|
| 66 | {
|
|---|
| 67 | _Jv_InterpPC start_pc;
|
|---|
| 68 | _Jv_InterpPC end_pc;
|
|---|
| 69 | _Jv_InterpPC handler_pc;
|
|---|
| 70 | _Jv_InterpPC handler_type;
|
|---|
| 71 |
|
|---|
|
|---|