⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pvmtrace.c

📁 一个开源的JAVA虚拟机
💻 C
字号:
#include <aegisvm/pvm.h>inttrace_pvm_init(void) {  j_log("trace: initializing PVMs");  return 0;}inttrace_pvm_finish(void) {  j_log("trace: finishing PVMs");  return 0;}const PREVI *trace_pvm_verify(JArena *arena,		const PREClassFile *classfile,		const PREAnalysis **analyses) {  JArena *tmp;  PREWorkingVI *vi;  const PREVI *V;  PREArgument arg;  j_log("trace: verifying class: %U",	pre_classfile_this_class_name(classfile));  /* Allocate tmp arena */  tmp = j_arena_new();  if (tmp == 0)    return 0;  /* Allocate working VI */  vi = pre_working_vi_new(tmp, classfile);  if (vi == 0)    return 0;  /* Class obligations */  pre_argument_set_this(&arg);  if (! pre_working_vi_formulate_class_obligation(vi, 0, 1, &arg))    goto ErrorExit;  /* Constants obligations */  {    ju2 count, i;    count = pre_classfile_constant_pool_count(classfile);    for (i = 1; i < count; i++) {      const void *cp = pre_classfile_constant_pool_entry(classfile, i);      if (cp != 0) {	ju1 tag = pre_cp_tag(cp);	switch (tag) {	case J_CONSTANT_Class:	  pre_argument_set_constant(&arg, i);	  if (! pre_working_vi_formulate_constant_obligation(vi,i,1,1,&arg))	    goto ErrorExit;	  break;	case J_CONSTANT_Fieldref:	  pre_argument_set_constant(&arg, i);	  if (! pre_working_vi_formulate_constant_obligation(vi,i,2,1,&arg))	    goto ErrorExit;	  break;	case J_CONSTANT_Methodref:	  pre_argument_set_constant(&arg, i);	  if (! pre_working_vi_formulate_constant_obligation(vi,i,3,1,&arg))	    goto ErrorExit;	  break;	case J_CONSTANT_InterfaceMethodref:	  pre_argument_set_constant(&arg, i);	  if (! pre_working_vi_formulate_constant_obligation(vi,i,4,1,&arg))	    goto ErrorExit;	  break;	}      }    }  }  /* Fields obligations */  {    ju2 i, count;    count = pre_classfile_fields_count(classfile);    for (i = 0; i < count; i++) {      pre_argument_set_field(&arg, i);      if (! pre_working_vi_formulate_field_obligation(vi,i,5,1,&arg))	goto ErrorExit;    }  }  /* Methods obligations */  {    ju2 i, count;    count = pre_classfile_methods_count(classfile);    for (i = 0; i < count; i++) {      pre_argument_set_method(&arg, i);      if (! pre_working_vi_formulate_method_obligation(vi,i,6,1,&arg))	goto ErrorExit;    }  }  /* Archive result */  V = pre_vi_new(arena, vi, 0);  if (V == 0)    goto ErrorExit;  j_arena_delete(tmp);  return V; ErrorExit:  j_arena_delete(tmp);  return 0;}pvm_profile_t pvm_profile = {  "trace",  &trace_pvm_init,  &trace_pvm_finish,  &trace_pvm_verify};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -