This commit is contained in:
blueloveTH 2023-02-22 18:28:02 +08:00
parent 4732d4149d
commit 371411d53a
9 changed files with 164 additions and 3986 deletions

View File

@ -2,7 +2,7 @@ with open("src/opcodes.h", "rt", encoding='utf-8') as f:
OPCODES_TEXT = f.read()
pipeline = [
["common.h", "hash_table5.hpp", "memory.h", "str.h", "safestl.h", "builtins.h", "error.h"],
["common.h", "memory.h", "str.h", "tuplelist.h", "namedict.h", "builtins.h", "error.h"],
["obj.h", "parser.h", "ref.h", "codeobject.h", "frame.h"],
["vm.h", "ceval.h", "compiler.h", "repl.h"],
["iter.h", "pocketpy.h"]

View File

@ -28,16 +28,13 @@
// #include <filesystem>
// namespace fs = std::filesystem;
#define EMH_EXT 1
#define EMH_FIND_HIT 1
#ifdef POCKETPY_H
#define UNREACHABLE() throw std::runtime_error( "L" + std::to_string(__LINE__) + " UNREACHABLE()!");
#else
#define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!");
#endif
#define PK_VERSION "0.8.9"
#define PK_VERSION "0.9.0"
#if defined(__EMSCRIPTEN__) || defined(__arm__) || defined(__i386__)
typedef int32_t i64;

View File

@ -1,6 +1,7 @@
#pragma once
#include "safestl.h"
#include "namedict.h"
#include "tuplelist.h"
struct NeedMoreLines {
NeedMoreLines(bool is_compiling_class) : is_compiling_class(is_compiling_class) {}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -147,3 +147,8 @@ struct SmallArrayPool {
}
}
};
typedef pkpy::shared_ptr<PyObject> PyVar;
typedef PyVar PyVarOrNull;
typedef PyVar PyVarRef;

View File

@ -1,6 +1,10 @@
#pragma once
#include "safestl.h"
#include "common.h"
#include "memory.h"
#include "str.h"
namespace pkpy{
struct NameDictNode{
StrName first;
@ -85,6 +89,7 @@ struct NameDict {
for(int i=0; i<old_capacity; i++){
if(old_a[i].empty()) continue;
HASH_PROBE(old_a[i].first, ok, j);
if(ok) UNREACHABLE();
_a[j].first = old_a[i].first;
_a[j].second = std::move(old_a[i].second);
_size++;
@ -158,3 +163,5 @@ struct NameDict {
#undef HASH_PROBE
#undef HASH_PROBE_OVERRIDE
};
} // namespace pkpy

View File

@ -1,6 +1,7 @@
#pragma once
#include "safestl.h"
#include "namedict.h"
#include "tuplelist.h"
struct CodeObject;
struct Frame;

View File

@ -4,18 +4,7 @@
#include "memory.h"
#include "str.h"
struct PyObject;
typedef pkpy::shared_ptr<PyObject> PyVar;
typedef PyVar PyVarOrNull;
typedef PyVar PyVarRef;
#include "hash_table5.hpp"
namespace pkpy {
#include "namedict.h"
// template<typename... Args>
// using HashMap = emhash5::HashMap<Args...>;
// typedef HashMap<StrName, PyVar> NameDict;
class List: public std::vector<PyVar> {
PyVar& at(size_t) = delete;