[go: up one dir, main page]

File: util.h

package info (click to toggle)
sablevm 1.11.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,980 kB
  • ctags: 7,922
  • sloc: ansic: 116,013; sh: 8,679; makefile: 489
file content (85 lines) | stat: -rw-r--r-- 3,132 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This source file is part of SableVM.                            *
 *                                                                 *
 * See the file "LICENSE" for the copyright information and for    *
 * the terms and conditions for copying, distribution and          *
 * modification of this source file.                               *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef SVM_UTIL_H
#define SVM_UTIL_H

#define _svmm_global_copy_jobject(env,src,dest) \
_svmh_global_copy_jobject (env, src, &dest)

#define _svmm_zero_memory(var) \
memset(&var, 0, sizeof(var))

#define _svmm_set_flag(value,flag) \
_svmh_set_flag(&value, flag)

#define _svmm_clear_flag(value,flag) \
_svmh_clear_flag(&value, flag)

#define _svmm_validate_min_max_increment(min,max,incr) \
_svmh_validate_min_max_increment (&min, &max, &incr)

#define CANNOT_DREF(structure) (*(structure) == NULL)
#define CAN_DREF(structure) (*(structure) != NULL)
#define DREF(structure,member) ((*(structure))->member)

#define _svmm_new_native_global_array(env, arrayref) \
_svmh_new_native_global_array (env, &arrayref)

#define _svmm_free_native_global_array(env, arrayref) \
_svmh_free_native_global_array (env, &arrayref)

#define _svmm_new_native_local_array(env, arrayref) \
_svmh_new_native_local_array (env, &arrayref)

#define _svmm_free_native_local_array(env, arrayref) \
_svmh_free_native_local_array (env, &arrayref)

#define _svmm_local_wrap_pointer(env, pointer, wrapper) \
_svmh_local_wrap_pointer (env, pointer, &wrapper)

#endif /* NOT SVM_UTIL_H */

#ifdef COMMENT

#define SVM_SET_ARRAY_REFERENCE_ELEMENT(Env,Instance,Index,Value)					\
{													\
  _svmt_array_instance *_array_ = (_svmt_array_instance *) (Instance);					\
  _svmt_array_info *_array_info_ = (_svmt_array_info *) (_array_->vtable->type);			\
  jint _dimensions_ = _array_info_->dimensions;								\
  _svmt_object_instance *_value_ = (_svmt_object_instance *) (Value);					\
													\
  if (_value_ != NULL)											\
    {													\
      if (_dimensions_ == 1)										\
	{												\
	  if (!_svmf_instanceof ((Env), _value_, (_svmt_type_info *) (_array_info_->base_class)))	\
	    {												\
	      goto arraystoreexception;									\
	    }												\
	}												\
      else if (!_svmf_instanceof ((Env), _value_, (_svmt_type_info *) (_array_info_->array_element)))	\
	{												\
	  goto arraystoreexception;									\
	}												\
    }													\
													\
  ((_svmt_object_instance **) (Instance))[- _array_->size + (Index)] = (Value);				\
  WRITE_CARD (((_svmt_object_instance **) (Instance))[- _array_->size + (Index)], ((Env)->vm));		\
}

char *_svmf_current_working_directory (void);
jboolean _svmf_have_same_runtime_package (_svmt_type_info *type1,
					  _svmt_type_info *type2);
jint _svmf_max_jint (jint value1, jint value2);

void _svmf_debug_print_stack_trace (_svmt_JNIEnv *env);
jboolean _svmf_instanceof (_svmt_JNIEnv *env, _svmt_object_instance *obj,
			   _svmt_type_info *type);

#endif /* COMMENT */