From 657a5a99edf0722c9db5956ca9d42db65c9e683e Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 9 Aug 2019 17:37:10 +0800 Subject: Standalone MIRI - More thread hackery --- tools/standalone_miri/lex.cpp | 4 +++- tools/standalone_miri/miri.cpp | 5 +++++ tools/standalone_miri/module_tree.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/standalone_miri/lex.cpp b/tools/standalone_miri/lex.cpp index 07427bde..79e94224 100644 --- a/tools/standalone_miri/lex.cpp +++ b/tools/standalone_miri/lex.cpp @@ -7,6 +7,8 @@ */ #include "lex.hpp" #include +#include +#include "debug.hpp" #include bool Token::operator==(TokenClass tc) const @@ -25,7 +27,7 @@ bool Token::operator==(const char* s) const uint64_t Token::integer() const { if( this->type != TokenClass::Integer ) - throw ""; + throw ::std::runtime_error(FMT_STRING("Expected interger, got " << *this)); return this->numbers.int_val; } double Token::real() const diff --git a/tools/standalone_miri/miri.cpp b/tools/standalone_miri/miri.cpp index c8326283..7407baf7 100644 --- a/tools/standalone_miri/miri.cpp +++ b/tools/standalone_miri/miri.cpp @@ -2272,6 +2272,11 @@ bool InterpreterThread::call_extern(Value& rv, const ::std::string& link_name, c rv = Value::new_i32(EPERM); } } + else if( link_name == "pthread_detach" ) + { + // "detach" - Prevent the need to explitly join a thread + rv = Value::new_i32(0); + } else if( link_name == "pthread_cond_init" || link_name == "pthread_cond_destroy" ) { rv = Value::new_i32(0); diff --git a/tools/standalone_miri/module_tree.cpp b/tools/standalone_miri/module_tree.cpp index f6b20fae..71a545fa 100644 --- a/tools/standalone_miri/module_tree.cpp +++ b/tools/standalone_miri/module_tree.cpp @@ -884,7 +884,7 @@ bool Parser::parse_one() ::std::vector targets; while(lex.next() != '{') { - targets.push_back( static_cast(lex.consume().integer()) ); + targets.push_back( static_cast(lex.check_consume(TokenClass::Integer).integer()) ); if( !lex.consume_if(',') ) break; } -- cgit v1.2.3