java-cpool.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // java-cpool.h - Constant pool parsing header. -*- c++ -*-
  2. /* Copyright (C) 1999, 2000 Free Software Foundation
  3. This file is part of libgcj.
  4. This software is copyrighted work licensed under the terms of the
  5. Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
  6. details. */
  7. #ifndef __JAVA_CPOOL_H__
  8. #define __JAVA_CPOOL_H__
  9. #include <gcj/javaprims.h>
  10. // we rename these, to avoid polluting the name space
  11. #define JV_CONSTANT_Undefined (0L)
  12. #define JV_CONSTANT_Utf8 (1L)
  13. #define JV_CONSTANT_Unicode (2L)
  14. #define JV_CONSTANT_Integer (3L)
  15. #define JV_CONSTANT_Float (4L)
  16. #define JV_CONSTANT_Long (5L)
  17. #define JV_CONSTANT_Double (6L)
  18. #define JV_CONSTANT_Class (7L)
  19. #define JV_CONSTANT_String (8L)
  20. #define JV_CONSTANT_Fieldref (9L)
  21. #define JV_CONSTANT_Methodref (10L)
  22. #define JV_CONSTANT_InterfaceMethodref (11L)
  23. #define JV_CONSTANT_NameAndType (12L)
  24. #define JV_CONSTANT_ResolvedFlag (16L)
  25. #define JV_CONSTANT_LazyFlag (32L)
  26. #define JV_CONSTANT_ResolvedString (16L | 8L)
  27. #define JV_CONSTANT_ResolvedClass (16L | 7L)
  28. extern inline void
  29. _Jv_storeIndexes (_Jv_word *data,
  30. _Jv_ushort index0,
  31. _Jv_ushort index1)
  32. {
  33. data->i = (((jint)index0) << 16) | (jint) index1;
  34. }
  35. extern inline void
  36. _Jv_loadIndexes (const _Jv_word *data,
  37. _Jv_ushort& index0,
  38. _Jv_ushort& index1)
  39. {
  40. jint udata = data->i;
  41. _Jv_uint uindex0 = ((udata >> 16) & 0xffff);
  42. _Jv_uint uindex1 = udata & 0xffff;
  43. index0 = uindex0;
  44. index1 = uindex1;
  45. }
  46. extern inline void
  47. _Jv_storeFloat (_Jv_word *data, jfloat f)
  48. {
  49. data->f = f;
  50. }
  51. extern inline jfloat
  52. _Jv_loadFloat (_Jv_word *data)
  53. {
  54. return data->f;
  55. }
  56. extern inline void
  57. _Jv_storeInt (_Jv_word *data, jint i)
  58. {
  59. data->i = i;
  60. }
  61. extern inline jint
  62. _Jv_loadInt (_Jv_word *data)
  63. {
  64. return data->i;
  65. }
  66. extern inline void
  67. _Jv_storeLong (_Jv_word *data, jlong l)
  68. {
  69. #if SIZEOF_VOID_P == 8
  70. data[0].l = l;
  71. #else
  72. _Jv_word2 tmp;
  73. tmp.l = l;
  74. data[0].ia[0] = tmp.ia[0];
  75. data[1].ia[0] = tmp.ia[1];
  76. #endif
  77. }
  78. extern inline jlong
  79. _Jv_loadLong (_Jv_word *data)
  80. {
  81. #if SIZEOF_VOID_P == 8
  82. return data -> l;
  83. #else
  84. _Jv_word2 tmp;
  85. tmp.ia[0] = data[0].ia[0];
  86. tmp.ia[1] = data[1].ia[0];
  87. return tmp.l;
  88. #endif
  89. }
  90. extern inline void
  91. _Jv_storeDouble (_Jv_word *data, jdouble d)
  92. {
  93. #if SIZEOF_VOID_P == 8
  94. data[0].d = d;
  95. #else
  96. _Jv_word2 tmp;
  97. tmp.d = d;
  98. data[0].ia[0] = tmp.ia[0];
  99. data[1].ia[0] = tmp.ia[1];
  100. #endif
  101. }
  102. extern inline jdouble
  103. _Jv_loadDouble (_Jv_word *data)
  104. {
  105. #if SIZEOF_VOID_P == 8
  106. return data -> d;
  107. #else
  108. _Jv_word2 tmp;
  109. tmp.ia[0] = data[0].ia[0];
  110. tmp.ia[1] = data[1].ia[0];
  111. return tmp.d;
  112. #endif
  113. }
  114. #endif /* __JAVA_CPOOL_H__ */