Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
2b816e14
Commit
2b816e14
authored
Jan 10, 2005
by
Ranjit Mathew
Committed by
Ranjit Mathew
Jan 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* verify.c: Revert to the version before the BC-ABI merge.
From-SVN: r93147
parent
4059e82d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
74 deletions
+38
-74
gcc/java/ChangeLog
+4
-0
gcc/java/verify.c
+34
-74
No files found.
gcc/java/ChangeLog
View file @
2b816e14
2005
-
01
-
10
Ranjit
Mathew
<
rmathew
@
hotmail
.
com
>
2005
-
01
-
10
Ranjit
Mathew
<
rmathew
@
hotmail
.
com
>
*
verify
.
c
:
Revert
to
the
version
before
the
BC
-
ABI
merge
.
2005
-
01
-
10
Ranjit
Mathew
<
rmathew
@
hotmail
.
com
>
PR
java
/
19277
PR
java
/
19277
*
check
-
init
.
c
(
check_init
):
Take
care
of
references
that
do
not
*
check
-
init
.
c
(
check_init
):
Take
care
of
references
that
do
not
have
an
explicit
final
variable
declaration
(
e
.
g
.
array
length
have
an
explicit
final
variable
declaration
(
e
.
g
.
array
length
...
...
gcc/java/verify.c
View file @
2b816e14
/* Handle verification of bytecoded methods for the GNU compiler for
/* Handle verification of bytecoded methods for the GNU compiler for
the Java(TM) language.
the Java(TM) language.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
, 2005
Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of GCC.
This file is part of GCC.
...
@@ -89,23 +89,23 @@ check_pending_block (tree target_label)
...
@@ -89,23 +89,23 @@ check_pending_block (tree target_label)
if
(
current_subr
==
NULL_TREE
)
if
(
current_subr
==
NULL_TREE
)
{
{
/* if (LABEL_IN_SUBR (target_label)) */
if
(
LABEL_IN_SUBR
(
target_label
))
/* return "might transfer control into subroutine"; */
return
"might transfer control into subroutine"
;
}
}
else
else
{
{
if
(
LABEL_IN_SUBR
(
target_label
))
if
(
LABEL_IN_SUBR
(
target_label
))
{
{
/* if (LABEL_SUBR_START (target_label) != current_subr) */
if
(
LABEL_SUBR_START
(
target_label
)
!=
current_subr
)
/* return "transfer out of subroutine"; */
return
"transfer out of subroutine"
;
}
}
else
if
(
!
LABEL_VERIFIED
(
target_label
))
else
if
(
!
LABEL_VERIFIED
(
target_label
))
{
{
LABEL_IN_SUBR
(
target_label
)
=
1
;
LABEL_IN_SUBR
(
target_label
)
=
1
;
LABEL_SUBR_START
(
target_label
)
=
current_subr
;
LABEL_SUBR_START
(
target_label
)
=
current_subr
;
}
}
/* else */
else
/* return "transfer out of subroutine"; */
return
"transfer out of subroutine"
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -126,54 +126,6 @@ subroutine_nesting (tree label)
...
@@ -126,54 +126,6 @@ subroutine_nesting (tree label)
return
nesting
;
return
nesting
;
}
}
static
tree
defer_merging
(
tree
type1
,
tree
type2
)
{
/* FIXME: This is just a placeholder until we replace the verifier
altogether. We really need to ouput a type assertion for all of
the types, every time they are used. */
return
object_ptr_type_node
;
if
(
TREE_CODE
(
type1
)
==
POINTER_TYPE
)
type1
=
TREE_TYPE
(
type1
);
if
(
TREE_CODE
(
type2
)
==
POINTER_TYPE
)
type2
=
TREE_TYPE
(
type2
);
if
(
TREE_CODE
(
type1
)
==
RECORD_TYPE
&&
TREE_CODE
(
type2
)
==
RECORD_TYPE
)
{
tree
list
=
build_tree_list
(
type1
,
NULL_TREE
);
list
=
tree_cons
(
type2
,
NULL_TREE
,
list
);
return
list
;
}
if
(
TREE_CODE
(
type1
)
==
TREE_LIST
&&
TREE_CODE
(
type2
)
==
TREE_LIST
)
{
return
chainon
(
copy_list
(
type1
),
copy_list
(
type2
));
}
if
(
TREE_CODE
(
type1
)
==
TREE_LIST
&&
TREE_CODE
(
type2
)
==
RECORD_TYPE
)
{
tree
tmp
=
type1
;
do
{
if
(
TREE_PURPOSE
(
tmp
)
==
type2
)
return
type1
;
tmp
=
TREE_CHAIN
(
tmp
);
}
while
(
tmp
);
return
tree_cons
(
type2
,
NULL_TREE
,
copy_list
(
type1
));
}
if
(
TREE_CODE
(
type2
)
==
TREE_LIST
&&
TREE_CODE
(
type1
)
==
RECORD_TYPE
)
{
return
defer_merging
(
type2
,
type1
);
}
abort
();
}
/* Return the "merged" types of TYPE1 and TYPE2.
/* Return the "merged" types of TYPE1 and TYPE2.
If either is primitive, the other must match (after promotion to int).
If either is primitive, the other must match (after promotion to int).
For reference types, return the common super-class.
For reference types, return the common super-class.
...
@@ -186,11 +138,7 @@ merge_types (tree type1, tree type2)
...
@@ -186,11 +138,7 @@ merge_types (tree type1, tree type2)
return
type1
;
return
type1
;
if
(
type1
==
TYPE_UNKNOWN
||
type2
==
TYPE_UNKNOWN
if
(
type1
==
TYPE_UNKNOWN
||
type2
==
TYPE_UNKNOWN
||
type1
==
TYPE_RETURN_ADDR
||
type2
==
TYPE_RETURN_ADDR
)
||
type1
==
TYPE_RETURN_ADDR
||
type2
==
TYPE_RETURN_ADDR
)
return
TYPE_UNKNOWN
;
return
TYPE_UNKNOWN
;
if
(
TREE_CODE
(
type1
)
==
TREE_LIST
||
TREE_CODE
(
type2
)
==
TREE_LIST
)
return
defer_merging
(
type1
,
type2
);
if
(
TREE_CODE
(
type1
)
==
POINTER_TYPE
&&
TREE_CODE
(
type2
)
==
POINTER_TYPE
)
if
(
TREE_CODE
(
type1
)
==
POINTER_TYPE
&&
TREE_CODE
(
type2
)
==
POINTER_TYPE
)
{
{
int
depth1
,
depth2
;
int
depth1
,
depth2
;
...
@@ -205,9 +153,6 @@ merge_types (tree type1, tree type2)
...
@@ -205,9 +153,6 @@ merge_types (tree type1, tree type2)
tt1
=
TREE_TYPE
(
type1
);
tt1
=
TREE_TYPE
(
type1
);
tt2
=
TREE_TYPE
(
type2
);
tt2
=
TREE_TYPE
(
type2
);
if
(
TYPE_DUMMY
(
tt1
)
||
TYPE_DUMMY
(
tt2
))
return
defer_merging
(
tt1
,
tt2
);
/* If tt{1,2} haven't been properly loaded, now is a good time
/* If tt{1,2} haven't been properly loaded, now is a good time
to do it. */
to do it. */
if
(
!
TYPE_SIZE
(
tt1
))
if
(
!
TYPE_SIZE
(
tt1
))
...
@@ -248,10 +193,31 @@ merge_types (tree type1, tree type2)
...
@@ -248,10 +193,31 @@ merge_types (tree type1, tree type2)
return
object_ptr_type_node
;
return
object_ptr_type_node
;
}
}
if
(
CLASS_INTERFACE
(
TYPE_NAME
(
tt1
))
if
(
CLASS_INTERFACE
(
TYPE_NAME
(
tt1
)))
||
(
CLASS_INTERFACE
(
TYPE_NAME
(
tt2
))))
{
{
return
object_ptr_type_node
;
/* FIXME: should see if two interfaces have a common
superinterface. */
if
(
CLASS_INTERFACE
(
TYPE_NAME
(
tt2
)))
{
/* This is a kludge, but matches what Sun's verifier does.
It can be tricked, but is safe as long as type errors
(i.e. interface method calls) are caught at run-time. */
return
object_ptr_type_node
;
}
else
{
if
(
can_widen_reference_to
(
tt2
,
tt1
))
return
type1
;
else
return
object_ptr_type_node
;
}
}
else
if
(
CLASS_INTERFACE
(
TYPE_NAME
(
tt2
)))
{
if
(
can_widen_reference_to
(
tt1
,
tt2
))
return
type2
;
else
return
object_ptr_type_node
;
}
}
type1
=
tt1
;
type1
=
tt1
;
...
@@ -709,8 +675,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
...
@@ -709,8 +675,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
VERIFICATION_ERROR_WITH_INDEX
VERIFICATION_ERROR_WITH_INDEX
(
"invalid local variable index %d in load"
);
(
"invalid local variable index %d in load"
);
tmp
=
type_map
[
index
];
tmp
=
type_map
[
index
];
if
(
TREE_CODE
(
tmp
)
!=
TREE_LIST
)
{
if
(
tmp
==
TYPE_UNKNOWN
)
if
(
tmp
==
TYPE_UNKNOWN
)
VERIFICATION_ERROR_WITH_INDEX
VERIFICATION_ERROR_WITH_INDEX
(
"loading local variable %d which has unknown type"
);
(
"loading local variable %d which has unknown type"
);
...
@@ -724,7 +688,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
...
@@ -724,7 +688,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
:
type
!=
tmp
))
:
type
!=
tmp
))
VERIFICATION_ERROR_WITH_INDEX
VERIFICATION_ERROR_WITH_INDEX
(
"loading local variable %d which has invalid type"
);
(
"loading local variable %d which has invalid type"
);
}
PUSH_TYPE
(
tmp
);
PUSH_TYPE
(
tmp
);
goto
note_used
;
goto
note_used
;
case
OPCODE_istore
:
type
=
int_type_node
;
goto
general_store
;
case
OPCODE_istore
:
type
=
int_type_node
;
goto
general_store
;
...
@@ -773,7 +736,7 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
...
@@ -773,7 +736,7 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
prev_eh_ranges
=
NULL_EH_RANGE
;
prev_eh_ranges
=
NULL_EH_RANGE
;
/* Allocate decl for this variable now, so we get a temporary
/* Allocate decl for this variable now, so we get a temporary
that survives the whole method. */
!
that survives the whole method. */
find_local_variable
(
index
,
type
,
oldpc
);
find_local_variable
(
index
,
type
,
oldpc
);
if
(
TYPE_IS_WIDE
(
type
))
if
(
TYPE_IS_WIDE
(
type
))
...
@@ -1129,10 +1092,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
...
@@ -1129,10 +1092,6 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
if
(
!
CLASS_LOADED_P
(
self_type
))
if
(
!
CLASS_LOADED_P
(
self_type
))
load_class
(
self_type
,
1
);
load_class
(
self_type
,
1
);
if
(
TYPE_DUMMY
(
self_type
)
&&
op_code
==
OPCODE_invokeinterface
)
/* Assume we are an interface. */
CLASS_INTERFACE
(
TYPE_NAME
(
self_type
))
=
1
;
self_is_interface
=
CLASS_INTERFACE
(
TYPE_NAME
(
self_type
));
self_is_interface
=
CLASS_INTERFACE
(
TYPE_NAME
(
self_type
));
method_name
=
COMPONENT_REF_NAME
(
&
current_jcf
->
cpool
,
index
);
method_name
=
COMPONENT_REF_NAME
(
&
current_jcf
->
cpool
,
index
);
method_type
=
parse_signature_string
((
const
unsigned
char
*
)
IDENTIFIER_POINTER
(
sig
),
method_type
=
parse_signature_string
((
const
unsigned
char
*
)
IDENTIFIER_POINTER
(
sig
),
...
@@ -1170,6 +1129,7 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
...
@@ -1170,6 +1129,7 @@ verify_jvm_instructions (JCF* jcf, const unsigned char *byte_ops, long length)
if
(
!
nargs
||
notZero
)
if
(
!
nargs
||
notZero
)
VERIFICATION_ERROR
VERIFICATION_ERROR
(
"invalid argument number in invokeinterface"
);
(
"invalid argument number in invokeinterface"
);
/* If we verify/resolve the constant pool, as we should,
/* If we verify/resolve the constant pool, as we should,
this test (and the one just following) are redundant. */
this test (and the one just following) are redundant. */
if
(
!
self_is_interface
)
if
(
!
self_is_interface
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment