pike.git / src / modules / Java / jvm.c

version» Context lines:

pike.git/src/modules/Java/jvm.c:7:   /*    * Pike interface to Java Virtual Machine    *    * Marcus Comstedt    */      /*    * Includes    */    - #define NO_PIKE_SHORTHAND -  - #ifdef HAVE_CONFIG_H +    #include "config.h" - #endif /* HAVE_CONFIG_H */ -  +    #include "global.h" -  +    #include "program.h"   #include "interpret.h"   #include "stralloc.h"   #include "object.h"   #include "builtin_functions.h"   #include "pike_error.h"   #include "module_support.h"   #include "pike_memory.h"   #include "gc.h"   #include "threads.h"   #include "operators.h"   #include "signal_handler.h" -  + #include "pike_types.h"      #ifdef HAVE_JAVA    - #include <stdarg.h> +    #include <locale.h>      #ifdef HAVE_JNI_H -  + #undef UNUSED   #include <jni.h>   #endif /* HAVE_JNI_H */    -  + #ifdef HAVE_JAVAVM_JNI_H + #undef UNUSED + #include <JavaVM/jni.h> + #endif /* HAVE_JAVAVM_JNI_H */ +    #ifdef HAVE_WINBASE_H   #include <winbase.h>   #endif /* HAVE_WINBASE_H */      #ifdef HAVE_FFI_H   #include <ffi.h>   #else   #ifdef HAVE_FFI_FFI_H   #include <ffi/ffi.h>   #else
pike.git/src/modules/Java/jvm.c:185:    return "invalid arguments";   #endif    }    return "unknown error";   }      /* Attach foo */      static JNIEnv *jvm_procure_env(struct object *jvm)   { -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jvm, jvm_program); +  struct jvm_storage *j = get_storage(jvm, jvm_program);    if(j) {      #ifdef _REENTRANT    void *env;       if(JNI_OK == (*j->jvm)->GetEnv(j->jvm, &env, JNI_VERSION_1_2)) {    return (JNIEnv *)env;    }       if(j->tl_env != NULL && j->tl_env->prog != NULL) {
pike.git/src/modules/Java/jvm.c:229: Inside #if defined(_REENTRANT)
   pop_n_elems(1);    return (JNIEnv *)env;   #else    return j->env;   #endif /* _REENTRANT */       } else    return NULL;   }    - static void jvm_vacate_env(struct object *jvm, JNIEnv *env) + static void jvm_vacate_env(struct object *PIKE_UNUSED(jvm), +  JNIEnv *PIKE_UNUSED(env))   {   }         /* Global object references */      static void push_java_class(jclass c, struct object *jvm, JNIEnv *env)   {    struct object *oo;    struct jobj_storage *jo;
pike.git/src/modules/Java/jvm.c:300:    jo->jobj = t2;    a = (struct jarray_storage *)(oo->storage+jarray_stor_offs);    a->ty = ty;    add_ref(jvm);   }      static void push_java_anyobj(jobject o, struct object *jvm, JNIEnv *env)   {    struct object *oo;    struct jobj_storage *jo; -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jvm, jvm_program); +  struct jvm_storage *j = get_storage(jvm, jvm_program);    jobject o2;       if((!j)||(!o)) {    push_int(0);    return;    }    o2 = (*env)->NewGlobalRef(env, o);    (*env)->DeleteLocalRef(env, o);    if((*env)->IsInstanceOf(env, o2, j->class_class))    push_object(oo=clone_object(jclass_program, 0));
pike.git/src/modules/Java/jvm.c:333:    } else    push_object(oo=clone_object(jobj_program, 0));    (*env)->DeleteLocalRef(env, cc);    }    jo = (struct jobj_storage *)(oo->storage);    jo->jvm = jvm;    jo->jobj = o2;    add_ref(jvm);   }    - static void init_jobj_struct(struct object *o) + static void init_jobj_struct(struct object *PIKE_UNUSED(o))   {    struct jobj_storage *j = THIS_JOBJ;    j->jvm = NULL;    j->jobj = 0;   }    - static void exit_jobj_struct(struct object *o) + static void exit_jobj_struct(struct object *PIKE_UNUSED(o))   {    JNIEnv *env;    struct jobj_storage *j = THIS_JOBJ;    if(j->jvm) {    if(j->jobj && (env = jvm_procure_env(j->jvm)) != NULL) {    (*env)->DeleteGlobalRef(env, j->jobj);    jvm_vacate_env(j->jvm, env);    }    free_object(j->jvm);    }   }    - static void jobj_gc_check(struct object *o) + static void jobj_gc_check(struct object *PIKE_UNUSED(o))   {    struct jobj_storage *j = THIS_JOBJ;       if(j->jvm)    gc_check(j->jvm);   }    - static void jobj_gc_recurse(struct object *o) + static void jobj_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct jobj_storage *j = THIS_JOBJ;       if(j->jvm)    gc_recurse_object(j->jvm);   }      static void f_jobj_cast(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ; -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jo->jvm, jvm_program); +  struct jvm_storage *j = get_storage(jo->jvm, jvm_program);    JNIEnv *env;    jstring jstr;    -  if(args < 1) -  Pike_error("cast() called without arguments.\n"); -  if(TYPEOF(Pike_sp[-args]) != PIKE_T_STRING) -  Pike_error("Bad argument 1 to cast().\n"); +  if(args < 1 || TYPEOF(Pike_sp[-args]) != PIKE_T_STRING) +  SIMPLE_ARG_TYPE_ERROR("cast", 1, "string");    -  if(!strcmp(Pike_sp[-args].u.string->str, "object")) { +  if(Pike_sp[-args].u.string != literal_string_string) +  {    pop_n_elems(args); -  push_object(this_object()); +  push_undefined(); +  return;    }    -  if(strcmp(Pike_sp[-args].u.string->str, "string")) -  Pike_error("cast() to other type than string.\n"); -  +     pop_n_elems(args);    if((env=jvm_procure_env(jo->jvm))) {    jstr = (*env)->CallObjectMethod(env, jo->jobj, j->method_tostring);    if(jstr) {    jsize l;    const jchar *wstr;       wstr = (*env)->GetStringChars(env, jstr, NULL);    l = (*env)->GetStringLength(env, jstr);    push_string(make_shared_binary_string1((p_wchar1 *)wstr, l));
pike.git/src/modules/Java/jvm.c:416:    Pike_error("cast() to string failed (no JNIEnv).\n");   }      static void f_jobj_eq(INT32 args)   {    struct jobj_storage *jo2, *jo = THIS_JOBJ;    JNIEnv *env;    jboolean res;       if(args<1 || TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jo2 = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jo2 = get_storage(Pike_sp[-args].u.object,    jobj_program))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }       if((env=jvm_procure_env(jo->jvm))) {    res = (*env)->IsSameObject(env, jo->jobj, jo2->jobj);    jvm_vacate_env(jo->jvm, env);    } else    res = 0;       pop_n_elems(args);    push_int((res? 1:0));   }      static void f_jobj_hash(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ;    JNIEnv *env; -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jo->jvm, jvm_program); +  struct jvm_storage *j = get_storage(jo->jvm, jvm_program);       pop_n_elems(args);    if((env=jvm_procure_env(jo->jvm))) {    push_int((*env)->CallIntMethod(env, jo->jobj, j->method_hash));    jvm_vacate_env(jo->jvm, env);    }    else push_int(0);   }      static void f_jobj_instance(INT32 args)   {    struct jobj_storage *c, *jo = THIS_JOBJ;    JNIEnv *env;    struct object *cls;    int n=0;    -  get_all_args("Java.obj->is_instance_of()", args, "%o", &cls); +  get_all_args(NULL, args, "%o", &cls);    -  if((c = (struct jobj_storage *)get_storage(cls, jclass_program)) == NULL) -  Pike_error("Bad argument 1 to is_instance_of().\n"); +  if((c = get_storage(cls, jclass_program)) == NULL) +  SIMPLE_ARG_TYPE_ERROR("is_instance_of", 1, "Java class");       if((env=jvm_procure_env(jo->jvm))) {    if((*env)->IsInstanceOf(env, jo->jobj, c->jobj))    n = 1;    jvm_vacate_env(jo->jvm, env);    }       pop_n_elems(args);    push_int(n);   }
pike.git/src/modules/Java/jvm.c:505:    if((env=jvm_procure_env(jo->jvm))) {    push_java_class((*env)->GetObjectClass(env, jo->jobj), jo->jvm, env);    jvm_vacate_env(jo->jvm, env);    }    else push_int(0);   }         /* Methods */    - static void init_method_struct(struct object *o) + static void init_method_struct(struct object *PIKE_UNUSED(o))   {    struct method_storage *m=THIS_METHOD;       m->class = NULL;    m->name = NULL;    m->sig = NULL;   }    - static void exit_method_struct(struct object *o) + static void exit_method_struct(struct object *PIKE_UNUSED(o))   {    struct method_storage *m=THIS_METHOD;       if(m->sig != NULL)    free_string(m->sig);    if(m->name != NULL)    free_string(m->name);    if(m->class != NULL)    free_object(m->class);   }    - static void method_gc_check(struct object *o) + static void method_gc_check(struct object *PIKE_UNUSED(o))   {    struct method_storage *m = THIS_METHOD;       if(m->class)    gc_check(m->class);   }    - static void method_gc_recurse(struct object *o) + static void method_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct method_storage *m = THIS_METHOD;       if(m->class)    gc_recurse_object(m->class);   }      static void f_method_create(INT32 args)   {    struct method_storage *m=THIS_METHOD;    struct jobj_storage *c;    struct object *class;    struct pike_string *name, *sig;    JNIEnv *env;    char *p;    -  get_all_args("Java.method->create()", args, "%S%S%o", &name, &sig, &class); +  get_all_args(NULL, args, "%S%S%o", &name, &sig, &class);    -  if((c = (struct jobj_storage *)get_storage(class, jclass_program)) == NULL) -  Pike_error("Bad argument 3 to create().\n"); +  if((c = get_storage(class, jclass_program)) == NULL) +  SIMPLE_ARG_TYPE_ERROR("create", 3, "Java class");       if((env = jvm_procure_env(c->jvm))==NULL) { -  pop_n_elems(args); +     destruct(Pike_fp->current_object);    return;    }       m->method = (Pike_fp->current_object->prog==static_method_program?    (*env)->GetStaticMethodID(env, c->jobj, name->str, sig->str):    (*env)->GetMethodID(env, c->jobj, name->str, sig->str));       jvm_vacate_env(c->jvm, env);       if(m->method == 0) { -  pop_n_elems(args); +     destruct(Pike_fp->current_object);    return;    }       m->class = class;    copy_shared_string(m->name, name);    copy_shared_string(m->sig, sig);    add_ref(class); -  pop_n_elems(args); -  push_int(0); +        m->nargs = 0;    m->rettype = 0;       p = sig->str;    if(*p++ != '(')    return;       while(*p && *p != ')') {    if(*p != '[')
pike.git/src/modules/Java/jvm.c:660:    case 'S':    jargs->s = sv->u.integer;    break;    case 'I':    jargs->i = sv->u.integer;    break;    case 'J':    jargs->j = sv->u.integer;    break;    case 'F': -  jargs->f = DO_NOT_WARN((float)sv->u.integer); +  jargs->f = (float)sv->u.integer;    break;    case 'D':    jargs->d = sv->u.integer;    break;    default:    jargs_error(jvm, env);    }    break;    case PIKE_T_FLOAT:    switch(*sig++) {    case 'Z':    jargs->z = sv->u.float_number!=0;    break;    case 'B': -  jargs->b = DO_NOT_WARN((char)sv->u.float_number); +  jargs->b = (char)sv->u.float_number;    break;    case 'C': -  jargs->c = DO_NOT_WARN((unsigned short)sv->u.float_number); +  jargs->c = (unsigned short)sv->u.float_number;    break;    case 'S': -  jargs->s = DO_NOT_WARN((short)sv->u.float_number); +  jargs->s = (short)sv->u.float_number;    break;    case 'I': -  jargs->i = DO_NOT_WARN((long)sv->u.float_number); +  jargs->i = (long)sv->u.float_number;    break;    case 'J':    jargs->j = sv->u.float_number;    break;    case 'F':    jargs->f = sv->u.float_number;    break;    case 'D':    jargs->d = sv->u.float_number;    break;
pike.git/src/modules/Java/jvm.c:708:    break;    case PIKE_T_STRING:    if(*sig++!='L')    jargs_error(jvm, env);    if(i+1<args)    while(*sig && *sig++!=';');    switch(sv->u.string->size_shift) {    case 0:    {    /* Extra byte added to avoid zero length allocation */ -  jchar *newstr = (jchar *) xalloc(2 * sv->u.string->len + 1); +  jchar *newstr = xalloc(2 * sv->u.string->len + 1);    INT32 i;    p_wchar0 *p = STR0(sv->u.string);    for(i=sv->u.string->len; --i>=0; )    newstr[i]=(jchar)(unsigned char)p[i];    jargs->l = (*env)->NewString(env, newstr, sv->u.string->len);    dorelease && (*dorelease = 1);    free(newstr);    }    break;    case 1:    jargs->l = (*env)->NewString(env, (jchar*)STR1(sv->u.string),    sv->u.string->len);    dorelease && (*dorelease = 1);    break;    case 2:    {    /* FIXME?: Does not make surrogates for plane 1-16 in group 0... */    /* Extra byte added to avoid zero length allocation */ -  jchar *newstr = (jchar *) xalloc(2 * sv->u.string->len + 1); +  jchar *newstr = xalloc(2 * sv->u.string->len + 1);    INT32 i;    p_wchar2 *p = STR2(sv->u.string);    for(i=sv->u.string->len; --i>=0; )    newstr[i]=(jchar)(p[i]>0xffff? 0xfffd : p[i]);    jargs->l = (*env)->NewString(env, newstr, sv->u.string->len);    dorelease && (*dorelease = 1);    free(newstr);    }    break;    }    break;    case PIKE_T_OBJECT:    if(*sig=='[') { -  if(!(jo=(struct jobj_storage *)get_storage(sv->u.object,jobj_program))) +  if(!(jo=get_storage(sv->u.object,jobj_program)))    jargs_error(jvm, env);    else {    if(i+1<args) {    while(*sig=='[') sig++;    if(*sig && *sig++=='L')    while(*sig && *sig++!=';');    }    jargs->l = jo->jobj;    }    } else {    if(*sig++!='L' || -  !(jo=(struct jobj_storage *)get_storage(sv->u.object,jobj_program))) +  !(jo=get_storage(sv->u.object,jobj_program)))    jargs_error(jvm, env);    else {    if(i+1<args)    while(*sig && *sig++!=';');    jargs->l = jo->jobj;    }    }    break;    default:    jargs_error(jvm, env);    }    jargs++;    dorelease && dorelease++;    }   }    - static void free_jargs(jvalue *jargs, INT32 args, char *dorelease, char *sig, -  struct object *jvm, JNIEnv *env) + static void free_jargs(jvalue *jargs, INT32 args, char *dorelease, +  char *PIKE_UNUSED(sig), +  struct object *PIKE_UNUSED(jvm), JNIEnv *env)   {    INT32 i;    int do_free_jargs = 1;    if(jargs == NULL)    return;       if(args==-1)    {    args=1;    do_free_jargs = 0;
pike.git/src/modules/Java/jvm.c:816:       if(args != m->nargs)    Pike_error("wrong number of arguments for method.\n");       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }    -  jargs = (m->nargs>0?(jvalue *)xalloc(m->nargs*sizeof(jvalue)):NULL); -  dorelease = (m->nargs>0?(char *)xalloc(m->nargs*sizeof(char)):NULL); +  jargs = (m->nargs>0?xalloc(m->nargs*sizeof(jvalue)):NULL); +  dorelease = (m->nargs>0?xalloc(m->nargs*sizeof(char)):NULL);    make_jargs(jargs, args, dorelease, m->sig->str, co->jvm, env);       switch(m->rettype) {    case 'Z':    THREADS_ALLOW();    jji = (*env)->CallStaticBooleanMethodA(env, class, m->method, jargs);    THREADS_DISALLOW();    pop_n_elems(args);    push_int(jji);    break;
pike.git/src/modules/Java/jvm.c:918:    JNIEnv *env;    struct jobj_storage *co = THAT_JOBJ(m->class);    jclass class = co->jobj;    jobject jjo; FLOAT_TYPE jjf; INT32 jji;    struct jobj_storage *jo;       if(args != 1+m->nargs)    Pike_error("wrong number of arguments for method.\n");       if(TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jo = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jo = get_storage(Pike_sp[-args].u.object,    jobj_program))==NULL)    Pike_error("Bad argument 1 to `().\n");       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }    -  jargs = (m->nargs>0?(jvalue *)xalloc(m->nargs*sizeof(jvalue)):NULL); -  dorelease = (m->nargs>0?(char *)xalloc(m->nargs*sizeof(char)):NULL); +  jargs = (m->nargs>0?xalloc(m->nargs*sizeof(jvalue)):NULL); +  dorelease = (m->nargs>0?xalloc(m->nargs*sizeof(char)):NULL);    make_jargs(jargs, args-1, dorelease, m->sig->str, co->jvm, env);       switch(m->rettype) {    case 'Z':    THREADS_ALLOW();    jji = (*env)->CallBooleanMethodA(env, jo->jobj, m->method, jargs);    THREADS_DISALLOW();    pop_n_elems(args);    push_int(jji);    break;
pike.git/src/modules/Java/jvm.c:1030:    JNIEnv *env;    struct jobj_storage *co = THAT_JOBJ(m->class);    jclass class = co->jobj;    jobject jjo; FLOAT_TYPE jjf; INT32 jji;    struct jobj_storage *jo;       if(args != 1+m->nargs)    Pike_error("wrong number of arguments for method.\n");       if(TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jo = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jo = get_storage(Pike_sp[-args].u.object,    jobj_program))==NULL)    Pike_error("Bad argument 1 to call_nonvirtual.\n");       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }    -  jargs = (m->nargs>0?(jvalue *)xalloc(m->nargs*sizeof(jvalue)):NULL); -  dorelease = (m->nargs>0?(char *)xalloc(m->nargs*sizeof(char)):NULL); +  jargs = (m->nargs>0?xalloc(m->nargs*sizeof(jvalue)):NULL); +  dorelease = (m->nargs>0?xalloc(m->nargs*sizeof(char)):NULL);    make_jargs(jargs, args-1, dorelease, m->sig->str, co->jvm, env);       switch(m->rettype) {    case 'Z':    THREADS_ALLOW();    jji = (*env)->CallNonvirtualBooleanMethodA(env, jo->jobj, class, m->method, jargs);    THREADS_DISALLOW();    pop_n_elems(args);    push_int(jji);    break;
pike.git/src/modules/Java/jvm.c:1130:    }       free_jargs(jargs, args-1, dorelease, m->sig->str, co->jvm, env);       jvm_vacate_env(co->jvm, env);   }         /* Fields */    - static void init_field_struct(struct object *o) + static void init_field_struct(struct object *PIKE_UNUSED(o))   {    struct field_storage *f=THIS_FIELD;       f->class = NULL;    f->name = NULL;    f->sig = NULL;   }    - static void exit_field_struct(struct object *o) + static void exit_field_struct(struct object *PIKE_UNUSED(o))   {    struct field_storage *f=THIS_FIELD;       if(f->sig != NULL)    free_string(f->sig);    if(f->name != NULL)    free_string(f->name);    if(f->class != NULL)    free_object(f->class);   }    - static void field_gc_check(struct object *o) + static void field_gc_check(struct object *PIKE_UNUSED(o))   {    struct field_storage *f = THIS_FIELD;       if(f->class)    gc_check(f->class);   }    - static void field_gc_recurse(struct object *o) + static void field_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct field_storage *f = THIS_FIELD;       if(f->class)    gc_recurse_object(f->class);   }      static void f_field_create(INT32 args)   {    struct field_storage *f=THIS_FIELD;    struct jobj_storage *c;    struct object *class;    struct pike_string *name, *sig;    JNIEnv *env;       if(args==1) { -  get_all_args("Java.field->create()", args, "%o", &class); +  get_all_args(NULL, args, "%o", &class);    name = NULL;    sig = NULL;    } else -  get_all_args("Java.field->create()", args, "%S%S%o", &name, &sig, &class); +  get_all_args(NULL, args, "%S%S%o", &name, &sig, &class);    -  if((c = (struct jobj_storage *)get_storage(class, jclass_program)) == NULL) -  Pike_error("Bad argument 3 to create().\n"); +  if((c = get_storage(class, jclass_program)) == NULL) +  SIMPLE_ARG_TYPE_ERROR("create", 3, "Java class");       f->field = 0;       if(name == NULL || sig == NULL) {    f->class = class;    add_ref(class); -  pop_n_elems(args); +     f->type = 0;    return;    }       if((env = jvm_procure_env(c->jvm))) {       f->field = (Pike_fp->current_object->prog==static_field_program?    (*env)->GetStaticFieldID(env, c->jobj, name->str, sig->str):    (*env)->GetFieldID(env, c->jobj, name->str, sig->str));       jvm_vacate_env(c->jvm, env);    }       if(f->field == 0) { -  pop_n_elems(args); +     destruct(Pike_fp->current_object);    return;    }       f->class = class;    copy_shared_string(f->name, name);    copy_shared_string(f->sig, sig);    add_ref(class); -  pop_n_elems(args); -  push_int(0); +        if((f->type = sig->str[0])=='[')    f->subtype = sig->str[1];   }      static void f_field_set(INT32 args)   {    struct field_storage *f=THIS_FIELD;    JNIEnv *env;    struct jobj_storage *co = THAT_JOBJ(f->class);    struct jobj_storage *jo;    jvalue v;    char dorelease;       if(args!=2) -  Pike_error("Incorrect number of arguments to set.\n"); +  SIMPLE_WRONG_NUM_ARGS_ERROR("set", 2);       if(TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jo = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jo = get_storage(Pike_sp[-args].u.object,    jobj_program))==NULL) -  Pike_error("Bad argument 1 to set.\n"); +  SIMPLE_ARG_TYPE_ERROR("set", 1, "Java object");       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }       make_jargs(&v, -1, &dorelease, f->sig->str, co->jvm, env);    switch(f->type) {    case 'Z':
pike.git/src/modules/Java/jvm.c:1294:   static void f_field_get(INT32 args)   {    struct field_storage *f=THIS_FIELD;    JNIEnv *env;    struct jobj_storage *co = THAT_JOBJ(f->class);    jclass class = co->jobj;    jobject jjo; FLOAT_TYPE jjf; INT32 jji;    struct jobj_storage *jo;       if(TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jo = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jo = get_storage(Pike_sp[-args].u.object,    jobj_program))==NULL) -  Pike_error("Bad argument 1 to get.\n"); +  SIMPLE_ARG_TYPE_ERROR("get", 1, "Java object");       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }       switch(f->type) {    case 'Z':    jji = (*env)->GetBooleanField(env, jo->jobj, f->field);
pike.git/src/modules/Java/jvm.c:1373:   static void f_static_field_set(INT32 args)   {    struct field_storage *f=THIS_FIELD;    JNIEnv *env;    struct jobj_storage *co = THAT_JOBJ(f->class);    jclass class = co->jobj;    jvalue v;    char dorelease;       if(args!=1) -  Pike_error("Incorrect number of arguments to set.\n"); +  SIMPLE_WRONG_NUM_ARGS_ERROR("set", 1);       if((env = jvm_procure_env(co->jvm))==NULL) {    pop_n_elems(args);    push_int(0);    return;    }       make_jargs(&v, -1, &dorelease, f->sig->str, co->jvm, env);    switch(f->type) {    case 'Z':
pike.git/src/modules/Java/jvm.c:1502: Inside #if defined(SUPPORT_NATIVE_METHODS)
     /* low_make_stub() returns the address of a function in ctx that    * prepends data to the list of arguments, and then calls dispatch()    * with the resulting argument list.    *    * Arguments:    * ctx Context, usually just containing space for the machine code.    * data Value to prepend in the argument list.    * statc dispatch is a static method.    * dispatch Function to call. -  * args Number of integer equvivalents to pass along. +  * args Number of integer equivalents to pass along.    * flt_args bitfield: There are float arguments at these positions.    * dbl_args bitfield: There are double arguments at these positions.    */      static void native_dispatch(struct native_method_context *ctx,    JNIEnv *env, jclass cls, void *args,    jvalue *rc);      #ifdef HAVE_FFI   
pike.git/src/modules/Java/jvm.c:1609:    return &ffi_type_sint64;    case 'F':    return &ffi_type_float;    case 'D':    return &ffi_type_double;    case 'V':    return &ffi_type_void;    }   }    - static void *make_stub(struct cpu_context *ctx, void *data, int statc, int rt, -  int args, int flt_args, int dbl_args, -  const char *signature) + static void *make_stub(struct cpu_context *ctx, void *data, int statc, +  int PIKE_UNUSED(rt), int args, int PIKE_UNUSED(flt_args), +  int PIKE_UNUSED(dbl_args), const char *signature)   {    ffi_status s;    ffi_type *rtype, **atypes;    ffi_abi abi;    int na = 2;       ctx->statc = statc;    ctx->atypes = atypes = xalloc(args*sizeof(ffi_type *));    atypes[0] = &ffi_type_pointer;    atypes[1] = &ffi_type_pointer;
pike.git/src/modules/Java/jvm.c:1652: Inside #if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
  #if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)    abi = FFI_STDCALL;   #else    abi = FFI_DEFAULT_ABI;   #endif       s = ffi_prep_cif(&ctx->cif, abi, na, rtype, atypes);    if(s != FFI_OK)    Pike_error("ffi error %d\n", s);    + #ifdef HAVE_FFI_PREP_CLOSURE_LOC +  /* FIXME: Use ffi_closure_alloc() et al. */ +  s = ffi_prep_closure_loc (&ctx->closure, &ctx->cif, +  ffi_dispatch, data, &ctx->closure); + #else    s = ffi_prep_closure (&ctx->closure, &ctx->cif,    ffi_dispatch, data); -  + #endif    if(s != FFI_OK)    Pike_error("ffi error %d\n", s);       return &ctx->closure;   }      #define ARGS_TYPE void**   #define GET_NATIVE_ARG(ty) (*(ty*)*(args)++)   #define USE_SMALL_ARGS   
pike.git/src/modules/Java/jvm.c:1716:    if(!statc)    *p++ = 0xd223a048; /* st %o1, [ %sp + 0x48 ] */    *p++ = 0xd423a04c; /* st %o2, [ %sp + 0x4c ] */    *p++ = 0xd623a050; /* st %o3, [ %sp + 0x50 ] */    *p++ = 0xd823a054; /* st %o4, [ %sp + 0x54 ] */    *p++ = 0xda23a058; /* st %o5, [ %sp + 0x58 ] */    *p++ = 0x9de3bf90; /* save %sp, -112, %sp */   #endif      #ifdef SPARCV9 -  *p++ = 0x11000000|(((unsigned INT32)(((unsigned INT64)data)>>32))>>10); +  *p++ = 0x11000000|(((unsigned INT32)(((UINT64)data)>>32))>>10);    /* sethi %hi(data>>32), %o0 */ -  *p++ = 0x90122000|(((unsigned INT32)(((unsigned INT64)data)>>32))&0x3ff); +  *p++ = 0x90122000|(((unsigned INT32)(((UINT64)data)>>32))&0x3ff);    /* or %o0, %lo(data>>32), %o0 */    *p++ = 0x832a3020; /* sllx %o0, 32, %g1 */ -  *p++ = 0x11000000|(((unsigned INT32)(unsigned INT64)data)>>10); +  *p++ = 0x11000000|(((unsigned INT32)(UINT64)data)>>10);    /* sethi %hi(data), %o0 */ -  *p++ = 0x90122000|(((unsigned INT32)(unsigned INT64)data)&0x3ff); +  *p++ = 0x90122000|(((unsigned INT32)(UINT64)data)&0x3ff);    /* or %o0, %lo(data), %o0 */    *p++ = 0x90020001; /* add %o0, %g1, %o0 */   #else    *p++ = 0x11000000|(((unsigned INT32)data)>>10);    /* sethi %hi(data), %o0 */    *p++ = 0x90122000|(((unsigned INT32)data)&0x3ff);    /* or %o0, %lo(data), %o0 */   #endif       *p++ = 0x92162000; /* mov %i0, %o1 */
pike.git/src/modules/Java/jvm.c:1751:    } else {    *p++ = 0x94100000; /* mov %g0, %o2 */   #ifdef SPARCV9    *p++ = 0x9607a887; /* add %fp, 0x887, %o3 */   #else    *p++ = 0x9607a048; /* add %fp, 0x48, %o3 */   #endif    }      #ifdef SPARCV9 -  *p++ = 0x19000000|(((unsigned INT32)(((unsigned INT64)(void *)dispatch)>>32))>>10); +  *p++ = 0x19000000|(((unsigned INT32)(((UINT64)(void *)dispatch)>>32))>>10);    /* sethi %hi(dispatch>>32), %o4 */ -  *p++ = 0x98132000|(((unsigned INT32)(((unsigned INT64)(void *)dispatch)>>32))&0x3ff); +  *p++ = 0x98132000|(((unsigned INT32)(((UINT64)(void *)dispatch)>>32))&0x3ff);    /* or %o4, %lo(dispatch>>32), %o4 */    *p++ = 0x832b3020; /* sllx %o4, 32, %g1 */ -  *p++ = 0x19000000|(((unsigned INT32)(unsigned INT64)(void *)dispatch)>>10); +  *p++ = 0x19000000|(((unsigned INT32)(UINT64)(void *)dispatch)>>10);    /* sethi %hi(dispatch), %o4 */ -  *p++ = 0x98132000|(((unsigned INT32)(unsigned INT64)(void *)dispatch)&0x3ff); +  *p++ = 0x98132000|(((unsigned INT32)(UINT64)(void *)dispatch)&0x3ff);    /* or %o4, %lo(dispatch), %o4 */    *p++ = 0x98030001; /* add %o4, %g1, %o4 */   #else    *p++ = 0x19000000|(((unsigned INT32)(void *)dispatch)>>10);    /* sethi %hi(dispatch), %o4 */    *p++ = 0x98132000|(((unsigned INT32)(void *)dispatch)&0x3ff);    /* or %o4, %lo(dispatch), %o4 */   #endif       *p++ = 0x9fc30000; /* call %o4 */
pike.git/src/modules/Java/jvm.c:2263:    int num_methods;    struct native_method_context *cons;    JNINativeMethod *jnms;   };      static void make_java_exception(struct object *jvm, JNIEnv *env,    struct svalue *v)   {    union anything *a;    struct generic_error_struct *gen_err; -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jvm, jvm_program); +  struct jvm_storage *j = get_storage(jvm, jvm_program);       if(!j)    return;       push_svalue (v);    SAFE_APPLY_MASTER ("describe_error", 1);   #ifdef PIKE_DEBUG    if (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING)    Pike_fatal ("Unexpected return value from destribe_error\n");   #endif
pike.git/src/modules/Java/jvm.c:2496:    case 'L':    while(*p && *p++!=';');    default:    args++;    }    if(*p) p++;    jnm->fnPtr = make_stub(&con->cpu, con, statc, *p, args+wargs+2,    flt_args, dbl_args, sig->str);   }    - static void init_natives_struct(struct object *o) + static void init_natives_struct(struct object *PIKE_UNUSED(o))   {    struct natives_storage *n = THIS_NATIVES;       n->jvm = NULL;    n->cls = NULL;    n->num_methods = 0;    n->cons = NULL;    n->jnms = NULL;   }    - static void exit_natives_struct(struct object *o) + static void exit_natives_struct(struct object *PIKE_UNUSED(o))   {    JNIEnv *env;    struct natives_storage *n = THIS_NATIVES;       if(n->jvm) {    if(n->cls) {    if((env = jvm_procure_env(n->jvm)) != NULL) {    (*env)->UnregisterNatives(env, THAT_JOBJ(n->cls)->jobj);    jvm_vacate_env(n->jvm, env);    }
pike.git/src/modules/Java/jvm.c:2540:    if(n->cons[i].sig)    free_string(n->cons[i].sig);   #ifdef EXTRA_FREE_NATIVE_CON    EXTRA_FREE_NATIVE_CON(n->cons[i]);   #endif    }    mexec_free(n->cons);    }   }    - static void natives_gc_check(struct object *o) + static void natives_gc_check(struct object *PIKE_UNUSED(o))   {    struct natives_storage *n = THIS_NATIVES;       if(n->jvm)    gc_check(n->jvm);    if(n->cls)    gc_check(n->cls);    if(n->cons) {    int i;    for(i=0; i<n->num_methods; i++)    gc_check_svalues(&n->cons[i].callback, 1);    }   }    - static void natives_gc_recurse(struct object *o) + static void natives_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct natives_storage *n = THIS_NATIVES;       if(n->jvm)    gc_recurse_object(n->jvm);    if(n->cls)    gc_recurse_object(n->cls);    if(n->cons) {    int i;    for(i=0; i<n->num_methods; i++)
pike.git/src/modules/Java/jvm.c:2579:      static void f_natives_create(INT32 args)   {    struct natives_storage *n = THIS_NATIVES;    struct jobj_storage *c;    struct object *cls;    struct array *arr;    int i, rc=-1;    JNIEnv *env;    -  get_all_args("Java.natives->create()", args, "%a%o", &arr, &cls); +  get_all_args(NULL, args, "%a%o", &arr, &cls);    -  if((c = (struct jobj_storage *)get_storage(cls, jclass_program)) == NULL) -  Pike_error("Bad argument 2 to create().\n"); +  if((c = get_storage(cls, jclass_program)) == NULL) +  SIMPLE_ARG_TYPE_ERROR("create", 2, "Java class");       if(n->num_methods)    Pike_error("create() called twice in Java.natives object.\n");       if(!arr->size) { -  pop_n_elems(args); +     return;    }       if((env = jvm_procure_env(c->jvm))) {    if (n->jnms) {    free(n->jnms);    n->jnms = NULL;    } -  n->jnms = (JNINativeMethod *) -  xalloc(arr->size * sizeof(JNINativeMethod)); +  n->jnms = xalloc(arr->size * sizeof(JNINativeMethod));       if (n->cons) {    mexec_free(n->cons);    }       if (!(n->cons = (struct native_method_context *)    mexec_alloc(arr->size * sizeof(struct native_method_context)))) { -  Pike_error("Out of memory.\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("create",0);    }       for(i=0; i<arr->size; i++) {    struct array *nm;    if(TYPEOF(ITEM(arr)[i]) != PIKE_T_ARRAY ||    ITEM(arr)[i].u.array->size != 3)    Pike_error("Bad argument 1 to create().\n");    nm = ITEM(arr)[i].u.array;    if(TYPEOF(ITEM(nm)[0]) != PIKE_T_STRING ||    TYPEOF(ITEM(nm)[1]) != PIKE_T_STRING)
pike.git/src/modules/Java/jvm.c:2635:       n->jvm = c->jvm;    n->cls = cls;    add_ref(n->jvm);    add_ref(n->cls);       rc = (*env)->RegisterNatives(env, c->jobj, n->jnms, n->num_methods);    jvm_vacate_env(c->jvm, env);    }    -  pop_n_elems(args); -  +     if(rc<0)    destruct(Pike_fp->current_object);   }      #endif /* SUPPORT_NATIVE_METHODS */      static void f_super_class(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ;    JNIEnv *env;
pike.git/src/modules/Java/jvm.c:2663:    push_int(0);   }      static void f_is_assignable_from(INT32 args)   {    struct jobj_storage *jc, *jo = THIS_JOBJ;    JNIEnv *env;    jboolean iaf;       if(args<1 || TYPEOF(Pike_sp[-args]) != PIKE_T_OBJECT || -  (jc = (struct jobj_storage *)get_storage(Pike_sp[-args].u.object, +  (jc = get_storage(Pike_sp[-args].u.object,    jclass_program))==NULL)    Pike_error("illegal argument 1 to is_assignable_from\n");       if((env = jvm_procure_env(jo->jvm))) {    iaf = (*env)->IsAssignableFrom(env, jo->jobj, jc->jobj);    jvm_vacate_env(jo->jvm, env);    } else    iaf = 0;       pop_n_elems(args);    push_int((iaf? 1:0));   }      static void f_throw_new(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ; -  struct jvm_storage *jj = -  (struct jvm_storage *)get_storage(jo->jvm, jvm_program); +  struct jvm_storage *jj = get_storage(jo->jvm, jvm_program);    JNIEnv *env;    char *cn;    -  get_all_args("throw_new", args, "%s", &cn); +  get_all_args(NULL, args, "%s", &cn);       if((env = jvm_procure_env(jo->jvm))) {       if(!(*env)->IsAssignableFrom(env, jo->jobj, jj->class_throwable)) {    jvm_vacate_env(jo->jvm, env);    Pike_error("throw_new called in a class that doesn't inherit java.lang.Throwable!\n");    }       if((*env)->ThrowNew(env, jo->jobj, cn)<0) {    jvm_vacate_env(jo->jvm, env);    Pike_error("throw_new failed!\n");    }       jvm_vacate_env(jo->jvm, env);    } -  -  pop_n_elems(args); -  push_int(0); +    }      static void f_alloc(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ;    JNIEnv *env;       pop_n_elems(args);       if((env = jvm_procure_env(jo->jvm))) {    push_java_anyobj((*env)->AllocObject(env, jo->jobj), jo->jvm, env);    jvm_vacate_env(jo->jvm, env);    } else push_int(0);   }      static void f_new_array(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ; -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(jo->jvm, jvm_program); +  struct jvm_storage *j = get_storage(jo->jvm, jvm_program);    struct object *o;    JNIEnv *env;    jvalue i;    char dorelease;    jarray a;    INT_TYPE n;       if(args==1) {    push_int(0);    args++;    }    -  get_all_args("new_array", args, "%i%O", &n, &o); +  get_all_args(NULL, args, "%i%O", &n, &o);       if((env = jvm_procure_env(jo->jvm))) {    make_jargs(&i, -1, &dorelease, "L", jo->jvm, env);    a = (*env)->NewObjectArray(env, n, jo->jobj, i.l);    pop_n_elems(args);    push_java_array(a, jo->jvm, env,    ((*env)->CallBooleanMethod(env, jo->jobj,    j->method_isarray)? '[':'L'));    free_jargs(&i, -1, &dorelease, "L", jo->jvm, env);    jvm_vacate_env(jo->jvm, env);    } else {    pop_n_elems(args);    push_int(0);    }   }      static void f_get_method(INT32 args)   {    struct object *oo;    -  check_all_args("get_method", args, BIT_STRING, BIT_STRING, 0); +  check_all_args(NULL, args, BIT_STRING, BIT_STRING, 0);       push_object(this_object());    oo=clone_object(method_program, args+1);    if(oo->prog!=NULL)    push_object(oo);    else {    free_object(oo);    push_int(0);    }   }      static void f_get_static_method(INT32 args)   {    struct object *oo;    -  check_all_args("get_static_method", args, BIT_STRING, BIT_STRING, 0); +  check_all_args(NULL, args, BIT_STRING, BIT_STRING, 0);       push_object(this_object());    oo=clone_object(static_method_program, args+1);    if(oo->prog!=NULL)    push_object(oo);    else {    free_object(oo);    push_int(0);    }   }      static void f_get_field(INT32 args)   {    struct object *oo;    -  check_all_args("get_field", args, BIT_STRING, BIT_STRING, 0); +  check_all_args(NULL, args, BIT_STRING, BIT_STRING, 0);       push_object(this_object());    oo=clone_object(field_program, args+1);    if(oo->prog!=NULL)    push_object(oo);    else {    free_object(oo);    push_int(0);    }   }      static void f_get_static_field(INT32 args)   {    struct object *oo;    -  check_all_args("get_static_field", args, BIT_STRING, BIT_STRING, 0); +  check_all_args(NULL, args, BIT_STRING, BIT_STRING, 0);       push_object(this_object());    oo=clone_object(static_field_program, args+1);    if(oo->prog!=NULL)    push_object(oo);    else {    free_object(oo);    push_int(0);    }   }      #ifdef SUPPORT_NATIVE_METHODS   static void f_register_natives(INT32 args)   {    struct object *oo; -  check_all_args("register_natives", args, BIT_ARRAY, 0); +  check_all_args(NULL, args, BIT_ARRAY, 0);    push_object(this_object());    oo=clone_object(natives_program, args+1);    if(oo->prog!=NULL)    push_object(oo);    else {    free_object(oo);    push_int(0);    }   }   #endif /* SUPPORT_NATIVE_METHODS */         /* Throwables */       - static void f_javathrow(INT32 args) + static void f_javathrow(INT32 PIKE_UNUSED(args))   {    struct jobj_storage *jo = THIS_JOBJ;    JNIEnv *env;    -  pop_n_elems(args); -  +     if((env = jvm_procure_env(jo->jvm))) {    if((*env)->Throw(env, jo->jobj)<0) {    jvm_vacate_env(jo->jvm, env);    Pike_error("throw failed!\n");    }    jvm_vacate_env(jo->jvm, env);    } -  push_int(0); +    }         /* Arrays */      static void f_javaarray_sizeof(INT32 args)   {    struct jobj_storage *jo = THIS_JOBJ;    JNIEnv *env;   
pike.git/src/modules/Java/jvm.c:2879:   }      static void javaarray_subarray(struct object *jvm, struct object *oo,    jobject jobj, int ty, INT32 e1, INT32 e2)   {    JNIEnv *env;    jobject jobj2;    jclass jocls, eltcls;    struct jvm_storage *j;    -  if((j = (struct jvm_storage *)get_storage(jvm, jvm_program))==NULL) { +  if((j = get_storage(jvm, jvm_program))==NULL) {    push_int(0);    return;    }       if((env = jvm_procure_env(jvm))) {    jsize size = (*env)->GetArrayLength(env, jobj);       if(e1<0)    e1=0;    if(e1>size)
pike.git/src/modules/Java/jvm.c:3225:    pop_n_elems(args);    push_int(0);    }   }         /* Attachment */      #ifdef _REENTRANT    - static void init_att_struct(struct object *o) + static void init_att_struct(struct object *PIKE_UNUSED(o))   {    struct att_storage *att = THIS_ATT;    att->jvm = NULL;    att->env = NULL;    clear_svalues(&att->thr, 1);   }    - static void exit_att_struct(struct object *o) + static void exit_att_struct(struct object *PIKE_UNUSED(o))   {    struct att_storage *att = THIS_ATT;       if(att->jvm) { -  struct jvm_storage *j = -  (struct jvm_storage *)get_storage(att->jvm, jvm_program); +  struct jvm_storage *j = get_storage(att->jvm, jvm_program);    if(att->env) {    THREAD_T me = th_self();    if(!th_equal(me, att->tid))    /* Hum hum. This should (hopefully) only happen at exit time    when we're destructing all objects. In this case it should be    safe just to ignore detaching, as the JVM itself will be destroyed    within moments... */    ;    else    (*j->jvm)->DetachCurrentThread(j->jvm);    }    free_object(att->jvm);    }    free_svalue(&att->thr);   }    - static void att_gc_check(struct object *o) + static void att_gc_check(struct object *PIKE_UNUSED(o))   {    struct att_storage *att = THIS_ATT;       if(att->jvm)    gc_check(att->jvm);    gc_check_svalues(&att->thr, 1);   }    - static void att_gc_recurse(struct object *o) + static void att_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct att_storage *att = THIS_ATT;       if(att->jvm)    gc_recurse_object(att->jvm);    gc_recurse_svalues(&att->thr, 1);   }      static void f_att_create(INT32 args)   {    struct object *j;    struct jvm_storage *jvm;    struct att_storage *att = THIS_ATT;    -  get_all_args("Java.attachment->create()", args, "%o", &j); +  get_all_args(NULL, args, "%o", &j);    -  if((jvm = (struct jvm_storage *)get_storage(j, jvm_program))==NULL) +  if((jvm = get_storage(j, jvm_program))==NULL)    Pike_error("Bad argument 1 to create().\n");       att->jvm = j;    j->refs++;    pop_n_elems(args);    f_this_thread(0);    assign_svalue(&att->thr, &Pike_sp[-1]);    pop_n_elems(1);    att->args.version = JNI_VERSION_1_2;    att->args.name = NULL;
pike.git/src/modules/Java/jvm.c:3305: Inside #if defined(_REENTRANT)
   att->tid = th_self();    if((*jvm->jvm)->AttachCurrentThread(jvm->jvm, (void *)&att->env, &att->args)<0)    destruct(Pike_fp->current_object);   }      #endif /* _REENTRANT */         /* Monitor */    - static void init_monitor_struct(struct object *o) + static void init_monitor_struct(struct object *PIKE_UNUSED(o))   {    struct monitor_storage *m = THIS_MONITOR;    m->obj = NULL;   }    - static void exit_monitor_struct(struct object *o) + static void exit_monitor_struct(struct object *PIKE_UNUSED(o))   {    JNIEnv *env;    struct monitor_storage *m = THIS_MONITOR;    struct jobj_storage *j;       if ((m->obj && (j=THAT_JOBJ(m->obj)))) {   #ifdef _REENTRANT    THREAD_T me = th_self();    if (!th_equal(me, m->tid))    ;
pike.git/src/modules/Java/jvm.c:3333:   #endif /* _REENTRANT */    if ((env = jvm_procure_env(j->jvm)) != NULL) {    (*env)->MonitorExit(env, j->jobj);    jvm_vacate_env(j->jvm, env);    }    }    if (m->obj)    free_object(m->obj);   }    - static void monitor_gc_check(struct object *o) + static void monitor_gc_check(struct object *PIKE_UNUSED(o))   {    struct monitor_storage *m = THIS_MONITOR;       if(m->obj)    gc_check(m->obj);   }    - static void monitor_gc_recurse(struct object *o) + static void monitor_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct monitor_storage *m = THIS_MONITOR;       if(m->obj)    gc_recurse_object(m->obj);   }      static void f_monitor_create(INT32 args)   {    struct monitor_storage *m=THIS_MONITOR;    struct object *obj;    -  get_all_args("Java.monitor->create()", args, "%o", &obj); +  get_all_args(NULL, args, "%o", &obj);       if(get_storage(obj, jobj_program) == NULL)    Pike_error("Bad argument 1 to create().\n");      #ifdef _REENTRANT    m->tid = th_self();   #endif /* _REENTRANT */       m->obj = obj;    add_ref(obj); -  pop_n_elems(args); -  return; +    }         /* JVM */         static void f_create(INT32 args)   {    struct jvm_storage *j = THIS_JVM;    char *classpath = NULL;
pike.git/src/modules/Java/jvm.c:3415: Inside #if 0
   JAVA_HOME"/lib/rt.jar:"JAVA_HOME"/lib/i18n.jar";   #endif /* JAVA_HOME */   #else    else    classpath = ".";   #endif    if(classpath != NULL)    j->classpath_string = make_shared_string(classpath);    }    if(classpath != NULL) { -  push_text("-Djava.class.path="); +  push_static_text("-Djava.class.path=");    push_string(j->classpath_string);    j->classpath_string = NULL;    f_add(2);    copy_shared_string(j->classpath_string, Pike_sp[-1].u.string);    pop_n_elems(1);    j->vm_args.options[j->vm_args.nOptions].optionString =    j->classpath_string->str;    j->vm_args.options[j->vm_args.nOptions].extraInfo = NULL;    j->vm_args.nOptions++;    }
pike.git/src/modules/Java/jvm.c:3448:    jint errcode;    void *vp; /* To avoid aliasing. */    if((errcode = JNI_CreateJavaVM(&j->jvm, &vp, &j->vm_args))) {    Pike_error("Failed to create virtual machine: %s (%d)\n",    pike_jni_error(errcode), errcode);    }    j->env = vp;    }       /* Java tries to be a wiseguy with the locale... */ - #ifdef HAVE_SETLOCALE +    #ifdef LC_NUMERIC    setlocale(LC_NUMERIC, "C");   #endif   #ifdef LC_CTYPE    setlocale(LC_CTYPE, "");   #endif   #ifdef LC_TIME    setlocale(LC_TIME, "C");   #endif   #ifdef LC_COLLATE    setlocale(LC_COLLATE, "");   #endif   #ifdef LC_MESSAGES    setlocale(LC_MESSAGES, "");   #endif - #endif +        cls = (*j->env)->FindClass(j->env, "java/lang/Object");    j->class_object = (*j->env)->NewGlobalRef(j->env, cls);    (*j->env)->DeleteLocalRef(j->env, cls);    cls = (*j->env)->FindClass(j->env, "java/lang/Class");    j->class_class = (*j->env)->NewGlobalRef(j->env, cls);    (*j->env)->DeleteLocalRef(j->env, cls);    cls = (*j->env)->FindClass(j->env, "java/lang/String");    j->class_string = (*j->env)->NewGlobalRef(j->env, cls);    (*j->env)->DeleteLocalRef(j->env, cls);
pike.git/src/modules/Java/jvm.c:3510:    "()Ljava/lang/String;");    j->method_charat =    (*j->env)->GetMethodID(j->env, j->class_string, "charAt", "(I)C");      #ifdef _REENTRANT    f_thread_local(0);    if(TYPEOF(Pike_sp[-1]) == PIKE_T_OBJECT) {    j->tl_env = Pike_sp[-1].u.object;    add_ref(j->tl_env);    } -  pop_n_elems(args+1); - #else -  pop_n_elems(args); +    #endif /* _REENTRANT */ -  push_int(0); +    }    - static void init_jvm_struct(struct object *o) + static void init_jvm_struct(struct object *PIKE_UNUSED(o))   {    struct jvm_storage *j = THIS_JVM;      #ifdef SUPPORT_NATIVE_METHODS    enable_external_threads();   #endif /* SUPPORT_NATIVE_METHODS */    j->jvm = NULL;    j->classpath_string = NULL;    j->class_object = 0;    j->class_class = 0;    j->class_string = 0;    j->class_throwable = 0;    j->class_runtimex = 0;    j->class_system = 0;   #ifdef _REENTRANT    j->tl_env = NULL;   #endif /* _REENTRANT */   }    - static void exit_jvm_struct(struct object *o) + static void exit_jvm_struct(struct object *PIKE_UNUSED(o))   {    struct jvm_storage *j = THIS_JVM;    JNIEnv *env = NULL;    void *tmpenv = NULL;       if(j->jvm != NULL && (env = jvm_procure_env(Pike_fp->current_object))) {    if(j->class_system)    (*env)->DeleteGlobalRef(env, j->class_system);    if(j->class_runtimex)    (*env)->DeleteGlobalRef(env, j->class_runtimex);
pike.git/src/modules/Java/jvm.c:3580: Inside #if defined(_REENTRANT)
  #ifdef _REENTRANT    if(j->tl_env != NULL)    free_object(j->tl_env);   #endif /* _REENTRANT */   #ifdef SUPPORT_NATIVE_METHODS    disable_external_threads();   #endif /* SUPPORT_NATIVE_METHODS */   }      #ifdef _REENTRANT - static void jvm_gc_check(struct object *o) + static void jvm_gc_check(struct object *PIKE_UNUSED(o))   {    struct jvm_storage *j = THIS_JVM;       if(j->tl_env)    gc_check(j->tl_env);   }    - static void jvm_gc_recurse(struct object *o) + static void jvm_gc_recurse(struct object *PIKE_UNUSED(o))   {    struct jvm_storage *j = THIS_JVM;       if(j->tl_env)    gc_recurse_object(j->tl_env);   }   #endif /* _REENTRANT */         static void f_get_version(INT32 args)
pike.git/src/modules/Java/jvm.c:3615:    } else    push_int(0);   }      static void f_find_class(INT32 args)   {    JNIEnv *env;    char *cn;    jclass c;    -  get_all_args("find_class", args, "%s", &cn); +  get_all_args(NULL, args, "%s", &cn);    if((env = jvm_procure_env(Pike_fp->current_object))) {    c = (*env)->FindClass(env, cn);    pop_n_elems(args);    push_java_class(c, Pike_fp->current_object, env);    jvm_vacate_env(Pike_fp->current_object, env);    } else {    pop_n_elems(args);    push_int(0);    }   }      static void f_define_class(INT32 args)   {    JNIEnv *env;    struct object *obj;    struct pike_string *str;    struct jobj_storage *ldr;    char *name;    jclass c;    -  get_all_args("define_class", args, "%s%o%S", &name, &obj, &str); +  get_all_args(NULL, args, "%s%o%S", &name, &obj, &str);    if((ldr = THAT_JOBJ(obj))==NULL)    Pike_error("Bad argument 2 to define_class().\n");    if((env = jvm_procure_env(Pike_fp->current_object))) {    c = (*env)->DefineClass(env, name, ldr->jobj, (jbyte*)str->str, str->len);    pop_n_elems(args);    push_java_class(c, Pike_fp->current_object, env);    jvm_vacate_env(Pike_fp->current_object, env);    } else {    pop_n_elems(args);    push_int(0);
pike.git/src/modules/Java/jvm.c:3675:       pop_n_elems(args);    if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_throwable((*env)->ExceptionOccurred(env),    Pike_fp->current_object, env);    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }    - static void f_exception_describe(INT32 args) + static void f_exception_describe(INT32 PIKE_UNUSED(args))   {    JNIEnv *env;    -  pop_n_elems(args); +     if((env = jvm_procure_env(Pike_fp->current_object))) {    (*env)->ExceptionDescribe(env);    jvm_vacate_env(Pike_fp->current_object, env);    } -  push_int(0); +    }      static void f_exception_clear(INT32 args)   {    JNIEnv *env;       pop_n_elems(args);    if((env = jvm_procure_env(Pike_fp->current_object))) {    (*env)->ExceptionClear(env);    jvm_vacate_env(Pike_fp->current_object, env);    }    push_int(0);   }      static void f_javafatal(INT32 args)   {    JNIEnv *env;    char *msg;    -  get_all_args("fatal", args, "%s", &msg); +  get_all_args(NULL, args, "%s", &msg);    if((env = jvm_procure_env(Pike_fp->current_object))) {    (*env)->FatalError(env, msg);    jvm_vacate_env(Pike_fp->current_object, env);    } -  pop_n_elems(args); -  push_int(0); +    }      static void f_new_boolean_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_boolean_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewBooleanArray(env, n), Pike_fp->current_object,    env, 'Z');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_byte_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_byte_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewByteArray(env, n), Pike_fp->current_object,    env, 'B');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_char_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_char_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewCharArray(env, n), Pike_fp->current_object,    env, 'C');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_short_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_short_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewShortArray(env, n), Pike_fp->current_object,    env, 'S');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_int_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_int_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewIntArray(env, n), Pike_fp->current_object,    env, 'I');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_long_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_long_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewLongArray(env, n), Pike_fp->current_object,    env, 'J');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_float_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_float_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewFloatArray(env, n), Pike_fp->current_object,    env, 'F');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      static void f_new_double_array(INT32 args)   {    JNIEnv *env;    INT_TYPE n;    -  get_all_args("new_double_array", args, "%i", &n); +  get_all_args(NULL, args, "%i", &n);    pop_n_elems(args);       if((env = jvm_procure_env(Pike_fp->current_object))) {    push_java_array((*env)->NewDoubleArray(env, n), Pike_fp->current_object,    env, 'D');    jvm_vacate_env(Pike_fp->current_object, env);    } else    push_int(0);   }      #endif /* HAVE_JAVA */      PIKE_MODULE_INIT   {   #ifdef HAVE_JAVA    struct svalue prog; -  + #ifdef HAVE_GC_PROC_BUF_SIZE +  extern size_t GC_proc_buf_size; + #endif      #ifdef __NT__    switch(open_nt_dll()) {    case 0: break;    case -1:    yywarning("Failed to load JVM.\n");    return;    case -2:    yywarning("Failed to create JVM.\n");    return;
pike.git/src/modules/Java/jvm.c:3874: Inside #if defined(HAVE_JAVA)
   SET_SVAL_SUBTYPE(prog, 0);      #ifdef HAVE_IBMFINDDLL    {    /* Debug... */    extern char *ibmFindDLL(void);    fprintf(stderr, "ibmFindDLL(): \"%s\"\n", ibmFindDLL());    }   #endif    + #ifdef HAVE_GC_PROC_BUF_SIZE +  if (GC_proc_buf_size < 16384) { +  /* Attempt to make Boem-gc in gcj happy. */ +  GC_proc_buf_size = 16384; +  } + #endif +     /* Restore any signal handlers that may have been zapped    * when the jvm was loaded.    */    low_init_signals();       start_new_program();    ADD_STORAGE(struct jobj_storage);    ADD_FUNCTION("cast", f_jobj_cast, tFunc(tStr,tMix), 0);    ADD_FUNCTION("`==", f_jobj_eq, tFunc(tMix,tInt01), 0);    ADD_FUNCTION("__hash", f_jobj_hash, tFunc(tNone,tInt), 0);