Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
d88ab035
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d88ab035
编写于
11月 19, 2009
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6902264: fix indentation of tableswitch and lookupswitch
Reviewed-by: ksrini
上级
03f2aa7f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
27 deletion
+34
-27
src/share/classes/com/sun/tools/classfile/Instruction.java
src/share/classes/com/sun/tools/classfile/Instruction.java
+4
-4
src/share/classes/com/sun/tools/javap/CodeWriter.java
src/share/classes/com/sun/tools/javap/CodeWriter.java
+30
-23
未找到文件。
src/share/classes/com/sun/tools/classfile/Instruction.java
浏览文件 @
d88ab035
...
...
@@ -106,9 +106,9 @@ public class Instruction {
/** See {@link Kind#LOCAL_UBYTE}. */
R
visitLocalAndValue
(
Instruction
instr
,
int
index
,
int
value
,
P
p
);
/** See {@link Kind#DYNAMIC}. */
R
visitLookupSwitch
(
Instruction
instr
,
int
default_
,
int
npairs
,
int
[]
matches
,
int
[]
offsets
);
R
visitLookupSwitch
(
Instruction
instr
,
int
default_
,
int
npairs
,
int
[]
matches
,
int
[]
offsets
,
P
p
);
/** See {@link Kind#DYNAMIC}. */
R
visitTableSwitch
(
Instruction
instr
,
int
default_
,
int
low
,
int
high
,
int
[]
offsets
);
R
visitTableSwitch
(
Instruction
instr
,
int
default_
,
int
low
,
int
high
,
int
[]
offsets
,
P
p
);
/** See {@link Kind#BYTE}, {@link Kind#SHORT}. */
R
visitValue
(
Instruction
instr
,
int
value
,
P
p
);
/** Instruction is unrecognized. */
...
...
@@ -282,7 +282,7 @@ public class Instruction {
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
values
[
i
]
=
getInt
(
pad
+
12
+
4
*
i
);
return
visitor
.
visitTableSwitch
(
this
,
default_
,
low
,
high
,
values
);
this
,
default_
,
low
,
high
,
values
,
p
);
}
case
LOOKUPSWITCH:
{
int
pad
=
align
(
pc
+
1
)
-
pc
;
...
...
@@ -295,7 +295,7 @@ public class Instruction {
offsets
[
i
]
=
getInt
(
pad
+
12
+
i
*
8
);
}
return
visitor
.
visitLookupSwitch
(
this
,
default_
,
npairs
,
matches
,
offsets
);
this
,
default_
,
npairs
,
matches
,
offsets
,
p
);
}
default
:
throw
new
IllegalStateException
();
...
...
src/share/classes/com/sun/tools/javap/CodeWriter.java
浏览文件 @
d88ab035
...
...
@@ -118,28 +118,33 @@ class CodeWriter extends BasicWriter {
public
void
writeInstr
(
Instruction
instr
)
{
print
(
String
.
format
(
"%4d: %-13s "
,
instr
.
getPC
(),
instr
.
getMnemonic
()));
instr
.
accept
(
instructionPrinter
,
null
);
// compute the number of indentations for the body of multi-line instructions
// This is 6 (the width of "%4d: "), divided by the width of each indentation level,
// and rounded up to the next integer.
int
indentWidth
=
options
.
indentWidth
;
int
indent
=
(
6
+
indentWidth
-
1
)
/
indentWidth
;
instr
.
accept
(
instructionPrinter
,
indent
);
println
();
}
// where
Instruction
.
KindVisitor
<
Void
,
Void
>
instructionPrinter
=
new
Instruction
.
KindVisitor
<
Void
,
Void
>()
{
Instruction
.
KindVisitor
<
Void
,
Integer
>
instructionPrinter
=
new
Instruction
.
KindVisitor
<
Void
,
Integer
>()
{
public
Void
visitNoOperands
(
Instruction
instr
,
Void
p
)
{
public
Void
visitNoOperands
(
Instruction
instr
,
Integer
indent
)
{
return
null
;
}
public
Void
visitArrayType
(
Instruction
instr
,
TypeKind
kind
,
Void
p
)
{
public
Void
visitArrayType
(
Instruction
instr
,
TypeKind
kind
,
Integer
indent
)
{
print
(
" "
+
kind
.
name
);
return
null
;
}
public
Void
visitBranch
(
Instruction
instr
,
int
offset
,
Void
p
)
{
public
Void
visitBranch
(
Instruction
instr
,
int
offset
,
Integer
indent
)
{
print
((
instr
.
getPC
()
+
offset
));
return
null
;
}
public
Void
visitConstantPoolRef
(
Instruction
instr
,
int
index
,
Void
p
)
{
public
Void
visitConstantPoolRef
(
Instruction
instr
,
int
index
,
Integer
indent
)
{
print
(
"#"
+
index
);
tab
();
print
(
"// "
);
...
...
@@ -147,7 +152,7 @@ class CodeWriter extends BasicWriter {
return
null
;
}
public
Void
visitConstantPoolRefAndValue
(
Instruction
instr
,
int
index
,
int
value
,
Void
p
)
{
public
Void
visitConstantPoolRefAndValue
(
Instruction
instr
,
int
index
,
int
value
,
Integer
indent
)
{
print
(
"#"
+
index
+
", "
+
value
);
tab
();
print
(
"// "
);
...
...
@@ -155,46 +160,48 @@ class CodeWriter extends BasicWriter {
return
null
;
}
public
Void
visitLocal
(
Instruction
instr
,
int
index
,
Void
p
)
{
public
Void
visitLocal
(
Instruction
instr
,
int
index
,
Integer
indent
)
{
print
(
index
);
return
null
;
}
public
Void
visitLocalAndValue
(
Instruction
instr
,
int
index
,
int
value
,
Void
p
)
{
public
Void
visitLocalAndValue
(
Instruction
instr
,
int
index
,
int
value
,
Integer
indent
)
{
print
(
index
+
", "
+
value
);
return
null
;
}
public
Void
visitLookupSwitch
(
Instruction
instr
,
int
default_
,
int
npairs
,
int
[]
matches
,
int
[]
offsets
)
{
public
Void
visitLookupSwitch
(
Instruction
instr
,
int
default_
,
int
npairs
,
int
[]
matches
,
int
[]
offsets
,
Integer
indent
)
{
int
pc
=
instr
.
getPC
();
print
(
"{ // "
+
npairs
);
indent
(
+
1
);
indent
(
indent
);
for
(
int
i
=
0
;
i
<
npairs
;
i
++)
{
print
(
"\n"
+
matches
[
i
]
+
": "
+
(
pc
+
offsets
[
i
]
));
print
(
String
.
format
(
"%n%12d: %d"
,
matches
[
i
],
(
pc
+
offsets
[
i
])
));
}
print
(
"\n
default: "
+
(
pc
+
default_
)
+
"
}"
);
indent
(-
1
);
print
(
"\n
default: "
+
(
pc
+
default_
)
+
"\n
}"
);
indent
(-
indent
);
return
null
;
}
public
Void
visitTableSwitch
(
Instruction
instr
,
int
default_
,
int
low
,
int
high
,
int
[]
offsets
)
{
public
Void
visitTableSwitch
(
Instruction
instr
,
int
default_
,
int
low
,
int
high
,
int
[]
offsets
,
Integer
indent
)
{
int
pc
=
instr
.
getPC
();
print
(
"{ //"
+
low
+
" to "
+
high
);
indent
(
+
1
);
print
(
"{ //
"
+
low
+
" to "
+
high
);
indent
(
indent
);
for
(
int
i
=
0
;
i
<
offsets
.
length
;
i
++)
{
print
(
"\n"
+
(
low
+
i
)
+
": "
+
(
pc
+
offsets
[
i
]
));
print
(
String
.
format
(
"%n%12d: %d"
,
(
low
+
i
),
(
pc
+
offsets
[
i
])
));
}
print
(
"\n
default: "
+
(
pc
+
default_
)
+
"
}"
);
indent
(-
1
);
print
(
"\n
default: "
+
(
pc
+
default_
)
+
"\n
}"
);
indent
(-
indent
);
return
null
;
}
public
Void
visitValue
(
Instruction
instr
,
int
value
,
Void
p
)
{
public
Void
visitValue
(
Instruction
instr
,
int
value
,
Integer
indent
)
{
print
(
value
);
return
null
;
}
public
Void
visitUnknown
(
Instruction
instr
,
Void
p
)
{
public
Void
visitUnknown
(
Instruction
instr
,
Integer
indent
)
{
return
null
;
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录