Core API之Method结构

    在编译后class内部,method的代码以字节码指令序列的方式存储。为了生成和转换class,最基本的是知道这些指令、了解它们如何工作。

Execution model

    Java代码在线程内被执行。每个线程有自己的执行栈,它由frame组成。每个frame代表了一个方法调用:每个时间一个方法被调用,新frame被压入当前线程的执行栈,当方法正常返回或有异常,这个frame被弹出栈且继续执行。
   每个frame有两部分:本地变量和操作栈 。本地变量可以通过index随机访问,操作栈被字节码指令操作。即意味着此栈中的值只能以LIFO顺序访问。
本地变量和操作栈的大小依赖于method code。它在编译时间就被计算且随字节码指令一起存春在class中。所有frame的大小都一样,但不同方法对应的frame的本地变量和操作栈的大小不一样。
   上图展示了一个执行栈有三个frame,第一个frame有3个本地变量,它的操作栈大小为4,有量个值。当一个frame被创建后,它被初始化为空操作栈,它的本地变量初始化为目标对象this,和方法参数。例如调用a.equals(b),创建一个空操作栈,前两个本地变量初始为a和b,其他的本地变量没有初始化。
    在本地变量和操作栈中的slot可以容纳任何java值,除了long和double值之外。这些值需要两个slot。例如调用Math.max(1L,2L),创建一个frame,1L占用第一、第二个slot,2L占用第三、第四个slot。

Bytecode instructions

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
*************************** APPLICATION FAILED TO START *************************** Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.configureProperties(FlywayAutoConfiguration.java:255) The following method did not exist: 'org.flywaydb.core.api.configuration.FluentConfiguration org.flywaydb.core.api.configuration.FluentConfiguration.oracleSqlplus(boolean)' The calling method's class, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration, was loaded from the following location: jar:file:/D:/repository/org/springframework/boot/spring-boot-autoconfigure/3.1.0/spring-boot-autoconfigure-3.1.0.jar!/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class The called method's class, org.flywaydb.core.api.configuration.FluentConfiguration, is available from the following locations: jar:file:/D:/repository/org/flywaydb/flyway-core/9.20.1/flyway-core-9.20.1.jar!/org/flywaydb/core/api/configuration/FluentConfiguration.class The called method's class hierarchy was loaded from the following locations: org.flywaydb.core.api.configuration.FluentConfiguration: file:/D:/repository/org/flywaydb/flyway-core/9.20.1/flyway-core-9.20.1.jar Action: Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration and org.flywaydb.core.api.configuration.FluentConfiguration Disconnected from the target VM, address: '127.0.0.1:52541', transport: 'socket' Process finished with exit code 1 怎么回事
07-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值