diff options
author | Ben Smith <binjimin@gmail.com> | 2017-05-15 10:07:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-15 10:07:21 -0700 |
commit | f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0 (patch) | |
tree | 1c2144a7c8acadf0850ad183920d0b247ddc501c /src/type-checker.cc | |
parent | 5d10e89b5d796edc62cfb6bc3f806d8a1b1272c0 (diff) | |
download | wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.tar.gz wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.tar.bz2 wabt-f1031e8ac4a4eb2ec886c03fa432d5b5b3cc56a0.zip |
Use Index/Address/Offset instead of uint32_t (#433)
An `Index` is an index into one of the WebAssembly index spaces. It also
is used for counts for these spaces, as well as parameter counts and
result counts.
An `Address` is an index into linear memory, or the size of a data
region in linear memory.
An `Offset` is an offset into the host's file or memory buffer.
This fixes issue #322.
Diffstat (limited to 'src/type-checker.cc')
-rw-r--r-- | src/type-checker.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/type-checker.cc b/src/type-checker.cc index c1e82f4e..d7af7e59 100644 --- a/src/type-checker.cc +++ b/src/type-checker.cc @@ -47,11 +47,11 @@ static void WABT_PRINTF_FORMAT(2, 3) } Result typechecker_get_label(TypeChecker* tc, - size_t depth, + Index depth, TypeCheckerLabel** out_label) { if (depth >= tc->label_stack.size()) { assert(tc->label_stack.size() > 0); - print_error(tc, "invalid depth: %" PRIzd " (max %" PRIzd ")", depth, + print_error(tc, "invalid depth: %" PRIindex " (max %" PRIzd ")", depth, tc->label_stack.size() - 1); *out_label = nullptr; return Result::Error; @@ -99,7 +99,7 @@ static Result check_label_type(TypeCheckerLabel* label, LabelType label_type) { return label->label_type == label_type ? Result::Ok : Result::Error; } -static Result peek_type(TypeChecker* tc, uint32_t depth, Type* out_type) { +static Result peek_type(TypeChecker* tc, Index depth, Type* out_type) { TypeCheckerLabel* label; CHECK_RESULT(top_label(tc, &label)); @@ -295,7 +295,7 @@ Result typechecker_on_block(TypeChecker* tc, const TypeVector* sig) { return Result::Ok; } -Result typechecker_on_br(TypeChecker* tc, size_t depth) { +Result typechecker_on_br(TypeChecker* tc, Index depth) { Result result = Result::Ok; TypeCheckerLabel* label; CHECK_RESULT(typechecker_get_label(tc, depth, &label)); @@ -305,7 +305,7 @@ Result typechecker_on_br(TypeChecker* tc, size_t depth) { return result; } -Result typechecker_on_br_if(TypeChecker* tc, size_t depth) { +Result typechecker_on_br_if(TypeChecker* tc, Index depth) { Result result = Result::Ok; COMBINE_RESULT(result, pop_and_check_1_type(tc, Type::I32, "br_if")); TypeCheckerLabel* label; @@ -320,7 +320,7 @@ Result typechecker_begin_br_table(TypeChecker* tc) { return pop_and_check_1_type(tc, Type::I32, "br_table"); } -Result typechecker_on_br_table_target(TypeChecker* tc, size_t depth) { +Result typechecker_on_br_table_target(TypeChecker* tc, Index depth) { Result result = Result::Ok; TypeCheckerLabel* label; CHECK_RESULT(typechecker_get_label(tc, depth, &label)); |