CACAO
linker.cpp
Go to the documentation of this file.
1 /* src/vm/linker.cpp - class linker functions
2 
3  Copyright (C) 1996-2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23 */
24 
25 
26 #include "vm/linker.hpp"
27 #include "config.h"
28 
29 #include <cassert>
30 #include <vector>
31 #include <utility>
32 
33 #include "mm/memory.hpp"
34 
35 #include "native/native.hpp"
36 
37 #include "threads/lock.hpp"
38 #include "threads/mutex.hpp"
39 
40 #include "toolbox/logging.hpp"
41 
42 #include "vm/access.hpp"
43 #include "vm/array.hpp"
44 #include "vm/class.hpp"
45 #include "vm/classcache.hpp"
46 #include "vm/descriptor.hpp"
47 #include "vm/exceptions.hpp"
48 #include "vm/field.hpp"
49 #include "vm/globals.hpp"
50 #include "vm/hook.hpp"
51 #include "vm/loader.hpp"
52 #include "vm/options.hpp"
53 #include "vm/primitive.hpp"
54 #include "vm/rt-timing.hpp"
55 #include "vm/string.hpp"
56 #include "vm/types.hpp"
57 #include "vm/vm.hpp"
58 
59 #include "vm/jit/asmpart.hpp"
60 #include "vm/jit/jit.hpp"
61 #include "vm/jit/stubs.hpp"
62 
63 using namespace cacao;
64 
65 
66 STAT_DECLARE_VAR(int,count_vftbl_len,0)
67 
68 
69 /* debugging macros ***********************************************************/
70 
71 #if !defined(NDEBUG)
72 # define TRACELINKCLASS(c) \
73  do { \
74  if (opt_TraceLinkClass) { \
75  log_start(); \
76  log_print("[Linking "); \
77  class_print((c)); \
78  log_print("]"); \
79  log_finish(); \
80  } \
81  } while (0)
82 #else
83 # define TRACELINKCLASS(c)
84 #endif
85 
86 
87 /* #include "vm/resolve.hpp" */
88 /* copied prototype to avoid bootstrapping problem: */
90 
91 #include "vm/statistics.hpp"
92 
93 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
94 #define INLINELOG(code) do { if (opt_TraceInlining) { code } } while (0)
95 #else
96 #define INLINELOG(code)
97 #endif
98 
99 
100 /* global variables ***********************************************************/
101 
102 static s4 interfaceindex; /* sequential numbering of interfaces */
103 static s4 classvalue;
104 
105 #if !USES_NEW_SUBTYPE
107 #endif
108 
109 /* private functions **********************************************************/
110 
113 #if !USES_NEW_SUBTYPE
114 static void linker_compute_class_values(classinfo *c);
115 #endif
116 static void linker_compute_subclasses(classinfo *c);
117 static bool linker_addinterface(classinfo *c, classinfo *ic);
119 
120 
121 typedef std::vector<std::pair<java_object_t**, Utf8String> > deferred_strings_vec_t;
123 
124 /* linker_init *****************************************************************
125 
126  Initializes the linker subsystem and links classes required for the
127  primitive table.
128 
129 *******************************************************************************/
130 
131 void linker_preinit(void)
132 {
133  TRACESUBSYSTEMINITIALIZATION("linker_preinit");
134 
135  /* Reset interface index. */
136 
137  interfaceindex = 0;
138 
139 #if !USES_NEW_SUBTYPE
140  /* create the global mutex */
141 
143 #endif
144 
145  /* Link the most basic classes. */
146 
148  vm_abort("linker_preinit: linking java/lang/Object failed");
149 
150 #if defined(ENABLE_JAVASE)
152  vm_abort("linker_preinit: linking java/lang/Cloneable failed");
153 
155  vm_abort("linker_preinit: linking java/io/Serializable failed");
156 #endif
157 }
158 
159 
160 /* linker_init *****************************************************************
161 
162  Links all classes required in the VM.
163 
164 *******************************************************************************/
165 
166 void linker_init(void)
167 {
168  TRACESUBSYSTEMINITIALIZATION("linker_init");
169 
170  /* Link java.lang.Class as first class of the system, because we
171  need it's vftbl for all other classes so we can use a class as
172  object. */
173 
175  vm_abort("linker_init: linking java/lang/Class failed");
176 
177  /* Now set the header.vftbl of all classes which were created
178  before java.lang.Class was linked. */
179 
181 
182  /* Link primitive-type wrapping classes. */
183 
184 #if defined(ENABLE_JAVASE)
186  vm_abort("linker_init: linking failed");
187 #endif
188 
190  vm_abort("linker_init: linking failed");
191 
193  vm_abort("linker_init: linking failed");
194 
196  vm_abort("linker_init: linking failed");
197 
199  vm_abort("linker_init: linking failed");
200 
202  vm_abort("linker_init: linking failed");
203 
205  vm_abort("linker_init: linking failed");
206 
208  vm_abort("linker_init: linking failed");
209 
211  vm_abort("linker_init: linking failed");
212 
213  /* Link important system classes. */
214 
216  vm_abort("linker_init: linking java/lang/String failed");
217 
218 #if defined(ENABLE_JAVASE)
220  vm_abort("linker_init: linking failed");
221 
223  vm_abort("linker_init: linking failed");
224 #endif
225 
227  vm_abort("linker_init: linking failed");
228 
230  vm_abort("linker_init: linking failed");
231 
232 #if defined(ENABLE_JAVASE)
234  vm_abort("linker_init: linking failed");
235 #endif
236 
238  vm_abort("linker_init: linking failed");
239 
240 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
242  vm_abort("linker_init: linking failed");
243 
245  vm_abort("linker_init: linking failed");
246 
248  vm_abort("linker_init: linking failed");
249 #endif
250 
251  /* Important system exceptions. */
252 
254  vm_abort("linker_init: linking failed");
255 
257  vm_abort("linker_init: linking failed");
258 
260  vm_abort("linker_init: linking failed");
261 
262  /* some classes which may be used more often */
263 
264 #if defined(ENABLE_JAVASE)
266  vm_abort("linker_init: linking failed");
267 
269  vm_abort("linker_init: linking failed");
270 
272  vm_abort("linker_init: linking failed");
273 
275  vm_abort("linker_init: linking failed");
276 
277 # if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
279  vm_abort("linker_init: linking failed");
280 
282  vm_abort("linker_init: linking failed");
283 
285  vm_abort("linker_init: linking failed");
286 # endif
287 
289  vm_abort("linker_init: linking failed");
290 
292  vm_abort("linker_init: linking failed");
293 
295  vm_abort("linker_init: linking failed");
296 
297 # if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
298  if (!link_class(class_sun_misc_Signal))
299  vm_abort("linker_init: linking failed");
300 
301  if (!link_class(class_sun_reflect_MagicAccessorImpl))
302  vm_abort("linker_init: linking failed");
303 
304  if (!link_class(class_sun_reflect_MethodAccessorImpl))
305  vm_abort("linker_init: linking failed");
306 
307  if (!link_class(class_sun_reflect_ConstructorAccessorImpl))
308  vm_abort("linker_init: linking failed");
309 # endif
310 
312  vm_abort("linker_init: linking failed");
313 #endif
314 
315 
316  /* create pseudo classes used by the typechecker */
317 
318  /* pseudo class for Arraystubs (extends java.lang.Object) */
319 
324 
325 #if defined(ENABLE_JAVASE)
326 
331 
332 #elif defined(ENABLE_JAVAME_CLDC1_1)
333 
336 
337 #else
338 # error unknown Java configuration
339 #endif
340 
342  vm_abort("linker_init: could not cache pseudo_class_Arraystub");
343 
345  vm_abort("linker_init: linking pseudo_class_Arraystub failed");
346 
347  /* pseudo class representing the null type */
348 
352 
354  vm_abort("linker_init: could not cache pseudo_class_Null");
355 
357  vm_abort("linker_init: linking failed");
358 
359  /* pseudo class representing new uninitialized objects */
360 
363  pseudo_class_New->state |= CLASS_LINKED; /* XXX is this allright? */
365 
367  vm_abort("linker_init: could not cache pseudo_class_New");
368 }
369 
370 
371 /* link_class ******************************************************************
372 
373  Wrapper function for link_class_intern to ease monitor enter/exit
374  and exception handling.
375 
376 *******************************************************************************/
377 
379 {
380  classinfo *r;
381 
382  if (c == NULL) {
384  return 0;
385  }
386 
388 
389  /* Maybe the class is currently linking or is already linked.*/
390 
391  if ((c->state & CLASS_LINKING) || (c->state & CLASS_LINKED)) {
393 
394  return c;
395  }
396 
397 #if defined(ENABLE_STATISTICS)
398  /* measure time */
399 
400  if (opt_getcompilingtime)
402 
403  if (opt_getloadingtime)
405 #endif
406 
407  /* call the internal function */
408 
409  r = link_class_intern(c);
410 
411  /* If return value is NULL, we had a problem and the class is not
412  linked. */
413 
414  if (r == NULL)
415  c->state &= ~CLASS_LINKING;
416 
417 #if defined(ENABLE_STATISTICS)
418  /* measure time */
419 
420  if (opt_getloadingtime)
422 
423  if (opt_getcompilingtime)
425 #endif
426 
428 
429 
430  // Hook point just after a class was linked.
431  if (!Hook::class_linked(r))
432  return 0;
433 
434  return r;
435 }
436 
437 
438 /* linker_overwrite_method *****************************************************
439 
440  Overwrite a method with another one, update method flags and check
441  assumptions.
442 
443  IN:
444  mg................the general method being overwritten
445  ms................the overwriting (more specialized) method
446  wl................worklist where to add invalidated methods
447 
448  RETURN VALUE:
449  true..............everything ok
450  false.............an exception has been thrown
451 
452 *******************************************************************************/
453 
455  methodinfo *ms,
456  method_worklist **wl)
457 {
458  /* overriding a final method is illegal */
459 
460  if (mg->flags & ACC_FINAL) {
461  exceptions_throw_verifyerror(mg, "Overriding final method");
462  return false;
463  }
464 
465  /* method ms overwrites method mg */
466 
467 #if defined(ENABLE_VERIFIER)
468  /* Add loading constraints (for the more general types of method mg). */
469  /* Not for <init>, as it is not invoked virtually. */
470 
471  if ((ms->name != utf8::init)
473  ms->clazz->classloader, mg->clazz->classloader, mg))
474  {
475  return false;
476  }
477 #endif
478 
479  /* inherit the vftbl index, and record the overwriting */
480 
481  ms->vftblindex = mg->vftblindex;
482  ms->overwrites = mg;
483 
484  /* update flags and check assumptions */
485  /* <init> methods are a special case, as they are never dispatched dynamically */
486 
487  if ((ms->flags & ACC_METHOD_IMPLEMENTED) && ms->name != utf8::init) {
488  do {
489 
490 #if defined(ENABLE_TLH)
491  if (mg->flags & ACC_METHOD_MONOMORPHY_USED) {
492  printf("%s/%s is evil! the sinner is %s/%s\n",
493  mg->clazz->name.begin(),
494  mg->name.begin(),
495  ms->clazz->name.begin(),
496  ms->name.begin());
498  }
499 #endif
500 
501  if (mg->flags & ACC_METHOD_IMPLEMENTED) {
502  /* this adds another implementation */
503 
505 
506  INLINELOG( printf("becomes polymorphic: "); method_println(mg); );
507 
509  }
510  else {
511  /* this is the first implementation */
512 
514 
515  INLINELOG( printf("becomes implemented: "); method_println(mg); );
516  }
517 
518  ms = mg;
519  mg = mg->overwrites;
520  } while (mg != NULL);
521  }
522 
523  return true;
524 }
525 
526 
527 #if USES_NEW_SUBTYPE
528 /* build_display ***************************************************************
529 
530  Builds the entire display for a class. This entails filling the fixed part
531  as well as allocating and initializing the overflow part.
532 
533  See Cliff Click and John Rose: Fast subtype checking in the Hotspot JVM.
534 
535 *******************************************************************************/
536 
537 static classinfo *build_display(classinfo *c)
538 {
539  int depth, i;
540  int depth_fixed;
541  classinfo *super;
542 
543  do {
544  /* Handle arrays. */
545  if (c->vftbl->arraydesc) {
547  if (a->elementvftbl && a->elementvftbl->clazz->super) {
548  classinfo *cls = a->elementvftbl->clazz->super;
549  int n;
550  for (n=0; n<a->dimension; n++)
551  cls = class_array_of(cls, true);
552  super = cls;
553  break;
554  }
555  if (a->componentvftbl && a->elementvftbl) {
556  super = a->componentvftbl->clazz;
557  break;
558  }
559  }
560  /* Normal classes. */
561  super = c->super;
562  } while (false);
563  if (super) {
564  if (!link_class(super))
565  return NULL;
566  depth = super->vftbl->subtype_depth + 1;
567  } else
568  /* java.lang.Object doesn't have a super class. */
569  depth = 0;
570 
571  /* Now copy super's display, append c->vftbl and initialize the remaining fields. */
572  if (depth >= DISPLAY_SIZE) {
573  c->vftbl->subtype_overflow = MNEW(vftbl_t *, depth - DISPLAY_SIZE + 1);
574  STATISTICS(count_vftbl_len += sizeof(vftbl_t*) * (depth - DISPLAY_SIZE + 1));
575  memcpy(c->vftbl->subtype_overflow, super->vftbl->subtype_overflow, sizeof(vftbl_t*) * (depth - DISPLAY_SIZE));
576  c->vftbl->subtype_overflow[depth - DISPLAY_SIZE] = c->vftbl;
577  depth_fixed = DISPLAY_SIZE;
578  }
579  else {
580  depth_fixed = depth;
581  c->vftbl->subtype_display[depth] = c->vftbl;
582  }
583 
584  if (super)
585  memcpy(c->vftbl->subtype_display, super->vftbl->subtype_display, sizeof(vftbl_t*) * depth_fixed);
586  for (i=depth_fixed+1; i<=DISPLAY_SIZE; i++)
587  c->vftbl->subtype_display[i] = NULL;
588  c->vftbl->subtype_offset = OFFSET(vftbl_t, subtype_display[0]) + sizeof(vftbl_t*) * depth_fixed;
589  c->vftbl->subtype_depth = depth;
590 
591  return c;
592 }
593 #endif
594 
595 // register linker real-time group
596 RT_REGISTER_GROUP(linker_group,"link","linker")
597 
598 // register real-time timers
599 RT_REGISTER_GROUP_TIMER(resolving_timer, "link", "resolve superclass/superinterfaces",linker_group)
600 RT_REGISTER_GROUP_TIMER(compute_vftbl_timer, "link", "compute vftbl length",linker_group)
601 RT_REGISTER_GROUP_TIMER(abstract_timer, "link", "handle abstract methods",linker_group)
602 RT_REGISTER_GROUP_TIMER(compute_iftbl_timer, "link", "compute interface table",linker_group)
603 RT_REGISTER_GROUP_TIMER(fill_vftbl_timer, "link", "fill vftbl",linker_group)
604 RT_REGISTER_GROUP_TIMER(offsets_timer, "link", "set offsets",linker_group)
605 RT_REGISTER_GROUP_TIMER(fill_iftbl_timer, "link", "fill interface table",linker_group)
606 RT_REGISTER_GROUP_TIMER(finalizer_timer, "link", "set finalizer",linker_group)
607 //RT_REGISTER_GROUP_TIMER(checks_timer, "link", "resolve exception classes",linker_group)
608 RT_REGISTER_GROUP_TIMER(subclasses_timer, "link", "re-calculate subclass indices",linker_group)
609 
610 /* link_class_intern ***********************************************************
611 
612  Tries to link a class. The function calculates the length in bytes
613  that an instance of this class requires as well as the VTBL for
614  methods and interface methods.
615 
616 *******************************************************************************/
617 
619 {
620  classinfo *super; /* super class */
621  classinfo *tc; /* temporary class variable */
622  s4 supervftbllength; /* vftbllegnth of super class */
623  s4 vftbllength; /* vftbllength of current class */
624  s4 interfacetablelength; /* interface table length */
625  vftbl_t *v; /* vftbl of current class */
626  s4 i; /* interface/method/field counter */
627  arraydescriptor *arraydesc; /* descriptor for array classes */
628  method_worklist *worklist; /* worklist for recompilation */
629 
630  RT_TIMER_START(resolving_timer);
631 
632  TRACELINKCLASS(c);
633 
634  /* the class must be loaded */
635 
636  /* XXX should this be a specific exception? */
637  assert(c->state & CLASS_LOADED);
638 
639  /* This is check in link_class. */
640 
641  assert(!(c->state & CLASS_LINKED));
642 
643  /* cache the self-reference of this class */
644  /* we do this for cases where the defining loader of the class */
645  /* has not yet been recorded as an initiating loader for the class */
646  /* this is needed so subsequent code can assume that self-refs */
647  /* will always resolve lazily */
648  /* No need to do it for the bootloader - it is always registered */
649  /* as initiating loader for the classes it loads. */
650  if (c->classloader)
651  classcache_store(c->classloader,c,false);
652 
653  /* this class is currently linking */
654 
655  c->state |= CLASS_LINKING;
656 
657  arraydesc = NULL;
658  worklist = NULL;
659 
660  /* Link the super interfaces. */
661 
662  for (i = 0; i < c->interfacescount; i++) {
663  tc = c->interfaces[i];
664 
665  if (!(tc->state & CLASS_LINKED))
666  if (!link_class(tc))
667  return NULL;
668  }
669 
670  /* check super class */
671 
672  super = NULL;
673 
674  /* Check for java/lang/Object. */
675 
676  if (c->super == NULL) {
677  c->index = 0;
678  c->instancesize = sizeof(java_object_t);
679 
680  vftbllength = supervftbllength = 0;
681 
682  c->finalizer = NULL;
683  }
684  else {
685  /* Get super class. */
686 
687  super = c->super;
688 
689  /* Link the super class if necessary. */
690 
691  if (!(super->state & CLASS_LINKED))
692  if (!link_class(super))
693  return NULL;
694 
695  /* OR the ACC_CLASS_HAS_POINTERS and the ACC_CLASS_REFERENCE_*
696  flags. */
697 
698  c->flags |= (super->flags &
700 
701  /* handle array classes */
702 
703  if (c->name[0] == '[')
704  if (!(arraydesc = link_array(c)))
705  return NULL;
706 
707  if (c->flags & ACC_INTERFACE)
708  c->index = interfaceindex++;
709  else
710  c->index = super->index + 1;
711 
712  c->instancesize = super->instancesize;
713 
714  vftbllength = supervftbllength = super->vftbl->vftbllength;
715 
716  c->finalizer = super->finalizer;
717  }
718  RT_TIMER_STOPSTART(resolving_timer,compute_vftbl_timer);
719 
720 
721  /* compute vftbl length */
722 
723  for (i = 0; i < c->methodscount; i++) {
724  methodinfo *m = &(c->methods[i]);
725 
726  if (!(m->flags & ACC_STATIC)) { /* is instance method */
727  tc = super;
728 
729  while (tc) {
730  s4 j;
731 
732  for (j = 0; j < tc->methodscount; j++) {
733  if (method_canoverwrite(m, &(tc->methods[j]))) {
734  if (tc->methods[j].flags & ACC_PRIVATE)
735  goto notfoundvftblindex;
736 
737  /* package-private methods in other packages */
738  /* must not be overridden */
739  /* (see Java Language Specification 8.4.8.1) */
740  if ( !(tc->methods[j].flags & (ACC_PUBLIC | ACC_PROTECTED))
741  && !SAME_PACKAGE(c,tc) )
742  {
743  goto notfoundvftblindex;
744  }
745 
746  if (!linker_overwrite_method(&(tc->methods[j]), m, &worklist))
747  return NULL;
748 
749  goto foundvftblindex;
750  }
751  }
752 
753  tc = tc->super;
754  }
755 
756  notfoundvftblindex:
757  m->vftblindex = (vftbllength++);
758  foundvftblindex:
759  ;
760  }
761  }
762  RT_TIMER_STOPSTART(compute_vftbl_timer,abstract_timer);
763 
764 
765  /* Check all interfaces of an abstract class (maybe be an
766  interface too) for unimplemented methods. Such methods are
767  called miranda-methods and are marked with the ACC_MIRANDA
768  flag. VMClass.getDeclaredMethods does not return such
769  methods. */
770 
771  if (c->flags & ACC_ABSTRACT) {
772  classinfo *ic;
773  methodinfo *im;
774  s4 abstractmethodscount;
775  s4 j;
776  s4 k;
777 
778  abstractmethodscount = 0;
779 
780  /* check all interfaces of the abstract class */
781 
782  for (i = 0; i < c->interfacescount; i++) {
783  ic = c->interfaces[i];
784 
785  for (j = 0; j < ic->methodscount; j++) {
786  im = &(ic->methods[j]);
787 
788  /* skip `<clinit>' and `<init>' */
789 
790  if ((im->name == utf8::clinit) || (im->name == utf8::init))
791  continue;
792 
793  for (tc = c; tc != NULL; tc = tc->super) {
794  for (k = 0; k < tc->methodscount; k++) {
795  if (method_canoverwrite(im, &(tc->methods[k])))
796  goto noabstractmethod;
797  }
798  }
799 
800  abstractmethodscount++;
801 
802  noabstractmethod:
803  ;
804  }
805  }
806 
807  if (abstractmethodscount > 0) {
808  methodinfo *am;
809 
810  /* reallocate methods memory */
811 
812  c->methods = (methodinfo*) MREALLOC(c->methods, methodinfo, c->methodscount,
813  c->methodscount + abstractmethodscount);
814 
815  for (i = 0; i < c->interfacescount; i++) {
816  ic = c->interfaces[i];
817 
818  for (j = 0; j < ic->methodscount; j++) {
819  im = &(ic->methods[j]);
820 
821  /* skip `<clinit>' and `<init>' */
822 
823  if ((im->name == utf8::clinit) || (im->name == utf8::init))
824  continue;
825 
826  for (tc = c; tc != NULL; tc = tc->super) {
827  for (k = 0; k < tc->methodscount; k++) {
828  if (method_canoverwrite(im, &(tc->methods[k])))
829  goto noabstractmethod2;
830  }
831  }
832 
833  /* Copy the method found into the new c->methods
834  array and tag it as miranda-method. */
835 
836  am = &(c->methods[c->methodscount]);
837  c->methodscount++;
838 
839  MCOPY(am, im, methodinfo, 1);
840 
841  am->vftblindex = (vftbllength++);
842  am->clazz = c;
843  am->flags |= ACC_MIRANDA;
844 
845  noabstractmethod2:
846  ;
847  }
848  }
849  }
850  }
851  RT_TIMER_STOPSTART(abstract_timer,compute_iftbl_timer);
852 
853 
854  STATISTICS(count_vftbl_len +=
855  sizeof(vftbl_t) + (sizeof(methodptr) * (vftbllength - 1)));
856 
857  /* compute interfacetable length */
858 
859  interfacetablelength = 0;
860 
861  for (tc = c; tc != NULL; tc = tc->super) {
862  for (i = 0; i < tc->interfacescount; i++) {
863  s4 h = class_highestinterface(tc->interfaces[i]) + 1;
864 
865  if (h > interfacetablelength)
866  interfacetablelength = h;
867  }
868  }
869  RT_TIMER_STOPSTART(compute_iftbl_timer,fill_vftbl_timer);
870 
871  /* allocate virtual function table */
872 
873  v = (vftbl_t *) mem_alloc(sizeof(vftbl_t) +
874  sizeof(methodptr) * (vftbllength - 1) +
875  sizeof(methodptr*) * (interfacetablelength - (interfacetablelength > 0)));
876  v = (vftbl_t *) (((methodptr *) v) +
877  (interfacetablelength - 1) * (interfacetablelength > 1));
878 
879  c->vftbl = v;
880  v->clazz = c;
881  v->vftbllength = vftbllength;
882  v->interfacetablelength = interfacetablelength;
883  v->arraydesc = arraydesc;
884 
885  /* store interface index in vftbl */
886 
887  if (c->flags & ACC_INTERFACE)
888  v->baseval = -(c->index);
889 
890  /* copy virtual function table of super class */
891 
892  for (i = 0; i < supervftbllength; i++)
893  v->table[i] = super->vftbl->table[i];
894 
895  /* Fill the remaining vftbl slots with the AbstractMethodError
896  stub (all after the super class slots, because they are already
897  initialized). */
898 
899  for (; i < vftbllength; i++) {
900 #if defined(ENABLE_JIT)
901 # if defined(ENABLE_INTRP)
902  if (opt_intrp)
904  else
905 # endif
907 #else
909 #endif
910  }
911 
912  /* add method stubs into virtual function table */
913 
914  for (i = 0; i < c->methodscount; i++) {
915  methodinfo *m = &(c->methods[i]);
916 
917  assert(m->stubroutine == NULL);
918 
919  /* Don't create a compiler stub for abstract methods as they
920  throw an AbstractMethodError with the default stub in the
921  vftbl. This entry is simply copied by sub-classes. */
922 
923  if (m->flags & ACC_ABSTRACT)
924  continue;
925 
926 #if defined(ENABLE_JIT)
927 # if defined(ENABLE_INTRP)
928  if (opt_intrp)
930  else
931 #endif
933 #else
935 #endif
936 
937  /* static methods are not in the vftbl */
938 
939  if (m->flags & ACC_STATIC)
940  continue;
941 
942  /* insert the stubroutine into the vftbl */
943 
944  v->table[m->vftblindex] = (methodptr) (ptrint) m->stubroutine;
945  }
946  RT_TIMER_STOPSTART(fill_vftbl_timer,offsets_timer);
947 
948  /* compute instance size and offset of each field */
949 
950  for (i = 0; i < c->fieldscount; i++) {
951  s4 dsize;
952  fieldinfo *f = &(c->fields[i]);
953 
954  if (!(f->flags & ACC_STATIC)) {
955  dsize = f->parseddesc->typesize();
956  c->instancesize = MEMORY_ALIGN(c->instancesize, dsize);
957  f->offset = c->instancesize;
958  c->instancesize += dsize;
959  }
960  }
961  RT_TIMER_STOPSTART(offsets_timer,fill_iftbl_timer);
962 
963  /* initialize interfacetable and interfacevftbllength */
964 
965  v->interfacevftbllength = MNEW(s4, interfacetablelength);
966 
967  STATISTICS(count_vftbl_len += (4 + sizeof(s4)) * v->interfacetablelength);
968 
969  for (i = 0; i < interfacetablelength; i++) {
970  v->interfacevftbllength[i] = 0;
971  v->interfacetable[-i] = NULL;
972  }
973 
974  /* add interfaces */
975 
976  for (tc = c; tc != NULL; tc = tc->super)
977  for (i = 0; i < tc->interfacescount; i++)
978  if (!linker_addinterface(c, tc->interfaces[i]))
979  return NULL;
980 
981  RT_TIMER_STOPSTART(fill_iftbl_timer,finalizer_timer);
982 
983  /* add finalizer method (not for java.lang.Object) */
984 
985  if (super) {
986  methodinfo *fi;
987 
988  fi = class_findmethod(c, utf8::finalize, utf8::void__void);
989 
990  if (fi)
991  if (!(fi->flags & ACC_STATIC))
992  c->finalizer = fi;
993  }
994  RT_TIMER_STOPSTART(finalizer_timer,subclasses_timer);
995 
996  /* final tasks */
997 
999 
1000  /* FIXME: this is completely useless now */
1001  RT_TIMER_STOP(subclasses_timer);
1002 
1003 #if USES_NEW_SUBTYPE
1004  if (!build_display(c))
1005  return NULL;
1006 #endif
1007 
1008  /* revert the linking state and class is linked */
1009 
1010  c->state = (c->state & ~CLASS_LINKING) | CLASS_LINKED;
1011 
1012  /* check worklist */
1013 
1014  /* XXX must this also be done in case of exception? */
1015 
1016  while (worklist != NULL) {
1017  method_worklist *wi = worklist;
1018 
1019  worklist = worklist->next;
1020 
1021  INLINELOG( printf("MUST BE RECOMPILED: "); method_println(wi->m); );
1022  jit_invalidate_code(wi->m);
1023 
1024  /* XXX put worklist into dump memory? */
1025  FREE(wi, method_worklist);
1026  }
1027 
1028  /* just return c to show that we didn't had a problem */
1029 
1030  return c;
1031 }
1032 
1033 
1034 /* link_array ******************************************************************
1035 
1036  This function is called by link_class to create the arraydescriptor
1037  for an array class.
1038 
1039  This function returns NULL if the array cannot be linked because
1040  the component type has not been linked yet.
1041 
1042 *******************************************************************************/
1043 
1045 {
1046  classinfo *comp;
1047  s4 namelen;
1048  arraydescriptor *desc;
1049  vftbl_t *compvftbl;
1050  Utf8String u;
1051 
1052  comp = NULL;
1053  namelen = c->name.size();
1054 
1055  /* Check the component type */
1056 
1057  switch (c->name[1]) {
1058  case '[':
1059  /* c is an array of arrays. */
1060  u = Utf8String::from_utf8(c->name.begin() + 1, namelen - 1);
1061  if (!(comp = load_class_from_classloader(u, c->classloader)))
1062  return NULL;
1063  break;
1064 
1065  case 'L':
1066  /* c is an array of objects. */
1067  u = Utf8String::from_utf8(c->name.begin() + 2, namelen - 3);
1068  if (!(comp = load_class_from_classloader(u, c->classloader)))
1069  return NULL;
1070  break;
1071  }
1072 
1073  /* If the component type has not been linked, link it now */
1074 
1075  assert(!comp || (comp->state & CLASS_LOADED));
1076 
1077  if (comp && !(comp->state & CLASS_LINKED))
1078  if (!link_class(comp))
1079  return NULL;
1080 
1081  /* Allocate the arraydescriptor */
1082 
1083  desc = NEW(arraydescriptor);
1084 
1085  if (comp) {
1086  /* c is an array of references */
1087  desc->arraytype = ARRAYTYPE_OBJECT;
1088  desc->componentsize = sizeof(void*);
1089  desc->dataoffset = OFFSET(java_objectarray_t, data);
1090 
1091  compvftbl = comp->vftbl;
1092 
1093  if (!compvftbl) {
1094  log_text("Component class has no vftbl");
1095  assert(0);
1096  }
1097 
1098  desc->componentvftbl = compvftbl;
1099 
1100  if (compvftbl->arraydesc) {
1101  desc->elementvftbl = compvftbl->arraydesc->elementvftbl;
1102 
1103  if (compvftbl->arraydesc->dimension >= 255) {
1105  return NULL;
1106  }
1107 
1108  desc->dimension = compvftbl->arraydesc->dimension + 1;
1109  desc->elementtype = compvftbl->arraydesc->elementtype;
1110 
1111  } else {
1112  desc->elementvftbl = compvftbl;
1113  desc->dimension = 1;
1114  desc->elementtype = ARRAYTYPE_OBJECT;
1115  }
1116 
1117  } else {
1118  /* c is an array of a primitive type */
1119  switch (c->name[1]) {
1120  case 'Z':
1121  desc->arraytype = ARRAYTYPE_BOOLEAN;
1122  desc->dataoffset = OFFSET(java_booleanarray_t,data);
1123  desc->componentsize = sizeof(u1);
1124  break;
1125 
1126  case 'B':
1127  desc->arraytype = ARRAYTYPE_BYTE;
1128  desc->dataoffset = OFFSET(java_bytearray_t,data);
1129  desc->componentsize = sizeof(u1);
1130  break;
1131 
1132  case 'C':
1133  desc->arraytype = ARRAYTYPE_CHAR;
1134  desc->dataoffset = OFFSET(java_chararray_t,data);
1135  desc->componentsize = sizeof(u2);
1136  break;
1137 
1138  case 'D':
1139  desc->arraytype = ARRAYTYPE_DOUBLE;
1140  desc->dataoffset = OFFSET(java_doublearray_t,data);
1141  desc->componentsize = sizeof(double);
1142  break;
1143 
1144  case 'F':
1145  desc->arraytype = ARRAYTYPE_FLOAT;
1146  desc->dataoffset = OFFSET(java_floatarray_t,data);
1147  desc->componentsize = sizeof(float);
1148  break;
1149 
1150  case 'I':
1151  desc->arraytype = ARRAYTYPE_INT;
1152  desc->dataoffset = OFFSET(java_intarray_t,data);
1153  desc->componentsize = sizeof(s4);
1154  break;
1155 
1156  case 'J':
1157  desc->arraytype = ARRAYTYPE_LONG;
1158  desc->dataoffset = OFFSET(java_longarray_t,data);
1159  desc->componentsize = sizeof(s8);
1160  break;
1161 
1162  case 'S':
1163  desc->arraytype = ARRAYTYPE_SHORT;
1164  desc->dataoffset = OFFSET(java_shortarray_t,data);
1165  desc->componentsize = sizeof(s2);
1166  break;
1167 
1168  default:
1170  return NULL;
1171  }
1172 
1173  desc->componentvftbl = NULL;
1174  desc->elementvftbl = NULL;
1175  desc->dimension = 1;
1176  desc->elementtype = desc->arraytype;
1177  }
1178 
1179  return desc;
1180 }
1181 
1182 /* linker_create_string_later **************************************************
1183 
1184  A hack so we can initialize java.lang.String objects during initialization.
1185 
1186 *******************************************************************************/
1188 {
1189  deferred_strings.push_back(std::make_pair(a, u));
1190 }
1191 
1193 {
1194  deferred_strings_vec_t::const_iterator it = deferred_strings.begin();
1195  for (; it != deferred_strings.end(); ++it)
1196  *it->first = JavaString::literal(it->second);
1197  deferred_strings.clear();
1198 }
1199 
1200 
1201 /* linker_compute_subclasses ***************************************************
1202 
1203  XXX
1204 
1205  ATTENTION: DO NOT REMOVE ANY OF THE LOCKING MECHANISMS BELOW:
1206  This function needs to take the class renumber lock and stop the
1207  world during class renumbering. The lock is used in C code which
1208  is not that performance critical. Whereas JIT code uses critical
1209  sections to atomically access the class values.
1210 
1211 *******************************************************************************/
1212 
1214 {
1215 
1217 
1218  if (!(c->flags & ACC_INTERFACE)) {
1219  c->nextsub = NULL;
1220  c->sub = NULL;
1221 #if USES_NEW_SUBTYPE
1222  c->vftbl->baseval = 1; /* so it does not look like an interface */
1223 #endif
1224  }
1225 
1226  if (!(c->flags & ACC_INTERFACE) && (c->super != NULL)) {
1227  c->nextsub = c->super->sub;
1228  c->super->sub = c;
1229  }
1230 
1231  classvalue = 0;
1232 
1233 #if !USES_NEW_SUBTYPE
1234  /* compute class values */
1235 
1237 #endif
1238 
1240 
1241 }
1242 
1243 
1244 /* linker_compute_class_values *************************************************
1245 
1246  XXX
1247 
1248 *******************************************************************************/
1249 
1250 #if !USES_NEW_SUBTYPE
1252 {
1253  classinfo *subs;
1254 
1255  c->vftbl->baseval = ++classvalue;
1256 
1257  subs = c->sub;
1258 
1259  while (subs) {
1261 
1262  subs = subs->nextsub;
1263  }
1264 
1265  c->vftbl->diffval = classvalue - c->vftbl->baseval;
1266 }
1267 #endif
1268 
1269 
1270 /* linker_addinterface *********************************************************
1271 
1272  Is needed by link_class for adding a VTBL to a class. All
1273  interfaces implemented by ic are added as well.
1274 
1275  RETURN VALUE:
1276  true.........everything ok
1277  false........an exception has been thrown
1278 
1279 *******************************************************************************/
1280 
1282 {
1283  s4 j, k;
1284  vftbl_t *v;
1285  s4 i;
1286  classinfo *sc;
1287  methodinfo *m;
1288 
1289  v = c->vftbl;
1290  i = ic->index;
1291 
1292  if (i >= v->interfacetablelength)
1293  vm_abort("Internal error: interfacetable overflow");
1294 
1295  /* if this interface has already been added, return immediately */
1296 
1297  if (v->interfacetable[-i] != NULL)
1298  return true;
1299 
1300  if (ic->methodscount == 0) { /* fake entry needed for subtype test */
1301  v->interfacevftbllength[i] = 1;
1302  v->interfacetable[-i] = MNEW(methodptr, 1);
1303  v->interfacetable[-i][0] = NULL;
1304  }
1305  else {
1308 
1309  STATISTICS(count_vftbl_len += sizeof(methodptr) *
1310  (ic->methodscount + (ic->methodscount == 0)));
1311 
1312  for (j = 0; j < ic->methodscount; j++) {
1313  for (sc = c; sc != NULL; sc = sc->super) {
1314  for (k = 0; k < sc->methodscount; k++) {
1315  m = &(sc->methods[k]);
1316 
1317  if (method_canoverwrite(m, &(ic->methods[j]))) {
1318  /* method m overwrites the (abstract) method */
1319 #if defined(ENABLE_VERIFIER)
1320  /* Add loading constraints (for the more
1321  general types of the method
1322  ic->methods[j]). */
1324  c->classloader, ic->classloader,
1325  &(ic->methods[j])))
1326  {
1327  return false;
1328  }
1329 #endif
1330 
1331  /* XXX taken from gcj */
1332  /* check for ACC_STATIC: IncompatibleClassChangeError */
1333 
1334  /* check for !ACC_PUBLIC: IllegalAccessError */
1335 
1336  /* check for ACC_ABSTRACT: AbstracMethodError,
1337  not sure about that one */
1338 
1339  v->interfacetable[-i][j] = v->table[m->vftblindex];
1340  goto foundmethod;
1341  }
1342  }
1343  }
1344 
1345  /* If no method was found, insert the AbstractMethodError
1346  stub. */
1347 
1348 #if defined(ENABLE_JIT)
1349 # if defined(ENABLE_INTRP)
1350  if (opt_intrp)
1351  v->interfacetable[-i][j] =
1353  else
1354 # endif
1355  v->interfacetable[-i][j] =
1357 #else
1358  v->interfacetable[-i][j] =
1360 #endif
1361 
1362  foundmethod:
1363  ;
1364  }
1365  }
1366 
1367  /* add superinterfaces of this interface */
1368 
1369  for (j = 0; j < ic->interfacescount; j++)
1370  if (!linker_addinterface(c, ic->interfaces[j]))
1371  return false;
1372 
1373  /* everything ok */
1374 
1375  return true;
1376 }
1377 
1378 
1379 /* class_highestinterface ******************************************************
1380 
1381  Used by the function link_class to determine the amount of memory
1382  needed for the interface table.
1383 
1384 *******************************************************************************/
1385 
1387 {
1388  s4 h;
1389  s4 h2;
1390  s4 i;
1391 
1392  /* check for ACC_INTERFACE bit already done in link_class_intern */
1393 
1394  h = c->index;
1395 
1396  for (i = 0; i < c->interfacescount; i++) {
1397  h2 = class_highestinterface(c->interfaces[i]);
1398 
1399  if (h2 > h)
1400  h = h2;
1401  }
1402 
1403  return h;
1404 }
1405 
1406 /*
1407  * These are local overrides for various environment variables in Emacs.
1408  * Please do not remove this and leave it at the end of the file, where
1409  * Emacs will automagically detect them.
1410  * ---------------------------------------------------------------------
1411  * Local variables:
1412  * mode: c++
1413  * indent-tabs-mode: t
1414  * c-basic-offset: 4
1415  * tab-width: 4
1416  * End:
1417  * vim:noexpandtab:sw=4:ts=4:
1418  */
void exceptions_throw_verifyerror(methodinfo *m, const char *message,...)
Definition: exceptions.cpp:973
methodptr * interfacetable[1]
Definition: vftbl.hpp:99
void exceptions_throw_illegalargumentexception(void)
Utf8String name
Definition: method.hpp:71
void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl)
Definition: method.cpp:1118
classinfo * class_java_lang_ThreadGroup
Definition: globals.cpp:42
void linker_init(void)
Definition: linker.cpp:166
classinfo * class_java_lang_reflect_Field
Definition: globals.cpp:82
#define STATISTICS(x)
Wrapper for statistics only code.
Definition: statistics.hpp:975
ArrayType elementtype
Definition: array.hpp:76
bool classcache_add_constraints_for_params(classloader_t *a, classloader_t *b, methodinfo *m)
#define RT_TIMER_STOP(var)
Stop the timer var.
Definition: rt-timing.hpp:695
classinfo * class_java_lang_RuntimeException
Definition: globals.cpp:56
classinfo * class_java_lang_Long
Definition: globals.cpp:73
#define TRACELINKCLASS(c)
Definition: linker.cpp:72
methodinfo * methods
Definition: class.hpp:113
#define NEW(type)
Definition: memory.hpp:93
void linker_preinit(void)
Definition: linker.cpp:131
classinfo * nextsub
Definition: class.hpp:104
#define INLINELOG(code)
Definition: linker.cpp:96
classinfo * class_java_lang_Float
Definition: globals.cpp:74
static classinfo * link_class_intern(classinfo *c)
Definition: linker.cpp:618
classinfo * class_java_lang_Short
Definition: globals.cpp:71
classinfo * super
Definition: class.hpp:102
#define FREE(ptr, type)
Definition: memory.hpp:94
classinfo * class_java_lang_VMSystem
Definition: globals.cpp:47
size_t size() const
Definition: utf8.hpp:161
#define LOCK_MONITOR_EXIT(o)
Definition: lock.hpp:94
classinfo * class_java_lang_Character
Definition: globals.cpp:70
classinfo * class_array_of(classinfo *component, bool link)
Definition: class.cpp:832
s4 state
Definition: class.hpp:115
classinfo * class_java_lang_Void
Definition: globals.cpp:66
classinfo * class_java_lang_VMThrowable
Definition: globals.cpp:49
classloader_t * classloader
Definition: class.hpp:151
bool opt_intrp
Definition: options.cpp:55
classinfo * class_java_lang_reflect_VMMethod
Definition: globals.cpp:91
void linker_initialize_deferred_strings()
Definition: linker.cpp:1192
static arraydescriptor * link_array(classinfo *c)
Definition: linker.cpp:1044
size_t typesize() const
Definition: descriptor.hpp:195
static void linker_compute_class_values(classinfo *c)
Definition: linker.cpp:1251
int32_t interfacescount
Definition: class.hpp:106
#define RT_TIMER_START(var)
Start the timer var.
Definition: rt-timing.hpp:694
s4 instancesize
Definition: class.hpp:118
classinfo * classcache_store(classloader_t *initloader, classinfo *cls, bool mayfree)
Definition: classcache.cpp:730
Dummy implementation of a mutex.
Definition: mutex-none.hpp:33
vftbl_t * componentvftbl
Definition: array.hpp:73
uint8_t u1
Definition: types.hpp:40
classinfo * class_java_lang_VMThread
Definition: globals.cpp:48
u1 * methodptr
Definition: global.hpp:40
method_worklist * next
Definition: method.hpp:146
classinfo * pseudo_class_Arraystub
Definition: globals.cpp:106
methodinfo * finalizer
Definition: class.hpp:123
s4 * interfacevftbllength
Definition: vftbl.hpp:115
classinfo * class_java_lang_Object
Definition: globals.cpp:28
int64_t s8
Definition: types.hpp:48
methodinfo * class_findmethod(classinfo *c, Utf8String name, Utf8String desc)
Definition: class.cpp:1124
static void * stubcode
Definition: stubs.hpp:59
static deferred_strings_vec_t deferred_strings
Definition: linker.cpp:122
classinfo * pseudo_class_Null
Definition: globals.cpp:107
#define TRACESUBSYSTEMINITIALIZATION(text)
Definition: options.hpp:258
u1 * intrp_createcompilerstub(methodinfo *m)
Definition: codegen.c:1832
#define SAME_PACKAGE(a, b)
Definition: access.hpp:40
void exceptions_throw_noclassdeffounderror(Utf8String name)
Definition: exceptions.cpp:700
void vm_abort(const char *text,...)
Definition: vm.cpp:2586
#define RT_REGISTER_GROUP(var, name, description)
Register a new (toplevel) group.
Definition: rt-timing.hpp:683
#define UNLOCK_CLASSRENUMBER_LOCK
Definition: linker.hpp:52
static bool linker_overwrite_method(methodinfo *mg, methodinfo *ms, method_worklist **wl)
Definition: linker.cpp:454
void link(basicblock *v, basicblock *w)
Definition: dominator.cpp:178
bool class_linked(classinfo *c)
Definition: hook.hpp:81
s4 interfacetablelength
Definition: vftbl.hpp:103
jlong jlong jlong jlong jint depth
Definition: jvmti.h:497
void jit_invalidate_code(methodinfo *m)
Definition: jit.cpp:910
classinfo * class_java_lang_Byte
Definition: globals.cpp:69
u1 * stubroutine
Definition: method.hpp:102
s4 vftblindex
Definition: method.hpp:81
#define RT_REGISTER_GROUP_TIMER(var, name, description, group)
Register a new timer.
Definition: rt-timing.hpp:682
void linker_create_string_later(java_object_t **a, Utf8String u)
Definition: linker.cpp:1187
classinfo * arrayclass_java_lang_Object
Definition: globals.cpp:94
classinfo * class_java_lang_reflect_VMField
Definition: globals.cpp:90
uint16_t u2
Definition: types.hpp:43
void method_println(methodinfo *m)
Definition: method.cpp:1218
int32_t offset
Definition: field.hpp:66
classinfo * clazz
Definition: method.hpp:80
s4 vftbllength
Definition: vftbl.hpp:102
static JNINativeMethod methods[]
This file contains the statistics framework.
classinfo * sub
Definition: class.hpp:103
Utf8String name
Definition: class.hpp:91
s4 baseval
Definition: vftbl.hpp:104
classinfo * clazz
Definition: vftbl.hpp:100
classinfo * class_java_lang_ClassNotFoundException
Definition: globals.cpp:55
void exceptions_throw_nullpointerexception(void)
static void * generate(methodinfo *m)
Wrapper for codegen_emit_stub_compiler.
Definition: stubs.cpp:61
s4 flags
Definition: field.hpp:59
classinfo * class_java_lang_Class
Definition: globals.cpp:35
Definition: set.cpp:44
static s4 interfaceindex
Definition: linker.cpp:102
classinfo * class_java_lang_reflect_Method
Definition: globals.cpp:83
static void linker_compute_subclasses(classinfo *c)
Definition: linker.cpp:1213
static s4 class_highestinterface(classinfo *c)
Definition: linker.cpp:1386
methodinfo * overwrites
Definition: method.hpp:109
s4 flags
Definition: class.hpp:90
void intrp_asm_abstractmethoderror(void)
Definition: asmpart.c:292
typedesc * parseddesc
Definition: field.hpp:64
bool classcache_store_unique(classinfo *cls)
Definition: classcache.cpp:883
static Utf8String from_utf8(const char *, size_t)
Definition: utf8.cpp:335
MIIterator i
classinfo * class_java_io_Serializable
Definition: globals.cpp:44
classinfo * class_java_lang_System
Definition: globals.cpp:40
int32_t s4
Definition: types.hpp:45
s4 index
Definition: class.hpp:116
int32_t methodscount
Definition: class.hpp:112
classinfo ** interfaces
Definition: class.hpp:107
arraydescriptor * arraydesc
Definition: vftbl.hpp:101
This file contains the real-time timing utilities.
void compilingtime_start(void)
Definition: statistics.cpp:81
static bool linker_addinterface(classinfo *c, classinfo *ic)
Definition: linker.cpp:1281
#define LOCK_CLASSRENUMBER_LOCK
Definition: linker.hpp:51
Mutex * linker_classrenumber_lock
Definition: linker.cpp:106
vftbl_t * elementvftbl
Definition: array.hpp:74
void loadingtime_stop(void)
Definition: statistics.cpp:65
vftbl_t * vftbl
Definition: class.hpp:121
classinfo * class_java_lang_String
Definition: globals.cpp:39
byte_iterator begin() const
Definition: utf8.hpp:106
classinfo * pseudo_class_New
Definition: globals.cpp:108
#define MNEW(type, num)
Definition: memory.hpp:96
classinfo * class_java_lang_Exception
Definition: globals.cpp:54
classinfo * class_java_lang_Integer
Definition: globals.cpp:72
static s4 classvalue
Definition: linker.cpp:103
classinfo * link_class(classinfo *c)
Definition: linker.cpp:378
ArrayType arraytype
Definition: array.hpp:75
#define LOCK_MONITOR_ENTER(o)
Definition: lock.hpp:93
#define MEMORY_ALIGN(pos, size)
Definition: memory.hpp:37
classinfo * class_java_lang_SecurityManager
Definition: globals.cpp:38
int16_t s2
Definition: types.hpp:42
void class_postset_header_vftbl(void)
Definition: class.cpp:210
#define RT_TIMER_STOPSTART(var1, var2)
Stop the timer var1 and start the timer var2.
Definition: rt-timing.hpp:696
classinfo * load_class_from_classloader(Utf8String name, classloader_t *cl)
Definition: loader.cpp:1071
s4 componentsize
Definition: array.hpp:78
std::vector< std::pair< java_object_t **, Utf8String > > deferred_strings_vec_t
Definition: linker.cpp:121
classinfo * class_java_lang_Double
Definition: globals.cpp:75
classinfo * class_java_lang_reflect_VMConstructor
Definition: globals.cpp:89
classinfo * class_java_lang_Thread
Definition: globals.cpp:41
methodptr table[1]
Definition: vftbl.hpp:116
#define MREALLOC(ptr, type, num1, num2)
Definition: memory.hpp:99
#define MCOPY(dest, src, type, num)
Definition: memory.hpp:103
classinfo * class_java_lang_StackTraceElement
Definition: globals.cpp:80
classinfo * class_create_classinfo(Utf8String classname)
Definition: class.cpp:145
s4 flags
Definition: method.hpp:70
uintptr_t ptrint
Definition: types.hpp:54
s4 diffval
Definition: vftbl.hpp:106
classinfo * class_java_util_HashMap
Definition: globals.cpp:86
classinfo * resolve_classref_or_classinfo_eager(classref_or_classinfo cls, bool checkaccess)
Definition: resolve.cpp:437
classinfo * class_java_util_Vector
Definition: globals.cpp:85
classinfo * class_java_lang_reflect_Constructor
Definition: globals.cpp:81
static JavaString literal(Utf8String)
Definition: string.cpp:257
classinfo * class_java_lang_Boolean
Definition: globals.cpp:68
#define log_text(s)
Definition: logging.hpp:170
#define STAT_DECLARE_VAR(type, var, init)
Declare an external statistics variable.
Definition: statistics.hpp:963
classinfo * class_java_security_PrivilegedAction
Definition: globals.cpp:84
void * mem_alloc(int32_t size)
Definition: memory.cpp:86
const char const void jint length
Definition: jvmti.h:352
#define OFFSET(s, el)
Definition: memory.hpp:90
#define printf(...)
Definition: ssa2.cpp:40
classinfo * class_java_lang_Throwable
Definition: globals.cpp:43
classinfo * class_java_lang_Cloneable
Definition: globals.cpp:37
classinfo * class_java_lang_ClassLoader
Definition: globals.cpp:36
void compilingtime_stop(void)
Definition: statistics.cpp:96
void loadingtime_start(void)
Definition: statistics.cpp:49
bool method_canoverwrite(methodinfo *m, methodinfo *old)
Definition: method.cpp:642
methodinfo * m
Definition: method.hpp:147